[Libreoffice-commits] core.git: sc/qa sc/source
dev/null |binary sc/qa/unit/uicalc/data/tdf131455-fixed.ods |binary sc/qa/unit/uicalc/uicalc.cxx | 35 ++--- sc/source/ui/view/tabview2.cxx |2 - 4 files changed, 4 insertions(+), 33 deletions(-) New commits: commit 1e7be382b1f400801d350067e4dfd40d4cfd2db3 Author: Luboš Luňák AuthorDate: Mon Mar 7 18:52:33 2022 +0100 Commit: Luboš Luňák CommitDate: Tue Mar 8 11:27:21 2022 +0100 revert/fix the incorrect fix for tdf#126904 The default cell style has protection turned off. That means that any cells that do not have a style that turns the protection on are actually not protected. So the original code was correct, it went beyond the cells explicitly saved in the file and the first "default" cell was not protected, so it was ok to jump there. Re-saving this document to xlsx and opening it in Excel has the same result. So revert the change. Keep the test, but edit the test file to actually protect cells in the default cell style too, as that way it's actually useful as a test of protected cells. And since the test for tdf#126904 is a subset of basically the same test for the same "bug" tdf#131455, keep only the larger test. Change-Id: I36f21c33aaf5a31e95aa29d616c6abdec17fcf42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131126 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/qa/unit/uicalc/data/tdf126904.ods b/sc/qa/unit/uicalc/data/tdf126904.ods deleted file mode 100644 index 0f2cf05132c4.. Binary files a/sc/qa/unit/uicalc/data/tdf126904.ods and /dev/null differ diff --git a/sc/qa/unit/uicalc/data/tdf131455-fixed.ods b/sc/qa/unit/uicalc/data/tdf131455-fixed.ods new file mode 100644 index ..08e02804bf1b Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf131455-fixed.ods differ diff --git a/sc/qa/unit/uicalc/data/tdf131455.ods b/sc/qa/unit/uicalc/data/tdf131455.ods deleted file mode 100644 index f4d8bca66375.. Binary files a/sc/qa/unit/uicalc/data/tdf131455.ods and /dev/null differ diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 00f966e2685d..682a2d13ab81 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -1391,7 +1391,9 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf119793) CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf131455) { -ScModelObj* pModelObj = createDoc("tdf131455.ods"); +// Note that tdf#131455 and tdf#126904 were actually incorrect, +// but keep the test with a fixed version of the document. +ScModelObj* pModelObj = createDoc("tdf131455-fixed.ods"); ScDocument* pDoc = pModelObj->GetDocument(); CPPUNIT_ASSERT(pDoc); @@ -1439,37 +1441,6 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf131455) CPPUNIT_ASSERT_EQUAL(sal_Int16(0), ScDocShell::GetViewData()->GetTabNo()); lcl_AssertCurrentCursorPosition(*pDoc, "N5"); -// Cursor can't move forward to the right -// Without the fix in place, this test would have failed with -// - Expected: 13 -// - Actual : 64 -for (size_t i = 0; i < 5; ++i) -{ -dispatchCommand(mxComponent, ".uno:GoRight", {}); -lcl_AssertCurrentCursorPosition(*pDoc, "N5"); -} -} - -CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126904) -{ -ScModelObj* pModelObj = createDoc("tdf126904.ods"); -ScDocument* pDoc = pModelObj->GetDocument(); -CPPUNIT_ASSERT(pDoc); - -lcl_AssertCurrentCursorPosition(*pDoc, "A5"); -dispatchCommand(mxComponent, ".uno:GoRight", {}); -lcl_AssertCurrentCursorPosition(*pDoc, "B5"); -dispatchCommand(mxComponent, ".uno:GoRight", {}); -lcl_AssertCurrentCursorPosition(*pDoc, "E5"); -dispatchCommand(mxComponent, ".uno:GoRight", {}); -lcl_AssertCurrentCursorPosition(*pDoc, "F5"); -dispatchCommand(mxComponent, ".uno:GoRight", {}); -lcl_AssertCurrentCursorPosition(*pDoc, "I5"); -dispatchCommand(mxComponent, ".uno:GoRight", {}); -lcl_AssertCurrentCursorPosition(*pDoc, "J5"); -dispatchCommand(mxComponent, ".uno:GoRight", {}); -lcl_AssertCurrentCursorPosition(*pDoc, "M5"); - //Cursor can't move forward to the right for (size_t i = 0; i < 5; ++i) { diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 859dc530f797..a2c8c5e71e47 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -739,7 +739,7 @@ void ScTabView::SkipCursorHorizontal(SCCOL& rCurX, SCROW& rCurY, SCCOL nOldX, SC bool bSkipCell = false; bool bHFlip = false; -auto nMaxCol = rDoc.ClampToAllocatedColumns(nTab, rDoc.MaxCol()); +auto nMaxCol = rDoc.MaxCol(); do { bSkipCell = rDoc.ColHidden(rCurX, nTab) || rDoc.IsHorOverlapped(rCurX, rCurY, nTab);
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/mark_test.cxx | 32 +++ sc/source/core/data/markdata.cxx | 13 +-- sc/source/ui/Accessibility/AccessibleDocument.cxx|1 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx |1 sc/source/ui/unoobj/cellsuno.cxx |4 -- 5 files changed, 42 insertions(+), 9 deletions(-) New commits: commit 19e3644eaf8f3f09c22c94e4ad8352f844fc4955 Author: Luboš Luňák AuthorDate: Thu Mar 3 12:21:27 2022 +0100 Commit: Luboš Luňák CommitDate: Thu Mar 3 22:37:49 2022 +0100 make ScMarkData::IsAllMarked() work also for simple marks Change-Id: I41009c83827619605b4cfc4909f1d9922cde68a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130923 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/qa/unit/mark_test.cxx b/sc/qa/unit/mark_test.cxx index 309a62143aff..55a13cb0da57 100644 --- a/sc/qa/unit/mark_test.cxx +++ b/sc/qa/unit/mark_test.cxx @@ -112,6 +112,8 @@ public: void testScMarkArraySearch(); +void testIsAllMarked(); + CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testSimpleMark_Simple); CPPUNIT_TEST(testSimpleMark_Column); @@ -123,6 +125,7 @@ public: CPPUNIT_TEST(testDeleteTabBeforeSelected); CPPUNIT_TEST(testDeleteTabAfterSelected); CPPUNIT_TEST(testScMarkArraySearch); +CPPUNIT_TEST(testIsAllMarked); CPPUNIT_TEST_SUITE_END(); private: @@ -970,6 +973,35 @@ void Test::testScMarkArraySearch() } } +void Test::testIsAllMarked() +{ +ScSheetLimits aSheetLimits(MAXCOL, MAXROW); +ScMarkData mark(aSheetLimits); +ScRange range1( ScAddress( 5, 10, 0 ), ScAddress( 15, 20, 0 )); +ScRange range2( ScAddress( 2, 2, 0 ), ScAddress( 25, 30, 0 )); +CPPUNIT_ASSERT( !mark.IsAllMarked( range1 )); +CPPUNIT_ASSERT( !mark.IsAllMarked( range2 )); +mark.MarkToMulti(); +CPPUNIT_ASSERT( !mark.IsAllMarked( range1 )); +CPPUNIT_ASSERT( !mark.IsAllMarked( range2 )); + +mark.ResetMark(); +mark.SetMarkArea( range1 ); +CPPUNIT_ASSERT( mark.IsAllMarked( range1 )); +CPPUNIT_ASSERT( !mark.IsAllMarked( range2 )); +mark.MarkToMulti(); +CPPUNIT_ASSERT( mark.IsAllMarked( range1 )); +CPPUNIT_ASSERT( !mark.IsAllMarked( range2 )); + +mark.ResetMark(); +mark.SetMarkArea( range2 ); +CPPUNIT_ASSERT( mark.IsAllMarked( range1 )); +CPPUNIT_ASSERT( mark.IsAllMarked( range2 )); +mark.MarkToMulti(); +CPPUNIT_ASSERT( mark.IsAllMarked( range1 )); +CPPUNIT_ASSERT( mark.IsAllMarked( range2 )); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/core/data/markdata.cxx b/sc/source/core/data/markdata.cxx index 2b3f948d8803..596937e24346 100644 --- a/sc/source/core/data/markdata.cxx +++ b/sc/source/core/data/markdata.cxx @@ -564,13 +564,20 @@ std::vector ScMarkData::GetMarkedColSpans() const bool ScMarkData::IsAllMarked( const ScRange& rRange ) const { -if ( !bMultiMarked ) -return false; - SCCOL nStartCol = rRange.aStart.Col(); SCROW nStartRow = rRange.aStart.Row(); SCCOL nEndCol = rRange.aEnd.Col(); SCROW nEndRow = rRange.aEnd.Row(); + +if ( !bMultiMarked ) +{ +if ( bMarked && !bMarkIsNeg && + aMarkRange.aStart.Col() <= nStartCol && aMarkRange.aEnd.Col() >= nEndCol && + aMarkRange.aStart.Row() <= nStartRow && aMarkRange.aEnd.Row() >= nEndRow ) +return true; +return false; +} + bool bOk = true; if ( nStartCol == 0 && nEndCol == mrSheetLimits.mnMaxCol ) diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index 21e3d1813a77..251bba490f87 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -2114,7 +2114,6 @@ bool ScAccessibleDocument::IsTableSelected() const SCTAB nTab(getVisibleTable()); //#103800#; use a copy of MarkData ScMarkData aMarkData(mpViewShell->GetViewData().GetMarkData()); -aMarkData.MarkToMulti(); ScDocument* pDoc = GetDocument(); if (aMarkData.IsAllMarked( ScRange( 0, 0, nTab, pDoc->MaxCol(), pDoc->MaxRow(), nTab))) bResult = true; diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index f8399b68918a..8abbe1f7b967 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -1357,7 +1357,6 @@ bool ScAccessibleSpreadsheet::IsCompleteSheetSelected() { //#103800#; use a copy of MarkData ScMarkData aMarkData(mpViewShell->GetViewData().GetMarkData()); -aMarkData.MarkToMulti(); if (aMarkData.IsAllMarked(maRange)) bResult = true; } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsb/pivottable_error_item_filter.xlsb |binary sc/qa/unit/data/xlsx/tdf122471.xlsx|binary sc/qa/unit/pivottable_filters_test.cxx | 56 + sc/source/filter/inc/pivotcachebuffer.hxx |2 sc/source/filter/oox/pivotcachebuffer.cxx | 10 +-- sc/source/filter/oox/pivotcachefragment.cxx|2 6 files changed, 63 insertions(+), 7 deletions(-) New commits: commit 6961f6732954742415413fa53bdeebd1b03d9ec5 Author: Justin Luth AuthorDate: Mon Feb 28 15:36:08 2022 +0200 Commit: Justin Luth CommitDate: Mon Feb 28 19:17:53 2022 +0100 tdf#122471 xlsx import: pivottable error OUString, not uInt8 This fixes a LO 6.0 regression from commit 9fa34e9f2cebe2cfc551668f2a67ddcb799d3fb8 which only half-way changed to OUString from uInt8. An exception was raised because in XLSX, an INT was written while the corresponding read function was expecting an OUString. However, doing this runs into problems with binary files (xlsb), which were still setting the value to an int. Unit test shows the need to use OUString for xlsb too, which now matches what I see in Excel 2003. make CppunitTest_sc_pivottable_filters_test \ CPPUNIT_TEST_NAME=testPivotTableErrorItem2FilterXLSX Change-Id: I399c9e34984bb1ff71695a87aa56f53063d37b3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130714 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/qa/unit/data/xlsb/pivottable_error_item_filter.xlsb b/sc/qa/unit/data/xlsb/pivottable_error_item_filter.xlsb new file mode 100644 index ..c32b8f3743e6 Binary files /dev/null and b/sc/qa/unit/data/xlsb/pivottable_error_item_filter.xlsb differ diff --git a/sc/qa/unit/data/xlsx/tdf122471.xlsx b/sc/qa/unit/data/xlsx/tdf122471.xlsx new file mode 100644 index ..febac5c73506 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf122471.xlsx differ diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index 36aa697b5071..14f790e89b68 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -79,6 +79,8 @@ public: void testPivotTableBoolFieldFilterXLSX(); void testPivotTableRowColPageFieldFilterXLSX(); void testPivotTableErrorItemFilterXLSX(); +void testPivotTableErrorItemFilterXLSB(); +void testPivotTableErrorItem2FilterXLSX(); void testPivotTableOutlineModeXLSX(); void testPivotTableDuplicatedMemberFilterXLSX(); void testPivotTableTabularModeXLSX(); @@ -130,6 +132,8 @@ public: CPPUNIT_TEST(testPivotTableBoolFieldFilterXLSX); CPPUNIT_TEST(testPivotTableRowColPageFieldFilterXLSX); CPPUNIT_TEST(testPivotTableErrorItemFilterXLSX); +CPPUNIT_TEST(testPivotTableErrorItemFilterXLSB); +CPPUNIT_TEST(testPivotTableErrorItem2FilterXLSX); CPPUNIT_TEST(testPivotTableOutlineModeXLSX); CPPUNIT_TEST(testPivotTableDuplicatedMemberFilterXLSX); CPPUNIT_TEST(testPivotTableTabularModeXLSX); @@ -2365,6 +2369,58 @@ void ScPivotTableFiltersTest::testPivotTableErrorItemFilterXLSX() xDocSh->DoClose(); } +void ScPivotTableFiltersTest::testPivotTableErrorItemFilterXLSB() +{ +ScDocShellRef xDocSh = loadDoc(u"pivottable_error_item_filter.", FORMAT_XLSB); +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()); +const ScDPObject* pDPObj = &(*pDPs)[0]; +CPPUNIT_ASSERT(pDPObj); +ScDPSaveData* pSaveData = pDPObj->GetSaveData(); +CPPUNIT_ASSERT(pSaveData); + +ScDPSaveDimension* pSaveDim = pSaveData->GetExistingDimensionByName(u"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()); +CPPUNIT_ASSERT(!pMember->GetIsVisible()); + +xDocSh->DoClose(); +} + +void ScPivotTableFiltersTest::testPivotTableErrorItem2FilterXLSX() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf122471.", 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]; +
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx |4 ++-- sc/source/core/data/attarray.cxx |3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) New commits: commit 265bfa9fc0b732a8df9d75ad2c34b68440539665 Author: Luboš Luňák AuthorDate: Fri Feb 25 21:44:23 2022 +0100 Commit: Luboš Luňák CommitDate: Sun Feb 27 10:43:29 2022 +0100 fix inverted condition Logic says that 'contains' should be '!empty()'. And checking history shows that 94d76cef1f71056fab106caf4cc8e65504475615 inverted the condition presumably by mistake. Change-Id: I6c0ddc6486a5fb89eb39b93e32ee52d478c05927 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130543 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index b0990b41f150..9db6cd3a3ae3 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1196,7 +1196,7 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol() Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); CPPUNIT_ASSERT_EQUAL(size_t(2), aView.m_aInvalidations.size()); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(-75, 50985, 32212230, 63990), aView.m_aInvalidations[0]); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(-75, 51240, 32212230, 63990), aView.m_aInvalidations[0]); // move on the right for (int i = 0; i < 200; ++i) @@ -1213,7 +1213,7 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol() Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); CPPUNIT_ASSERT_EQUAL(size_t(2), aView.m_aInvalidations.size()); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(253650, -15, 32212230, 63990), aView.m_aInvalidations[0]); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(254925, -15, 32212230, 63990), aView.m_aInvalidations[0]); } void ScTiledRenderingTest::testCommentCallback() diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index 5116001576ad..1f48990aa05d 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -1304,8 +1304,7 @@ bool ScAttrArray::HasAttrib_Impl(const ScPatternAttr* pPattern, HasAttrFlags nMa } if ( nMask & HasAttrFlags::Conditional ) { -bool bContainsCondFormat = pPattern->GetItem( ATTR_CONDITIONAL ).GetCondFormatData().empty(); -if ( bContainsCondFormat ) +if ( !pPattern->GetItem( ATTR_CONDITIONAL ).GetCondFormatData().empty()) bFound = true; } if ( nMask & HasAttrFlags::Protected )
[Libreoffice-commits] core.git: sc/qa sc/source
sc/source/ui/docshell/docsh.cxx | 42 ++-- 1 file changed, 28 insertions(+), 14 deletions(-) New commits: commit 61abbc2f9698f48bf92ec102952cd6b4fcc536d1 Author: Luboš Luňák AuthorDate: Thu Feb 24 16:26:09 2022 +0100 Commit: Luboš Luňák CommitDate: Sat Feb 26 19:54:20 2022 +0100 do not fail import if there are only warnings When opening CVE-2012-4233-4.xls or ofz5527-1.xls in LO UI, they show a warning about too many columns (presumably because Excel as of now supports 16k and LO only 1k columns by default), but besides stripping the extra columns they otherwise actually load normally. But ScFiltersTest::testCVEs() fails loading them just because of the warning. And if 16k columns are forced for the tests, the files unexpectedly load fine, making the test fail. ScDocShell::ConvertFrom() is rather inconsistent on whether only a warning results in a failed load or not, but most seem not to return failure on only warnings, and I think that makes sense, so make code paths for all formats consistently handle it that way. Change-Id: I202f29f5a5a44aecd34b84cf2f8180222e8d870a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130500 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/qa/unit/data/xls/fail/CVE-2012-4233-4.xls b/sc/qa/unit/data/xls/pass/CVE-2012-4233-4.xls similarity index 100% rename from sc/qa/unit/data/xls/fail/CVE-2012-4233-4.xls rename to sc/qa/unit/data/xls/pass/CVE-2012-4233-4.xls diff --git a/sc/qa/unit/data/xls/fail/ofz5527-1.xls b/sc/qa/unit/data/xls/pass/ofz5527-1.xls similarity index 100% rename from sc/qa/unit/data/xls/fail/ofz5527-1.xls rename to sc/qa/unit/data/xls/pass/ofz5527-1.xls diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index d30d4b89f236..5cfe7ee0b78b 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1217,16 +1217,12 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) // all graphics objects must have names m_aDocument.EnsureGraphicNames(); -if (eError == SCWARN_IMPORT_RANGE_OVERFLOW) -{ -if (!GetError()) -SetError(eError); -bRet = true; -} -else if (eError != ERRCODE_NONE) +if (eError != ERRCODE_NONE) { if (!GetError()) SetError(eError); +if( eError.IsWarning() ) +bRet = true; } else bRet = true; @@ -1317,6 +1313,8 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) { if (!GetError()) SetError(eError); +if( eError.IsWarning() ) +bRet = true; } else if (!GetError() && (bOverflowRow || bOverflowCol || bOverflowCell)) { @@ -1357,7 +1355,8 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) { if (!GetError()) SetError(eError); -bRet = ( eError == SCWARN_IMPORT_RANGE_OVERFLOW ); +if( eError.IsWarning() ) +bRet = true; } else bRet = true; @@ -1435,8 +1434,13 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) } } -if ( eError != ERRCODE_NONE && !GetError() ) -SetError(eError); +if (eError != ERRCODE_NONE) +{ +if (!GetError()) +SetError(eError); +if( eError.IsWarning() ) +bRet = true; +} else if (!GetError() && (bOverflowRow || bOverflowCol || bOverflowCell)) { // precedence: row, column, cell @@ -1500,8 +1504,13 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) } } -if ( eError != ERRCODE_NONE && !GetError() ) -SetError(eError); +if (eError != ERRCODE_NONE) +{ +if (!GetError()) +SetError(eError); +if( eError.IsWarning() ) +bRet = true; +} } else if (aFltName == pFilterHtml || aFltName == pFilterHtmlWebQ) { @@ -1551,8 +1560,13 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) } } -if ( eError != ERRCODE_NONE && !GetError() ) -SetError(eError); +if (eError != ERRCODE_NONE) +{ +if (!GetError()) +SetError(eError); +if( eError.IsWarning() ) +bRet = true; +} } else {
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/extras/macros-test.cxx | 64 ++ sc/source/ui/vba/vbarange.cxx |6 +-- 2 files changed, 67 insertions(+), 3 deletions(-) New commits: commit 7234576d4e3a6b384168a84165b59ee7751cda62 Author: Mike Kaganski AuthorDate: Wed Feb 23 18:14:38 2022 +0300 Commit: Mike Kaganski CommitDate: Wed Feb 23 22:42:33 2022 +0100 tdf#147611: fix indices The maKeyState vector in ScSortParam is initialized with three elements, and they are never removed. The code in ScVbaRange::Sort incorrectly used 1-based indices into that vector. This was broken since commit a02b445c39d969fedc554fc2c500b88a27a13906 Author: Albert Thuswaldner Date: Tue Mar 20 19:38:29 2012 +0100 fdo#45747 remove the limitation to 3 sort entries in calc part1 It was fixed in commit 568d3912bf8ced76ecb9506bccc3bd361daba082 Author: Kohei Yoshida Date: Wed Apr 04 15:30:35 2012 -0400 Cleanup. ScPivot(Collection) is no more. but was restored by commit 3e887edcaacc5b0f5e35d682a259124648e84229 Author: Markus Mohrhard Date: Thu Apr 5 05:05:40 2012 +0200 Revert "Cleanup. ScPivot(Collection) is no more." Change-Id: I009252e794c9365f0aef8a61daf9cbd40eca8b75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130441 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index cc77943ab879..2516024442b6 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -17,6 +17,7 @@ #include #include +#include #include @@ -65,6 +66,7 @@ public: void testTdf146742(); void testMacroButtonFormControlXlsxExport(); void testShapeLayerId(); +void testVbaRangeSort(); CPPUNIT_TEST_SUITE(ScMacrosTest); CPPUNIT_TEST(testStarBasic); @@ -94,6 +96,7 @@ public: CPPUNIT_TEST(testTdf146742); CPPUNIT_TEST(testMacroButtonFormControlXlsxExport); CPPUNIT_TEST(testShapeLayerId); +CPPUNIT_TEST(testVbaRangeSort); CPPUNIT_TEST_SUITE_END(); }; @@ -1047,6 +1050,67 @@ void ScMacrosTest::testShapeLayerId() pDocSh->DoClose(); } +void ScMacrosTest::testVbaRangeSort() +{ +auto xComponent = loadFromDesktop("private:factory/scalc"); + +css::uno::Reference xDocScr(xComponent, UNO_QUERY_THROW); +auto xLibs = xDocScr->getBasicLibraries(); +auto xLibrary = xLibs->createLibrary("TestLibrary"); +xLibrary->insertByName( +"TestModule", +uno::Any(OUString("Option VBASupport 1\n" + "Sub TestRangeSort\n" + " Range(Cells(1, 1), Cells(3, 1)).Select\n" + " Selection.Sort Key1:=Range(\"A1\"), Header:=False\n" + "End Sub\n"))); + +Any aRet; +Sequence aOutParamIndex; +Sequence aOutParam; + +SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); +ScDocShell* pDocSh = static_cast(pFoundShell); +CPPUNIT_ASSERT(pDocSh); +ScDocument& rDoc = pDocSh->GetDocument(); + +rDoc.SetValue(ScAddress(0, 0, 0), 1.0); +rDoc.SetValue(ScAddress(0, 1, 0), 0.5); +rDoc.SetValue(ScAddress(0, 2, 0), 2.0); + +// Without the fix in place, this call would have crashed in debug builds with failed assertion +ErrCode result = SfxObjectShell::CallXScript( +xComponent, + "vnd.sun.Star.script:TestLibrary.TestModule.TestRangeSort?language=Basic=document", +{}, aRet, aOutParamIndex, aOutParam); +CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, result); + +CPPUNIT_ASSERT_EQUAL(0.5, rDoc.GetValue(ScAddress(0, 0, 0))); +CPPUNIT_ASSERT_EQUAL(1.0, rDoc.GetValue(ScAddress(0, 1, 0))); +CPPUNIT_ASSERT_EQUAL(2.0, rDoc.GetValue(ScAddress(0, 2, 0))); + +// Change sheet's first param sorting order +ScSortParam aParam; +rDoc.GetSortParam(aParam, 0); +aParam.maKeyState[0].bAscending = false; +rDoc.SetSortParam(aParam, 0); + +result = SfxObjectShell::CallXScript( +xComponent, + "vnd.sun.Star.script:TestLibrary.TestModule.TestRangeSort?language=Basic=document", +{}, aRet, aOutParamIndex, aOutParam); +CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, result); + +// Without the fix in place, this test would have failed in non-debug builds with +// - Expected: 2 +// - Actual : 0.5 +CPPUNIT_ASSERT_EQUAL(2.0, rDoc.GetValue(ScAddress(0, 0, 0))); +CPPUNIT_ASSERT_EQUAL(1.0, rDoc.GetValue(ScAddress(0, 1, 0))); +CPPUNIT_ASSERT_EQUAL(0.5, rDoc.GetValue(ScAddress(0, 2, 0))); + +pDocSh->DoClose(); +} + ScMacrosTest::ScMacrosTest() : UnoApiTest("/sc/qa/extras/testdocuments") { diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index d15420bb698c..0c0e5f256e02 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -3413,9 +3413,9 @@ ScVbaRange::Sort(
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/pivottable_filters_test.cxx |5 +++-- sc/source/filter/excel/xestream.cxx| 12 ++-- sc/source/filter/oox/formulabuffer.cxx |7 +++ 3 files changed, 20 insertions(+), 4 deletions(-) New commits: commit 8f5d8669ca74fed8608e438a8436c173e35d43a6 Author: Justin Luth AuthorDate: Wed Feb 23 10:34:29 2022 +0200 Commit: Justin Luth CommitDate: Wed Feb 23 16:48:56 2022 +0100 tdf#122098 xlsx im/export: let formulas guess their number format This fixes the import side of a LO 4.2 regression from commit 07b66cd3ac1a9f6c7b61a1d7da6e9d266e6de92d and the export side of a LO 4.3 regression from commit 69ecdad805281b2cb6ec2437da18daa19576deae make CppunitTest_sc_pivottable_filters_test \ CPPUNIT_TEST_NAME=testPivotTableBoolFieldFilterXLSX Change-Id: I4c680dbff844cf1eca52de641856daafa032eeb4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130406 Tested-by: Justin Luth Reviewed-by: Justin Luth diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index ef31fcf81282..36aa697b5071 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -2196,6 +2196,7 @@ void ScPivotTableFiltersTest::testPivotTableBoolFieldFilterXLSX() ScDocument& rDoc = xDocSh->GetDocument(); ScDPCollection* pDPs = rDoc.GetDPCollection(); CPPUNIT_ASSERT_EQUAL(static_cast(1), pDPs->GetCount()); +CPPUNIT_ASSERT_EQUAL(OUString("TRUE"), rDoc.GetString(ScAddress(0, 1, 0))); //A2 // Reload and check filtering of row dimensions xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX); @@ -2213,11 +2214,11 @@ void ScPivotTableFiltersTest::testPivotTableBoolFieldFilterXLSX() const ScDPSaveDimension::MemberList& rMembers = pSaveDim->GetMembers(); CPPUNIT_ASSERT_EQUAL(size_t(2), rMembers.size()); -ScDPSaveMember* pMember = pSaveDim->GetExistingMemberByName("0"); +ScDPSaveMember* pMember = pSaveDim->GetExistingMemberByName("FALSE"); CPPUNIT_ASSERT(pMember); CPPUNIT_ASSERT(pMember->HasIsVisible()); CPPUNIT_ASSERT(!pMember->GetIsVisible()); -pMember = pSaveDim->GetExistingMemberByName("1"); +pMember = pSaveDim->GetExistingMemberByName("TRUE"); CPPUNIT_ASSERT(pMember); CPPUNIT_ASSERT(pMember->HasIsVisible()); CPPUNIT_ASSERT(pMember->GetIsVisible()); diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 74c0f9514831..a3c1b92fe86d 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -673,8 +673,16 @@ void XclXmlUtils::GetFormulaTypeAndValue( ScFormulaCell& rCell, const char*& rsT rsValue = ToOUString(lcl_GetErrorString(aResValue.mnError)); break; case sc::FormulaResultValue::Value: -rsType = "n"; -rsValue = OUString::number(aResValue.mfValue); +if (rCell.GetFormatType() == SvNumFormatType::LOGICAL) +{ +rsType = "b"; +rsValue = rCell.GetValue() == 0.0 ? "0" : "1"; +} +else +{ +rsType = "n"; +rsValue = OUString::number(aResValue.mfValue); +} break; case sc::FormulaResultValue::String: rsType = "str"; diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index 2aeccb1b37b7..7fcc4f5e259f 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -153,6 +153,9 @@ void applySharedFormulas( pCell = new ScFormulaCell(rDoc.getDoc(), aPos, *pArray); rDoc.setFormulaCell(aPos, pCell); +if (rDoc.getDoc().GetNumberFormat(aPos.Col(), aPos.Row(), aPos.Tab()) % SV_COUNTRY_LANGUAGE_OFFSET == 0) +pCell->SetNeedNumberFormat(true); + if (rDesc.maCellValue.isEmpty()) { // No cached cell value. Mark it for re-calculation. @@ -227,6 +230,8 @@ void applyCellFormulas( pCell = new ScFormulaCell(rDoc.getDoc(), aPos, p->mpCell->GetCode()->Clone()); rDoc.setFormulaCell(aPos, pCell); +if (rDoc.getDoc().GetNumberFormat(aPos.Col(), aPos.Row(), aPos.Tab()) % SV_COUNTRY_LANGUAGE_OFFSET == 0) +pCell->SetNeedNumberFormat(true); // Update the cache. p->mnRow = aPos.Row(); @@ -245,6 +250,8 @@ void applyCellFormulas( ScFormulaCell* pCell = new ScFormulaCell(rDoc.getDoc(), aPos, std::move(pCode)); rDoc.setFormulaCell(aPos, pCell); +if (rDoc.getDoc().GetNumberFormat(aPos.Col(), aPos.Row(), aPos.Tab()) % SV_COUNTRY_LANGUAGE_OFFSET == 0) +pCell->SetNeedNumberFormat(true); rCache.store(aPos, pCell); } }
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/bugfix-test.cxx |4 sc/qa/unit/helper/qahelper.cxx |2 sc/qa/unit/rangelst_test.cxx| 18 ++-- sc/qa/unit/subsequent_export_test.cxx |4 sc/qa/unit/subsequent_filters_test.cxx |4 sc/qa/unit/subsequent_filters_test2.cxx | 25 +++-- sc/qa/unit/ucalc.cxx| 140 sc/qa/unit/ucalc_condformat.cxx | 20 ++-- sc/qa/unit/ucalc_copypaste.cxx |4 sc/qa/unit/ucalc_sharedformula.cxx | 28 +++--- sc/qa/unit/ucalc_sort.cxx |4 sc/source/core/data/colorscale.cxx |2 sc/source/core/data/conditio.cxx|2 sc/source/core/data/drwlayer.cxx| 12 +- sc/source/core/data/formulacell.cxx |8 - sc/source/core/data/stlsheet.cxx|2 sc/source/core/data/table6.cxx |2 sc/source/core/data/table7.cxx | 12 +- sc/source/ui/view/gridwin4.cxx |4 19 files changed, 153 insertions(+), 144 deletions(-) New commits: commit 35cad9f57e761eef78820d092a4bb9d2f0641052 Author: Luboš Luňák AuthorDate: Fri Feb 18 14:30:14 2022 +0100 Commit: Luboš Luňák CommitDate: Fri Feb 18 17:28:50 2022 +0100 convert more MAXCOL/MAXROW Change-Id: Ifb2c9ea7b440890224c7e837422c8a1358f8c5b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130143 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx index dc8538590e20..b5b0c92a800e 100644 --- a/sc/qa/unit/bugfix-test.cxx +++ b/sc/qa/unit/bugfix-test.cxx @@ -400,10 +400,10 @@ void ScFiltersTest::testTdf91979() auto& rDoc = aViewData.GetDocument(); // Check coordinates of a distant cell -Point aPos = aViewData.GetScrPos(MAXCOL - 1, 1, SC_SPLIT_TOPLEFT, true); +Point aPos = aViewData.GetScrPos(rDoc.MaxCol() - 1, 1, SC_SPLIT_TOPLEFT, true); int nColWidth = ScViewData::ToPixel(rDoc.GetColWidth(0, 0), aViewData.GetPPTX()); int nRowHeight = ScViewData::ToPixel(rDoc.GetRowHeight(0, 0), aViewData.GetPPTY()); -CPPUNIT_ASSERT_EQUAL(static_cast((MAXCOL - 1) * nColWidth), aPos.getX()); +CPPUNIT_ASSERT_EQUAL(static_cast((rDoc.MaxCol() - 1) * nColWidth), aPos.getX()); CPPUNIT_ASSERT_EQUAL(static_cast(1 * nRowHeight), aPos.getY()); } diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 5f0ae6389df9..8308cdf0b982 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -1109,7 +1109,7 @@ void clearRange(ScDocument* pDoc, const ScRange& rRange) void clearSheet(ScDocument* pDoc, SCTAB nTab) { -ScRange aRange(0,0,nTab,MAXCOL,MAXROW,nTab); +ScRange aRange(0,0,nTab,pDoc->MaxCol(),pDoc->MaxRow(),nTab); clearRange(pDoc, aRange); } diff --git a/sc/qa/unit/rangelst_test.cxx b/sc/qa/unit/rangelst_test.cxx index 883519f5323b..b6a3e3c2d830 100644 --- a/sc/qa/unit/rangelst_test.cxx +++ b/sc/qa/unit/rangelst_test.cxx @@ -504,7 +504,7 @@ void Test::testJoin_Case5() void Test::testUpdateReference_DeleteRow() { ScRangeList aList(ScRange(1,1,0,4,4,0)); -bool bUpdated = aList.UpdateReference(URM_INSDEL, m_pDoc, ScRange(0,3,0,MAXCOL,MAXROW,0), 0, -1, 0); +bool bUpdated = aList.UpdateReference(URM_INSDEL, m_pDoc, ScRange(0,3,0,m_pDoc->MaxCol(),m_pDoc->MaxRow(),0), 0, -1, 0); CPPUNIT_ASSERT(bUpdated); for(SCCOL nCol = 1; nCol <= 4; ++nCol) @@ -518,35 +518,35 @@ void Test::testUpdateReference_DeleteRow() CPPUNIT_ASSERT_EQUAL(static_cast(12), aList.GetCellCount()); ScRangeList aList2(ScRange(2,2,0,2,2,0)); -aList2.UpdateReference(URM_INSDEL, m_pDoc, ScRange(0,3,0,MAXCOL,MAXROW,0), 0, -1, 0); +aList2.UpdateReference(URM_INSDEL, m_pDoc, ScRange(0,3,0,m_pDoc->MaxCol(),m_pDoc->MaxRow(),0), 0, -1, 0); CPPUNIT_ASSERT(aList2.empty()); ScRangeList aList3; aList3.push_back(ScRange(2,2,0,2,8,0)); aList3.push_back(ScRange(4,2,0,4,8,0)); -aList3.UpdateReference(URM_INSDEL, m_pDoc, ScRange(2,5,0,MAXCOL,MAXROW,0), 0, -1, 0); +aList3.UpdateReference(URM_INSDEL, m_pDoc, ScRange(2,5,0,m_pDoc->MaxCol(),m_pDoc->MaxRow(),0), 0, -1, 0); // Verify all ranges in the list have been updated properly. CPPUNIT_ASSERT_EQUAL(size_t(2), aList3.size()); CPPUNIT_ASSERT_EQUAL(ScRange(2,2,0,2,7,0), aList3[0]); CPPUNIT_ASSERT_EQUAL(ScRange(4,2,0,4,7,0), aList3[1]); -ScRangeList aList4(ScRange(0,0,0,MAXCOL,MAXROW,0)); +ScRangeList aList4(ScRange(0,0,0,m_pDoc->MaxCol(),m_pDoc->MaxRow(),0)); ScRangeList aList4Copy = aList4; -aList4.UpdateReference(URM_INSDEL, m_pDoc, ScRange(14,3,0,MAXCOL,7,0), 0, -2, 0); +aList4.UpdateReference(URM_INSDEL, m_pDoc, ScRange(14,3,0,m_pDoc->MaxCol(),7,0), 0, -2, 0); CPPUNIT_ASSERT_EQUAL(aList4Copy, aList4); } void Test::testUpdateReference_DeleteLastRow() { ScRangeList aList(ScRange(1,1,0,4,4,0)); -bool bUpdated =
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/range.cxx| 11 ++ sc/source/core/tool/address.cxx | 63 +++- 2 files changed, 42 insertions(+), 32 deletions(-) New commits: commit 7bb0b11873d0c96d8116b327987834db048754c3 Author: Luboš Luňák AuthorDate: Thu Feb 17 14:44:48 2022 +0100 Commit: Luboš Luňák CommitDate: Thu Feb 17 16:59:48 2022 +0100 fix range checking when parsing Calc cell address (tdf#147451) The document contains 'Sheet1', which Calc first tried to parse as a normal address, since it matches the format of e.g. 'XFD1'. The code parsed column into SCCOL (sal_Int16), which with 16k column limit overflowed and the code failed to detect the problem. Change-Id: I470db1b670dbff7bdc8013bede0a0b011e88c372 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130073 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/qa/unit/range.cxx b/sc/qa/unit/range.cxx index d704eb2dc4e2..843ecddcb596 100644 --- a/sc/qa/unit/range.cxx +++ b/sc/qa/unit/range.cxx @@ -28,9 +28,11 @@ public: CPPUNIT_TEST_SUITE(ScAddressTest); CPPUNIT_TEST(testAddressParsing); +CPPUNIT_TEST(testTdf147451); CPPUNIT_TEST_SUITE_END(); void testAddressParsing(); +void testTdf147451(); private: ScDocShellRef m_xDocShRef; @@ -44,6 +46,15 @@ void ScAddressTest::testAddressParsing() CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", !(nRes & ScRefFlags::VALID)); } +void ScAddressTest::testTdf147451() +{ +ScAddress aAddr; +ScDocument& rDoc = m_xDocShRef->GetDocument(); +// "Sheet1" is technically a valid address like "XF1", but it should overflow. +ScRefFlags nRes = aAddr.Parse("Sheet1", rDoc, formula::FormulaGrammar::CONV_OOO); +CPPUNIT_ASSERT_MESSAGE("Should fail to parse.", !(nRes & ScRefFlags::VALID)); +} + void ScAddressTest::setUp() { BootstrapFixture::setUp(); diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index 668c08b063d3..28f1b0b7f6ad 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -133,9 +133,9 @@ const sal_Unicode* parseQuotedName( const sal_Unicode* p, OUString& rName ) } -static tools::Long sal_Unicode_strtol ( const sal_Unicode* p, const sal_Unicode** pEnd ) +static sal_Int64 sal_Unicode_strtol ( const sal_Unicode* p, const sal_Unicode** pEnd ) { -tools::Long accum = 0, prev = 0; +sal_Int64 accum = 0, prev = 0; bool is_neg = false; if( *p == '-' ) @@ -655,12 +655,13 @@ const sal_Unicode* ScRange::Parse_XL_Header( return p; } -static const sal_Unicode* lcl_r1c1_get_col( const sal_Unicode* p, +static const sal_Unicode* lcl_r1c1_get_col( const ScSheetLimits& rSheetLimits, +const sal_Unicode* p, const ScAddress::Details& rDetails, ScAddress* pAddr, ScRefFlags* nFlags ) { const sal_Unicode *pEnd; -tools::Long n; +sal_Int64 n; bool isRelative; if( p[0] == '\0' ) @@ -693,7 +694,7 @@ static const sal_Unicode* lcl_r1c1_get_col( const sal_Unicode* p, n--; } -if( n < 0 || n >= MAXCOLCOUNT ) +if( n < 0 || n >= rSheetLimits.GetMaxColCount()) return nullptr; pAddr->SetCol( static_cast( n ) ); *nFlags |= ScRefFlags::COL_VALID; @@ -708,7 +709,6 @@ static const sal_Unicode* lcl_r1c1_get_row( ScAddress* pAddr, ScRefFlags* nFlags ) { const sal_Unicode *pEnd; -tools::Long n; bool isRelative; if( p[0] == '\0' ) @@ -718,7 +718,7 @@ static const sal_Unicode* lcl_r1c1_get_row( isRelative = *p == '['; if( isRelative ) p++; -n = sal_Unicode_strtol( p, ); +sal_Int64 n = sal_Unicode_strtol( p, ); if( nullptr == pEnd ) return nullptr; @@ -821,7 +821,7 @@ static ScRefFlags lcl_ScRange_Parse_XL_R1C1( ScRange& r, return bOnlyAcceptSingle ? ScRefFlags::ZERO : nFlags; } -else if( nullptr == (p = lcl_r1c1_get_col( p, rDetails, , ))) +else if( nullptr == (p = lcl_r1c1_get_col( rDoc.GetSheetLimits(), p, rDetails, , ))) { return ScRefFlags::ZERO; } @@ -830,7 +830,7 @@ static ScRefFlags lcl_ScRange_Parse_XL_R1C1( ScRange& r, (p[1] != 'R' && p[1] != 'r') || nullptr == (pTmp = lcl_r1c1_get_row( rDoc.GetSheetLimits(), p+1, rDetails, , )) || (*pTmp != 'C' && *pTmp != 'c') || -nullptr == (pTmp = lcl_r1c1_get_col( pTmp, rDetails, , ))) +nullptr == (pTmp = lcl_r1c1_get_col( rDoc.GetSheetLimits(), pTmp, rDetails, , ))) { // single cell reference @@ -861,11 +861,11 @@ static ScRefFlags lcl_ScRange_Parse_XL_R1C1( ScRange& r, } else if( *p == 'C' || *p == 'c' ) // full col C# { -if( nullptr == (p = lcl_r1c1_get_col(
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/extras/macros-test.cxx | 40 +++ sc/qa/extras/testdocuments/tdf104902.ods |binary sc/source/ui/view/viewfunc.cxx | 17 - 3 files changed, 56 insertions(+), 1 deletion(-) New commits: commit 44d237c375b7ef9a5a61a2f752bd19b57649ffbd Author: Andreas Heinisch AuthorDate: Thu Dec 30 19:57:10 2021 +0100 Commit: Andreas Heinisch CommitDate: Tue Feb 15 07:46:03 2022 +0100 tdf#104902 - Handle embedded newline in Calc's .uno:EnterString Change-Id: I6377aebb06b6e6873ce61984a887d9e16eecd361 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127766 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index 802f44a0541c..6c41b269111e 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -44,6 +44,7 @@ public: void testPasswordProtectedStarBasic(); void testTdf114427(); void testRowColumn(); +void testTdf104902(); void testTdf142033(); void testPasswordProtectedUnicodeString(); void testPasswordProtectedArrayInUserType(); @@ -70,6 +71,7 @@ public: CPPUNIT_TEST(testPasswordProtectedStarBasic); CPPUNIT_TEST(testTdf114427); CPPUNIT_TEST(testRowColumn); +CPPUNIT_TEST(testTdf104902); CPPUNIT_TEST(testTdf142033); CPPUNIT_TEST(testPasswordProtectedUnicodeString); CPPUNIT_TEST(testPasswordProtectedArrayInUserType); @@ -322,6 +324,44 @@ void ScMacrosTest::testMacroButtonFormControlXlsxExport() assertXPath(pWorkbookDoc, "//x:workbook/definedNames", 0); } +void ScMacrosTest::testTdf104902() +{ +OUString aFileName; +createFileURL(u"tdf104902.ods", aFileName); +uno::Reference xComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument"); + +Any aRet; +Sequence aOutParamIndex; +Sequence aOutParam; +Sequence aParams; + +SfxObjectShell::CallXScript( +xComponent, + "vnd.sun.Star.script:Standard.Module1.display_bug?language=Basic=document", +aParams, aRet, aOutParamIndex, aOutParam); + +// Export to ODS +saveAndReload(xComponent, "calc8"); +CPPUNIT_ASSERT(xComponent); + +SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); + +CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); +ScDocShell* pDocSh = static_cast(pFoundShell); +ScDocument& rDoc = pDocSh->GetDocument(); + +CPPUNIT_ASSERT_EQUAL(OUString("string no newlines"), rDoc.GetString(ScAddress(0, 0, 0))); + +// Without the fix in place, this test would have failed with +// - Expected: string with +// newlines +// - Actual : string withnewlines +CPPUNIT_ASSERT_EQUAL(OUString(u"string with" + OUStringChar(u'\xA') + u"newlines"), rDoc.GetString(ScAddress(0, 1, 0))); + +css::uno::Reference xCloseable(xComponent, css::uno::UNO_QUERY_THROW); +xCloseable->close(true); +} + void ScMacrosTest::testTdf142033() { OUString aFileName; diff --git a/sc/qa/extras/testdocuments/tdf104902.ods b/sc/qa/extras/testdocuments/tdf104902.ods new file mode 100644 index ..8524522fdcd3 Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf104902.ods differ diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 26aa7907779a..a1a5083205b8 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -75,6 +75,7 @@ #include #include #include +#include #include @@ -575,10 +576,24 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, } else { +ScFieldEditEngine& rEngine = rDoc.GetEditEngine(); for (const auto& rTab : rMark) { bool bNumFmtSet = false; -rFunc.SetNormalString( bNumFmtSet, ScAddress( nCol, nRow, rTab ), rString, false ); +const ScAddress aScAddress(nCol, nRow, rTab); + +// tdf#104902 - handle embedded newline +if (ScStringUtil::isMultiline(rString)) +{ +rEngine.SetTextCurrentDefaults(rString); +rDoc.SetEditText(aScAddress, rEngine.CreateTextObject()); +pDocSh->AdjustRowHeight(nRow, nRow, rTab); +} +else +{ +rFunc.SetNormalString(bNumFmtSet, aScAddress, rString, false); +} + if (bNumFmtSet) { /* FIXME: if set on any sheet results in changed only on
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/value-in-column-2000.ods |binary sc/qa/unit/data/xlsx/value-in-column-2000.xlsx |binary sc/qa/unit/jumbosheets-test.cxx| 47 + sc/source/filter/excel/xetable.cxx |2 - 4 files changed, 48 insertions(+), 1 deletion(-) New commits: commit ff8e1199b338df5f28b200d417947c96fc919b12 Author: Luboš Luňák AuthorDate: Fri Feb 11 16:38:58 2022 +0100 Commit: Luboš Luňák CommitDate: Fri Feb 11 18:34:06 2022 +0100 basic import/export test for ods/xlsx with a value in column 2000 Which is above the "normal" 1024 column limit. This tests my recent commits. Change-Id: I8ec3fcdbfef879ca0eeec4cfa3fa067378f6f57f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129823 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/qa/unit/data/ods/value-in-column-2000.ods b/sc/qa/unit/data/ods/value-in-column-2000.ods new file mode 100644 index ..2dd898c2dffc Binary files /dev/null and b/sc/qa/unit/data/ods/value-in-column-2000.ods differ diff --git a/sc/qa/unit/data/xlsx/value-in-column-2000.xlsx b/sc/qa/unit/data/xlsx/value-in-column-2000.xlsx new file mode 100644 index ..08f58be655c7 Binary files /dev/null and b/sc/qa/unit/data/xlsx/value-in-column-2000.xlsx differ diff --git a/sc/qa/unit/jumbosheets-test.cxx b/sc/qa/unit/jumbosheets-test.cxx index 9432f90192d8..27a0b396b996 100644 --- a/sc/qa/unit/jumbosheets-test.cxx +++ b/sc/qa/unit/jumbosheets-test.cxx @@ -41,17 +41,22 @@ public: virtual void setUp() override; virtual void tearDown() override; +void testRoundtripColumn2000Ods(); +void testRoundtripColumn2000Xlsx(); void testTdf134392(); void testTdf133033(); CPPUNIT_TEST_SUITE(ScJumboSheetSTest); +CPPUNIT_TEST(testRoundtripColumn2000Ods); +CPPUNIT_TEST(testRoundtripColumn2000Xlsx); CPPUNIT_TEST(testTdf134392); CPPUNIT_TEST(testTdf133033); CPPUNIT_TEST_SUITE_END(); private: +void testRoundtripColumn2000(std::u16string_view name, int format); uno::Reference m_xCalcComponent; }; @@ -68,6 +73,48 @@ bool ScJumboSheetSTest::load(const OUString& rFilter, const OUString& rURL, return bLoaded; } +void ScJumboSheetSTest::testRoundtripColumn2000Ods() +{ +testRoundtripColumn2000(u"value-in-column-2000.", FORMAT_ODS); +} + +void ScJumboSheetSTest::testRoundtripColumn2000Xlsx() +{ +testRoundtripColumn2000(u"value-in-column-2000.", FORMAT_XLSX); +} + +void ScJumboSheetSTest::testRoundtripColumn2000(std::u16string_view name, int format) +{ +ScDocShellRef xDocSh1 = loadDoc(name, format); +CPPUNIT_ASSERT(xDocSh1.is()); + +{ +ScDocument& rDoc = xDocSh1->GetDocument(); +// Check the value at BXX1 (2000th column). +CPPUNIT_ASSERT_EQUAL(-5.0, rDoc.GetValue(1999, 0, 0)); +// Check the formula referencing the value. +CPPUNIT_ASSERT_EQUAL(OUString("=BXX1"), rDoc.GetFormula(0, 0, 0)); +// Recalc and check value in the reference. +rDoc.CalcAll(); +CPPUNIT_ASSERT_EQUAL(-5.0, rDoc.GetValue(0, 0, 0)); +} + +ScDocShellRef xDocSh2 = saveAndReload(&(*xDocSh1), format); +CPPUNIT_ASSERT(xDocSh2.is()); + +{ +// Check again. +ScDocument& rDoc = xDocSh2->GetDocument(); +CPPUNIT_ASSERT_EQUAL(-5.0, rDoc.GetValue(1999, 0, 0)); +CPPUNIT_ASSERT_EQUAL(OUString("=BXX1"), rDoc.GetFormula(0, 0, 0)); +rDoc.CalcAll(); +CPPUNIT_ASSERT_EQUAL(-5.0, rDoc.GetValue(0, 0, 0)); +} + +xDocSh1->DoClose(); +xDocSh2->DoClose(); +} + void ScJumboSheetSTest::testTdf134392() { // Without the fix in place, the file would have crashed diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index bc64867a9f8a..140c973a30b5 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -1245,7 +1245,7 @@ void XclExpMultiCellBase::AppendXFId( const XclExpMultiXFId& rXFId ) if( maXFIds.empty() || (maXFIds.back().mnXFId != rXFId.mnXFId) ) maXFIds.push_back( rXFId ); else -maXFIds.back().mnCount = maXFIds.back().mnCount + rXFId.mnCount; +maXFIds.back().mnCount += rXFId.mnCount; } void XclExpMultiCellBase::AppendXFId( const XclExpRoot& rRoot,
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/calc_tests6/tdf107267.py | 46 +++--- sc/qa/uitest/calc_tests6/tdf118638.py |4 +- sc/qa/uitest/sort/subtotals.py| 14 +- sc/source/ui/dbgui/tpsubt.cxx | 12 +--- sc/source/ui/inc/tpsubt.hxx |2 - 5 files changed, 34 insertions(+), 44 deletions(-) New commits: commit 5505b0d7c3e5924c2614b03789307e4c26cb6f24 Author: Xisco Fauli AuthorDate: Thu Feb 10 17:51:55 2022 +0100 Commit: Xisco Fauli CommitDate: Fri Feb 11 11:21:27 2022 +0100 uitest: sc: add a buidable name to the tabs in DataSubTotals dialog Change-Id: I045f301083767fa32fd516a4a46823b3af4a6a2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129794 Tested-by: Jenkins Tested-by: Xisco Fauli Reviewed-by: Caolán McNamara Reviewed-by: Xisco Fauli diff --git a/sc/qa/uitest/calc_tests6/tdf107267.py b/sc/qa/uitest/calc_tests6/tdf107267.py index 2ee73577aa25..8ff9a19baa38 100644 --- a/sc/qa/uitest/calc_tests6/tdf107267.py +++ b/sc/qa/uitest/calc_tests6/tdf107267.py @@ -11,8 +11,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.framework import UITestCase from libreoffice.calc.document import get_cell_by_position from uitest.uihelper.common import select_pos -from uitest.uihelper.common import select_by_text -from uitest.uihelper.common import get_url_for_data_file +from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict #Bug 107267 - During a sub-total calculation or sum, the data set is not computed well. class Subtotals(UITestCase): @@ -27,40 +26,27 @@ class Subtotals(UITestCase): # 2. Data->Subtotals with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog: xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") -# = 1st group = 3. Group by "Person Number", select "shipping time" and use the Max function. -xGroupBy = xDialog.getChild("group_by") -select_by_text(xGroupBy, "Person Number") -# 4. Tick 'Calculate subtotals for' -> "shipping time" - already selected -#xCheckListMenu = xDialog.getChild("grid1") -#xTreeList = xCheckListMenu.getChild("columns") -#x6Entry = xTreeList.getChild("5") -#xFirstEntry.executeAction("CLICK", tuple()) -#use the Max function +xGroupBy1 = xDialog.getChild("group_by1") +self.assertEqual("Person Number", get_state_as_dict(xGroupBy1)["SelectEntryText"]) + +xColumns1 = xDialog.getChild("columns1") +self.assertEqual("shipping time", get_state_as_dict(xColumns1)["SelectEntryText"]) -#= 2nd group =5. Group by "Person Number", select "shipping time" and use the Min function. select_pos(xTabs, "1") -xGroupBy = xDialog.getChild("group_by") -select_by_text(xGroupBy, "Person Number") -# 4. Tick 'Calculate subtotals for' -> "shipping time" - already selected -#xCheckListMenu = xDialog.getChild("grid1") -#xTreeList = xCheckListMenu.getChild("columns") -#x6Entry = xTreeList.getChild("5") -#xFirstEntry.executeAction("CLICK", tuple()) -#use the Min function +xGroupBy2 = xDialog.getChild("group_by2") +self.assertEqual("Person Number", get_state_as_dict(xGroupBy2)["SelectEntryText"]) + +xColumns2 = xDialog.getChild("columns2") +self.assertEqual("shipping time", get_state_as_dict(xColumns2)["SelectEntryText"]) -#= 3rd group = Group by "Person Number", select "shipping time" and use the Average function. select_pos(xTabs, "2") -xGroupBy = xDialog.getChild("group_by") -select_by_text(xGroupBy, "Person Number") -# 4. Tick 'Calculate subtotals for' -> "shipping time" - already selected -#xCheckListMenu = xDialog.getChild("grid1") -#xTreeList = xCheckListMenu.getChild("columns") -#x6Entry = xTreeList.getChild("5") -#xFirstEntry.executeAction("CLICK", tuple()) -#use the Average function +xGroupBy3 = xDialog.getChild("group_by3") +self.assertEqual("Person Number", get_state_as_dict(xGroupBy3)["SelectEntryText"]) -# 5. Click OK +xColumns3 = xDialog.getChild("columns3") +self.assertEqual("shipping time", get_state_as_dict(xColumns3)["SelectEntryText"]) #verify self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 141).getString(), "Grand Average") diff --git a/sc/qa/uitest/calc_tests6/tdf118638.py b/sc/qa/uitest/calc_tests6/tdf118638.py index
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/functions/text/fods/clean.fods | 1085 ++--- sc/source/core/tool/interpr1.cxx | 19 2 files changed, 833 insertions(+), 271 deletions(-) New commits: commit 61f4250ee9f43902107e4d2e6322cbf54f52dd8e Author: Winfried Donkers AuthorDate: Mon Jan 31 14:04:17 2022 +0100 Commit: Mike Kaganski CommitDate: Thu Feb 10 18:39:32 2022 +0100 Make CLEAN fully compliant woth ODFF v1.3 Not only check for characters of category Cc, but also for characters of category Cn. Use generic functions to check is characters belong to one of the above categories. Follow up of commit e38ebf0737297fe94e3128459fc25ef9259faa6b. Change-Id: I97618dbf33db70b01b2833cf653988610b499333 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129222 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/sc/qa/unit/data/functions/text/fods/clean.fods b/sc/qa/unit/data/functions/text/fods/clean.fods index 0230953d00e5..c5531ad364d5 100644 --- a/sc/qa/unit/data/functions/text/fods/clean.fods +++ b/sc/qa/unit/data/functions/text/fods/clean.fods @@ -344,8 +344,8 @@ - + € € - @@ -2132,7 +2132,7 @@ =CLEAN(J36) - Unicode Cn + Unicode Cc @@ -2168,7 +2168,7 @@ =CLEAN(J37) - Unicode Cn + Unicode Cc @@ -2177,11 +2177,11 @@ 128 - - + + € - - Test text + + €Test text€ Tdf#97706 @@ -2204,7 +2204,7 @@ =CLEAN(J38) - Unicode Cn + Unicode Cc @@ -2213,11 +2213,11 @@ 129 - - + +  - - Test text + + ÂTest text Tdf#97706 @@ -2240,7 +2240,7 @@ =CLEAN(J39) - Unicode Cn + Unicode Cc @@ -2249,11 +2249,11 @@ 130 - - + + ‚ - - Test text + + ‚Test text‚ Tdf#97706 @@ -2276,7 +2276,7 @@ =CLEAN(J40) - Unicode Cn + Unicode Cc @@ -2285,11 +2285,11 @@ 131 - - + + ƒ - - Test text + + ƒTest textƒ Tdf#97706 @@ -2308,24 +2308,24 @@ TRUE - + =CLEAN(J41) Unicode Cn - - 84 + + FFFE - - 132 + + 65534 - - + + - - Test text + + Test text Tdf#97706 @@ -2344,24 +2344,24 @@ TRUE - + =CLEAN(J42) Unicode Cn - - 85 + + - - 133 + + 65535 - - + + - - Test text + + Test text Tdf#97706 @@ -2380,24 +2380,24 @@ TRUE - + =CLEAN(J43) Unicode Cn - - 86 + + 1FFFE - - 134 + + 131070 - - + + 🿾 - - Test text + + 🿾Test text🿾 Tdf#97706 @@ -2407,33 +2407,33 @@ - - Test text + + ïš“Test textïš“ - - Test text + + ïš“Test textïš“ TRUE - + =CLEAN(J44) - Unicode Cn + no clean - - 87 + + F693 - - 135 + + 63123 - - + + ïš“ - - Test text + + ïš“Test textïš“ Tdf#97706 @@ -2443,33 +2443,33 @@ - - Test text + + Test text - - Test text + + Test text TRUE - + =CLEAN(J45) - Unicode Cn + no clean - - 88 + + 1F43C - - 136 + + 128060 - - + + - - Test text + + Test text Tdf#97706 @@ -2479,33 +2479,33 @@ - - Test text + + �Test text� - - Test text + + �Test text� TRUE - + =CLEAN(J46) - Unicode Cn + no clean - - 89 + + FFFD - - 137 + + 65533 - - + + � - - Test text + + �Test text� Tdf#97706 @@ -2515,33
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/calc_tests/autofill.py | 30 ++ sc/qa/uitest/data/autofill.ods |binary sc/source/core/data/table2.cxx |7 +-- 3 files changed, 35 insertions(+), 2 deletions(-) New commits: commit bda200a5e9c4592bd61b7924fa171ec3265bfd24 Author: Justin Luth AuthorDate: Wed Feb 9 20:17:53 2022 +0200 Commit: Justin Luth CommitDate: Thu Feb 10 10:04:18 2022 +0100 tdf#113785 sc: IsDataFiltered must be normalized I can't believe this hasn't caused major issues and has survived as a bug for so long. Due to the way IsDataFiltered is coded, it is required that the range is normalized in order to get any kind of meaningful result, so lets ensure that. Change-Id: I2ede77f738fbaeb05a0f1425a2e88e59fca08e9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129735 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/qa/uitest/calc_tests/autofill.py b/sc/qa/uitest/calc_tests/autofill.py index bdb45d00c9c9..294d60fd7102 100644 --- a/sc/qa/uitest/calc_tests/autofill.py +++ b/sc/qa/uitest/calc_tests/autofill.py @@ -49,6 +49,36 @@ class CalcAutofill(UITestCase): self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getValue(), 17.34) self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 11).getValue(), 18.34) +#Test that hidden cells are not affected / skipped in the increment process. +#Simulate selecting cell A26 and dragging the fill handle in the bottom right corner of the cell down to A32 +gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A26:A32"})) +with self.ui_test.execute_dialog_through_command(".uno:FillSeries"): +pass +self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 25).getValue(), 18.34) +self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 26).getValue(), 19.34) +self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 27).getValue(), 5.0) #hidden +self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 28).getValue(), 5.0) #hidden +self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 29).getString(), "hiddenA30") +self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 30).getValue(), 20.34) #overwrite "rows" +self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 31).getValue(), 21.34) +#Simulate selecting cell A26 and dragging the fill handle in the bottom right corner of the cell up to A19 +# Note: start at empty cell A19 so Sheet - Fill Cells - Fill Series has good defaults +gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A19:A26"})) +with self.ui_test.execute_dialog_through_command(".uno:FillSeries") as xDialog: +xup = xDialog.getChild("up") +xincrement = xDialog.getChild("increment") +xup.executeAction("CLICK", tuple()) +xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) +xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) +xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"})) +self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 19).getString(), "hiddenA20") +self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 20).getValue(), 15.34) +self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 21).getValue(), 5.0) #hidden +self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 22).getValue(), 16.34) #overwrite "testing" +self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 23).getValue(), 5.0) #hidden +self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 24).getValue(), 17.34) #overwrite "hidden" +self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 25).getValue(), 18.34) + #Continue with the next cells with grey background gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "M12:M18"})) with self.ui_test.execute_dialog_through_command(".uno:FillSeries"): diff --git a/sc/qa/uitest/data/autofill.ods b/sc/qa/uitest/data/autofill.ods index 4456e8c8..90bf933c0c26 100644 Binary files a/sc/qa/uitest/data/autofill.ods and b/sc/qa/uitest/data/autofill.ods differ diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index fa322f333821..a19549e89f9d 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -3666,6 +3666,8 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow) bool ScTable::IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, SCROW nRowEnd) const { +assert(nColStart <= nColEnd && nRowStart <= nRowEnd + && "range must be normalized to obtain a valid result"); for (SCROW i = nRowStart; i <= nRowEnd; ++i) {
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/functions/text/fods/clean.fods | 3438 ++--- sc/source/core/tool/interpr1.cxx |3 2 files changed, 2532 insertions(+), 909 deletions(-) New commits: commit 34412339f863b35508842a3bf20fcc7341a006e7 Author: Winfried Donkers AuthorDate: Wed Jan 12 17:00:34 2022 +0100 Commit: Eike Rathke CommitDate: Mon Jan 24 23:42:05 2022 +0100 tdf#97706 CLEAN is neither ODFF nor OOXML conform. Patch makes CLEAN 100% compliant with ODFF v1.3 and almost 100% compliant with actual Excel results (just character 0x7F differs). co-author: taylorlee...@gmail.com Change-Id: Icc070ca2560b7ca7640128c5a538d1fbfa1193e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128350 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/qa/unit/data/functions/text/fods/clean.fods b/sc/qa/unit/data/functions/text/fods/clean.fods index 58345a7f8ead..0230953d00e5 100644 --- a/sc/qa/unit/data/functions/text/fods/clean.fods +++ b/sc/qa/unit/data/functions/text/fods/clean.fods @@ -1,438 +1,440 @@ -http://www.w3.org/1999/xlink; xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:scr ipt="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:ooow="http://openoffice.org/2004/writer; xmlns:oooc="http://openoffice.org/2004/calc; xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:rpt="http://openoffice.org/2005/report; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns:tableooo="http://openoffice.org/2009/table; xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:form x="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.spreadsheet"> +http://www.w3.org/TR/css3-text/; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:oooc="http://openoffice.org/2004/calc; xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:ooow="http://openoffice.org/2004/writer; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:rpt="http://openoffice.org/2005/report; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:config="urn:oasis:nam es:tc:opendocument:xmlns:config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:tableooo="http://openoffice.org/2009/table; xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:fo rm:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:xforms="http://www.w3.org/2002/xforms; office:version="1.3"
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf145059.ods |binary sc/qa/unit/subsequent_export_test2.cxx | 31 +++ sc/source/filter/excel/excrecds.cxx|4 sc/source/filter/excel/xestyle.cxx | 16 sc/source/filter/inc/xestyle.hxx |5 +++-- 5 files changed, 50 insertions(+), 6 deletions(-) New commits: commit f0ad6ec2a23a36ade407db8cda36655ba2f144c1 Author: Vasily Melenchuk AuthorDate: Thu Dec 30 15:32:37 2021 +0300 Commit: Thorsten Behrens CommitDate: Thu Jan 6 21:25:18 2022 +0100 tdf#145059: sc: always write dxf node for color filter for XLSX If there is no dxf reference to color filter (for example if selected color is not in range of available colors for current range) Excel is not able to show color filter correctly: it is not marked as used filter, no ability to reset, etc. Change-Id: I65378ddd6f8f8233cda147ff9dcd28f455a58225 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127745 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/sc/qa/unit/data/ods/tdf145059.ods b/sc/qa/unit/data/ods/tdf145059.ods new file mode 100644 index ..a76da3b5cb4e Binary files /dev/null and b/sc/qa/unit/data/ods/tdf145059.ods differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 59fa0bf21d9b..3aef467687d2 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -216,6 +216,7 @@ public: void testTdf142264ManyChartsToXLSX(); void testTdf143929MultiColumnToODS(); void testTdf142578(); +void testTdf145059(); void testTdf130104_XLSXIndent(); CPPUNIT_TEST_SUITE(ScExportTest2); @@ -331,6 +332,7 @@ public: CPPUNIT_TEST(testTdf142264ManyChartsToXLSX); CPPUNIT_TEST(testTdf143929MultiColumnToODS); CPPUNIT_TEST(testTdf142578); +CPPUNIT_TEST(testTdf145059); CPPUNIT_TEST(testTdf130104_XLSXIndent); CPPUNIT_TEST_SUITE_END(); @@ -3054,6 +3056,35 @@ void ScExportTest2::testTdf142578() xDocSh->DoClose(); } +void ScExportTest2::testTdf145059() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf145059.", FORMAT_ODS); +CPPUNIT_ASSERT(xDocSh); + +// Export to xlsx. +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocUniquePtr pSheet += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pSheet); +xmlDocUniquePtr pStyle = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/styles.xml"); +CPPUNIT_ASSERT(pStyle); + +sal_Int32 nColorFilterDxdId += getXPath(pSheet, "/x:worksheet/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId") + .toInt32(); + +// Ensure that dxf id is not -1 +CPPUNIT_ASSERT(nColorFilterDxdId >= 0); + +// Find color by this dxfid +OString sDxfIdPath = "/x:styleSheet/x:dxfs/x:dxf[" + OString::number(nColorFilterDxdId + 1) + + "]/x:fill/x:patternFill/x:fgColor"; +assertXPath(pStyle, sDxfIdPath, "rgb", "FF4472C4"); + +xDocSh->DoClose(); +} + void ScExportTest2::testTdf130104_XLSXIndent() { ScDocShellRef xDocSh = loadDoc(u"tdf130104_indent.", FORMAT_XLSX); diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 65edd87ee5bc..570167b8014b 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -796,6 +796,10 @@ void XclExpAutofilter::AddColorEntry(const ScQueryEntry& rEntry) { maColorValues.push_back( std::make_pair(rItem.maColor, rItem.meType == ScQueryEntry::ByBackgroundColor)); +// Ensure that selected color(s) will be added to dxf: selection can be not in list +// of already added to dfx colors taken from filter range +if (GetDxfs().GetDxfByColor(rItem.maColor) == -1) +GetDxfs().AddColor(rItem.maColor); } } diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 3898c5cad9b6..291b51c6c83e 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -3176,22 +3176,30 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot ) } } -sal_Int32 XclExpDxfs::GetDxfId( const OUString& rStyleName ) +sal_Int32 XclExpDxfs::GetDxfId( const OUString& rStyleName ) const { -std::map::iterator itr = maStyleNameToDxfId.find(rStyleName); +std::map::const_iterator itr = maStyleNameToDxfId.find(rStyleName); if(itr!= maStyleNameToDxfId.end()) return itr->second; return -1; } -sal_Int32 XclExpDxfs::GetDxfByColor(Color aColor) +sal_Int32 XclExpDxfs::GetDxfByColor(Color aColor) const { -std::map::iterator itr = maColorToDxfId.find(aColor); +std::map::const_iterator itr = maColorToDxfId.find(aColor); if (itr != maColorToDxfId.end()) return itr->second; return -1; } +void
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/conditional_format/tdf124412.py | 36 + sc/qa/uitest/data/tdf124412.ods|binary sc/source/ui/condformat/condformatdlgentry.cxx |6 +++- 3 files changed, 41 insertions(+), 1 deletion(-) New commits: commit d3f0aa90ce30c2566f0c7ad775c4355b939f338c Author: Xisco Fauli AuthorDate: Tue Dec 14 17:56:06 2021 +0100 Commit: Xisco Fauli CommitDate: Tue Dec 14 19:04:04 2021 +0100 tdf#124412: sc: Add UItest Change-Id: Ic0b8a6f8a8ccc3d63154be607e672e759b862714 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126841 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sc/qa/uitest/conditional_format/tdf124412.py b/sc/qa/uitest/conditional_format/tdf124412.py new file mode 100644 index ..aac0d2a9b3a7 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf124412.py @@ -0,0 +1,36 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf124412(UITestCase): + +def test_tdf124412(self): + +with self.ui_test.load_file(get_url_for_data_file("tdf124412.ods")) as calc_doc: + +xTopWindow = self.xUITest.getTopFocusWindow() +gridwin = xTopWindow.getChild("grid_window") + +gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A13"})) + +with self.ui_test.execute_modeless_dialog_through_command(".uno:ConditionalFormatDialog") as xCondFormatDlg: +xCondition1 = xCondFormatDlg.getChild("Condition 1") +xCondition2 = xCondFormatDlg.getChild("Condition 2") + +# This is empty because the entry is selected +self.assertEqual("", get_state_as_dict(xCondition1)["DisplayText"]) + +# Without the fix in place, this test would have failed with +# AssertionError: 'Date is last month' != 'Date is today' +self.assertEqual("Date is last month", get_state_as_dict(xCondition2)["DisplayText"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/tdf124412.ods b/sc/qa/uitest/data/tdf124412.ods new file mode 100644 index ..4693e0a68105 Binary files /dev/null and b/sc/qa/uitest/data/tdf124412.ods differ diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 9fde12a53cda..d67ee8e36f57 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -77,7 +77,11 @@ IMPL_LINK_NOARG(ScCondFrmtEntry, EntrySelectHdl, const MouseEvent&, bool) void ScCondFrmtEntry::SetIndex(sal_Int32 nIndex) { -mxFtCondNr->set_label(maStrCondition + OUString::number(nIndex)); +OUString sLabel = maStrCondition + OUString::number(nIndex); +mxFtCondNr->set_label(sLabel); + +// tdf#124412: uitest +mxFtCondition->set_buildable_name(sLabel.toUtf8()); } void ScCondFrmtEntry::Select()
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods |binary sc/qa/unit/subsequent_export_test.cxx | 18 ++ sc/source/filter/xml/xmlcoli.cxx |1 + 3 files changed, 19 insertions(+) New commits: commit 297ab561c6754f89326a1e8ce1751233669578d7 Author: Justin Luth AuthorDate: Wed Dec 8 14:22:01 2021 +0200 Commit: Justin Luth CommitDate: Sat Dec 11 07:20:35 2021 +0100 tdf#128895 sc xmlimport: create enough dynamic cols if props Since LO 6.3, only 64 columns are created by default, where previously it was a fixed 1024. A common user practice is to hide all columns not used, but this collapsed property was lost because only part of the columns were actually created and thus exported. In this example, import specifies 1017 hidden columns (H-AMJ), but since only 64 columns are created, export only specified 57. So ensure that on import, any column with defined properties is created - even if they don't contain any content. Change-Id: If928880baf5585613715a1f4361a9059584d1ad2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126540 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Bartosz Kosiorek diff --git a/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods b/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods new file mode 100644 index ..fa016369f206 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods differ diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index 355fdf4202ad..158323215660 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -143,6 +143,7 @@ public: #endif void testOutlineExportXLSX(); void testHiddenEmptyRowsXLSX(); +void testHiddenEmptyColsODS(); void testAllRowsHiddenXLSX(); void testLandscapeOrientationXLSX(); @@ -259,6 +260,7 @@ public: #endif CPPUNIT_TEST(testOutlineExportXLSX); CPPUNIT_TEST(testHiddenEmptyRowsXLSX); +CPPUNIT_TEST(testHiddenEmptyColsODS); CPPUNIT_TEST(testAllRowsHiddenXLSX); CPPUNIT_TEST(testLandscapeOrientationXLSX); CPPUNIT_TEST(testInlineArrayXLS); @@ -1525,6 +1527,22 @@ void ScExportTest::testHiddenEmptyRowsXLSX() xShell->DoClose(); } +void ScExportTest::testHiddenEmptyColsODS() +{ +//tdf#98106 FILESAVE: Hidden and empty rows became visible when export to .XLSX +ScDocShellRef xShell = loadDoc(u"tdf128895_emptyHiddenCols.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS); +xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); +CPPUNIT_ASSERT(pSheet); +assertXPath(pSheet, "//table:table/table:table-column[2]"); +assertXPath(pSheet, "//table:table/table:table-column[2]", "number-columns-repeated", "1017"); + +xShell->DoClose(); +} + void ScExportTest::testLandscapeOrientationXLSX() { //tdf#48767 - Landscape page orientation is not loaded from .xlsx format with MS Excel, after export with Libre Office diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx index 09224bb757a3..fc40a6f63c6b 100644 --- a/sc/source/filter/xml/xmlcoli.cxx +++ b/sc/source/filter/xml/xmlcoli.cxx @@ -93,6 +93,7 @@ void SAL_CALL ScXMLTableColContext::endFastElement( sal_Int32 /*nElement*/ ) nLastColumn = pDoc->MaxCol(); if (nCurrentColumn > pDoc->MaxCol()) nCurrentColumn = pDoc->MaxCol(); +pDoc->CreateColumnIfNotExists(nSheet, nLastColumn); uno::Reference xColumnRowRange (xSheet->getCellRangeByPosition(nCurrentColumn, 0, nLastColumn, 0), uno::UNO_QUERY); if (xColumnRowRange.is()) {
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/functions/database/fods/dcount.fods | 21 +++ sc/qa/unit/data/functions/database/fods/dcounta.fods | 21 +++ sc/source/core/data/funcdesc.cxx |4 +-- 3 files changed, 36 insertions(+), 10 deletions(-) New commits: commit 885465bc0ae6029d8adad57015fb0ff6c26a6ba6 Author: Winfried Donkers AuthorDate: Thu Dec 9 17:39:58 2021 +0100 Commit: Eike Rathke CommitDate: Fri Dec 10 01:18:43 2021 +0100 tdf#133353, Make 2nd argument optional for DCOUNT and DCOUNTA. The functions accept empty second arguments, but the function wizard and hints stated that it was required. Change-Id: I74fcfcc31492ed776085d1bc6ee6a9ff22a87818 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126620 Tested-by: Eike Rathke Reviewed-by: Eike Rathke diff --git a/sc/qa/unit/data/functions/database/fods/dcount.fods b/sc/qa/unit/data/functions/database/fods/dcount.fods index 392bc86d017d..4e2b792e08f2 100644 --- a/sc/qa/unit/data/functions/database/fods/dcount.fods +++ b/sc/qa/unit/data/functions/database/fods/dcount.fods @@ -2183,9 +2183,22 @@ - - - + + 2 + + + 2 + + + TRUE + + + =DCOUNT(J1:N11,,J41:N42) + + + Tdf#13353 + + =I @@ -2940,4 +2953,4 @@ - \ No newline at end of file + diff --git a/sc/qa/unit/data/functions/database/fods/dcounta.fods b/sc/qa/unit/data/functions/database/fods/dcounta.fods index 1080e2cf64a5..c95c1472d713 100644 --- a/sc/qa/unit/data/functions/database/fods/dcounta.fods +++ b/sc/qa/unit/data/functions/database/fods/dcounta.fods @@ -864,9 +864,22 @@ - - - + + 2 + + + 2 + + + TRUE + + + =DCOUNTA(J1:N10,,J41:N42) + + + Tdf#13353 + + Greta @@ -1491,4 +1504,4 @@ - \ No newline at end of file + diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx index 51f03a4e4bf4..01d8143a16f8 100644 --- a/sc/source/core/data/funcdesc.cxx +++ b/sc/source/core/data/funcdesc.cxx @@ -576,8 +576,8 @@ ScFunctionList::ScFunctionList() { SC_OPCODE_NOMINAL, ENTRY(SC_OPCODE_NOMINAL_ARY), 0, ID_FUNCTION_GRP_FINANCIAL, HID_FUNC_NOMINAL, 2, { 0, 0 }, 0 }, { SC_OPCODE_SUB_TOTAL, ENTRY(SC_OPCODE_SUB_TOTAL_ARY), 0, ID_FUNCTION_GRP_MATH, HID_FUNC_TEILERGEBNIS, 2, { 0, 0 }, 0 }, { SC_OPCODE_DB_SUM, ENTRY(SC_OPCODE_DB_SUM_ARY), 0, ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBSUMME, 3, { 0, 0, 0 }, 0 }, -{ SC_OPCODE_DB_COUNT, ENTRY(SC_OPCODE_DB_COUNT_ARY), 0, ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBANZAHL, 3, { 0, 0, 0 }, 0 }, -{ SC_OPCODE_DB_COUNT_2, ENTRY(SC_OPCODE_DB_COUNT_2_ARY), 0, ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBANZAHL2, 3, { 0, 0, 0 }, 0 }, +{ SC_OPCODE_DB_COUNT, ENTRY(SC_OPCODE_DB_COUNT_ARY), 0, ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBANZAHL, 3, { 0, 1, 0 }, 0 }, +{ SC_OPCODE_DB_COUNT_2, ENTRY(SC_OPCODE_DB_COUNT_2_ARY), 0, ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBANZAHL2, 3, { 0, 1, 0 }, 0 }, { SC_OPCODE_DB_AVERAGE, ENTRY(SC_OPCODE_DB_AVERAGE_ARY), 0, ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBMITTELWERT, 3, { 0, 0, 0 }, 0 }, { SC_OPCODE_DB_GET, ENTRY(SC_OPCODE_DB_GET_ARY), 0, ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBAUSZUG, 3, { 0, 0, 0 }, 0 }, { SC_OPCODE_DB_MAX, ENTRY(SC_OPCODE_DB_MAX_ARY), 0, ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBMAX, 3, { 0, 0, 0 }, 0 },
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf123139_applyAlignment.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx | 61 + sc/source/filter/oox/stylesbuffer.cxx |4 - 3 files changed, 63 insertions(+), 2 deletions(-) New commits: commit ab99d16e21e56596803b7d9a28af0895b435ef3e Author: Justin Luth AuthorDate: Tue Nov 30 15:15:24 2021 +0200 Commit: Justin Luth CommitDate: Wed Dec 8 18:32:28 2021 +0100 tdf#123139 sc oox: CellXf should default to applyAlignment Since the same logic applied to applyProtection I tested and changed that one too. No documentation was found to support the comment (which was probably taken from binary import) that applyAlignment had a context-dependent default value. Testing on the other hand suggests that applyAlignment is always considered true in the case of CellXf and only matters for CellStyleXf. The unit test tests for this - confirmed on Excel 2003/2016. No existing unit tests where found with an assert(rXf1.maModel.mbAlignUsed || (rXf1.maAlignment.getApiData() == rXf2.maAlignment.getApiData())); Change-Id: I47d8dded93335092c93e75b4c18b798569da77f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126177 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/qa/unit/data/xlsx/tdf123139_applyAlignment.xlsx b/sc/qa/unit/data/xlsx/tdf123139_applyAlignment.xlsx new file mode 100644 index ..e8ffc4861f45 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf123139_applyAlignment.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index a74fff7e04af..1dc763f96631 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -63,6 +63,7 @@ #include #include #include +#include #include #include #include @@ -185,6 +186,7 @@ public: void testTdf121718_UseFirstPageNumberXLSX(); void testHeaderFontStyleXLSX(); void testTdf135828_Shape_Rect(); +void testTdf123139XLSX(); void testTdf123353(); void testTdf140098(); void testTdf133688_precedents(); @@ -298,6 +300,7 @@ public: CPPUNIT_TEST(testTdf121718_UseFirstPageNumberXLSX); CPPUNIT_TEST(testHeaderFontStyleXLSX); CPPUNIT_TEST(testTdf135828_Shape_Rect); +CPPUNIT_TEST(testTdf123139XLSX); CPPUNIT_TEST(testTdf123353); CPPUNIT_TEST(testTdf140098); CPPUNIT_TEST(testTdf133688_precedents); @@ -2169,6 +2172,64 @@ void ScExportTest2::testTdf135828_Shape_Rect() CPPUNIT_ASSERT_DOUBLES_EQUAL(1988280, nHeight, 1); } +void ScExportTest2::testTdf123139XLSX() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf123139_applyAlignment.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is()); + +ScDocument& rDoc = xDocSh->GetDocument(); +const ScPatternAttr* pAttr = rDoc.GetPattern(0, 0, 0); //A1 + +{ +const SvxHorJustifyItem& rJustify = pAttr->GetItem(ATTR_HOR_JUSTIFY); +CPPUNIT_ASSERT_EQUAL(SvxCellHorJustify::Repeat, rJustify.GetValue()); +} + +pAttr = rDoc.GetPattern(0, 1, 0); //A2 + +{ +const SfxPoolItem& rItem = pAttr->GetItem(ATTR_HOR_JUSTIFY); +const SvxHorJustifyItem& rJustify = static_cast(rItem); +CPPUNIT_ASSERT_EQUAL(SvxCellHorJustify::Center, rJustify.GetValue()); +} + +{ +const ScProtectionAttr& rItem = pAttr->GetItem(ATTR_PROTECTION); +CPPUNIT_ASSERT(rItem.GetProtection()); +CPPUNIT_ASSERT(!rItem.GetHideFormula()); +} + +pAttr = rDoc.GetPattern(2, 0, 0); //C1 + +{ +const SfxPoolItem& rItem = pAttr->GetItem(ATTR_HOR_JUSTIFY); +const SvxHorJustifyItem& rJustify = static_cast(rItem); +CPPUNIT_ASSERT_EQUAL(SvxCellHorJustify::Standard, rJustify.GetValue()); +} + +{ +const ScProtectionAttr& rItem = pAttr->GetItem(ATTR_PROTECTION); +CPPUNIT_ASSERT(rItem.GetProtection()); +CPPUNIT_ASSERT(rItem.GetHideFormula()); +} + +pAttr = rDoc.GetPattern(2, 1, 0); //C2 + +{ +const SfxPoolItem& rItem = pAttr->GetItem(ATTR_HOR_JUSTIFY); +const SvxHorJustifyItem& rJustify = static_cast(rItem); +CPPUNIT_ASSERT_EQUAL(SvxCellHorJustify::Block, rJustify.GetValue()); +} + +{ +const ScProtectionAttr& rItem = pAttr->GetItem(ATTR_PROTECTION); +CPPUNIT_ASSERT(!rItem.GetProtection()); +CPPUNIT_ASSERT(!rItem.GetHideFormula()); +} + +xDocSh->DoClose(); +} + void ScExportTest2::testTdf123353() { ScDocShellRef xShell = loadDoc(u"tdf123353.", FORMAT_XLSX); diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index d40fcdc3d395..ad17e1db9f4e 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -1976,10 +1976,10 @@ void Xf::importXf( const AttributeList& rAttribs, bool bCellXf ) maModel.mnFillId =
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/calc_tests/columns.py| 20 ++-- sc/qa/uitest/calc_tests/rows.py | 12 ++-- sc/qa/uitest/calc_tests9/tdf126673.py |2 +- sc/source/ui/view/cellsh3.cxx |8 ++-- 4 files changed, 19 insertions(+), 23 deletions(-) New commits: commit f82f6a2714fbf7882eb1d77351574392ae8e4c27 Author: Heiko Tietze AuthorDate: Fri Nov 26 11:30:26 2021 +0100 Commit: Heiko Tietze CommitDate: Fri Nov 26 14:49:55 2021 +0100 Reverts tdf#144247 tdf#101217 - 4 digits in row height/col width Reverts patch I29d90b413e6f6f6e8b73d30ac47d644a69d15046, ad8edac43e73555bc2055514300c5b81a1bb04ea and partially Ibdee348d84a8b96d8f698e7fc6db89eb24422f5d Change-Id: Iba5fd2d2a65d813c2d5ba85e66a7c3e07b726ca5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125871 Tested-by: Jenkins Reviewed-by: Xisco Fauli Reviewed-by: Heiko Tietze diff --git a/sc/qa/uitest/calc_tests/columns.py b/sc/qa/uitest/calc_tests/columns.py index dafd825c76c8..19033f86ea7e 100644 --- a/sc/qa/uitest/calc_tests/columns.py +++ b/sc/qa/uitest/calc_tests/columns.py @@ -42,7 +42,7 @@ class CalcColumns(UITestCase): #verify with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth", close_button="cancel") as xDialog: xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") def test_column_width_two_columns(self): @@ -67,12 +67,12 @@ class CalcColumns(UITestCase): gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") def test_column_width_copy(self): @@ -103,7 +103,7 @@ class CalcColumns(UITestCase): gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") def test_column_hide_show(self): @@ -195,32 +195,32 @@ class CalcColumns(UITestCase): gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.0003 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.00 cm") gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "3.0004 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "3.00 cm") gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "F1"})) with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "G1"})) with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.0003 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.00 cm")
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/calc_tests8/tdf144940.py| 59 +++ sc/source/filter/xml/XMLTableHeaderFooterContext.cxx | 11 +-- 2 files changed, 65 insertions(+), 5 deletions(-) New commits: commit 5db9b33dadda67c7f97d8c23df17211fae380919 Author: Attila Bakos (NISZ) AuthorDate: Wed Nov 17 09:15:23 2021 +0100 Commit: László Németh CommitDate: Fri Nov 26 11:52:13 2021 +0100 tdf#144940 sc: fix disabled header/footer regression Setting "Same content on first page" in the Page Style dialog on either the Header or Footer tab resulted disabled header/footer after reload. This was due to flawed logic when assigning SC_UNO_PAGE_HDRON/FTRON value: "leftness" was checked for but not "first pageness". Regression from commit b9993369b4011cd8f367e439f5248096827f1efc "tdf#121715 XLSX: support custom first page header/footer". Co-authored-by: Daniel Arato (NISZ) Change-Id: I8ee4c9f8145913d9dc5f4b66cdbc2352f2e405f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125367 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/uitest/calc_tests8/tdf144940.py b/sc/qa/uitest/calc_tests8/tdf144940.py new file mode 100644 index ..6b118c7602c2 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf144940.py @@ -0,0 +1,59 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues +from tempfile import TemporaryDirectory +from org.libreoffice.unotest import systemPathToFileUrl +import os.path + +class tdf144940(UITestCase): + +def test_tdf144940(self): + +with TemporaryDirectory() as tempdir: +xFilePath = os.path.join(tempdir, "tdf144940-tmp.ods") + +with self.ui_test.create_doc_in_start_center("calc"): + +with self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog") as xDialog: +xTabs = xDialog.getChild("tabcontrol") +select_pos(xTabs, "4") + +xCheckHeaderOn = xDialog.getChild("checkHeaderOn") +xCheckSameFP = xDialog.getChild("checkSameFP") +xCheckSameLR = xDialog.getChild("checkSameLR") + +self.assertEqual("true", get_state_as_dict(xCheckHeaderOn)["Selected"]) +self.assertEqual("true", get_state_as_dict(xCheckSameLR)["Selected"]) +self.assertEqual("false", get_state_as_dict(xCheckSameFP)["Selected"]) + +xCheckSameFP.executeAction("CLICK", tuple()) + +self.assertEqual("true", get_state_as_dict(xCheckSameFP)["Selected"]) + +with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="open") as xSaveDialog: +xFileName = xSaveDialog.getChild("file_name") +xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) +xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) +xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + +with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + +xPageStyles = document.StyleFamilies.getByIndex(1) +xDefaultPageStyle = xPageStyles.getByIndex(0) + +# Without the fix in place, this test would have failed with +# AssertionError: False is not true +self.assertTrue(xDefaultPageStyle.HeaderOn) +self.assertTrue(xDefaultPageStyle.FooterOn) +self.assertTrue(xDefaultPageStyle.FirstPageHeaderIsShared) +self.assertTrue(xDefaultPageStyle.FirstPageFooterIsShared) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/source/filter/xml/XMLTableHeaderFooterContext.cxx b/sc/source/filter/xml/XMLTableHeaderFooterContext.cxx index c0b5c6eb6cc1..773eb12da88b 100644 --- a/sc/source/filter/xml/XMLTableHeaderFooterContext.cxx +++ b/sc/source/filter/xml/XMLTableHeaderFooterContext.cxx @@ -63,19 +63,20 @@ XMLTableHeaderFooterContext::XMLTableHeaderFooterContext( SvXMLImport& rImport, XMLOFF_WARN_UNKNOWN("sc", aIter); } bool bOn(::cppu::any2bool(xPropSet->getPropertyValue( sOn ))); -if( bLeft ) +if( bLeft || bFirst ) { +const OUString sShare = bLeft ? sShareContent : sShareFirstContent; if( bOn && bDisplay ) { -if( ::cppu::any2bool(xPropSet->getPropertyValue( sShareContent )) ) +if(
[Libreoffice-commits] core.git: sc/qa sc/source sc/uiconfig sc/UIConfig_scalc.mk vcl/unx
sc/UIConfig_scalc.mk |1 sc/qa/uitest/autofilter/autofilter.py | 48 +- sc/qa/uitest/autofilter2/tdf117276.py |8 sc/qa/uitest/autofilter2/tdf117276_autofilter_reset.py |6 sc/qa/uitest/autofilter2/tdf122260.py |4 sc/qa/uitest/autofilter2/tdf140754.py |4 sc/qa/uitest/autofilter2/tdf141946.py |8 sc/qa/uitest/autofilter2/tdf46062.py |2 sc/qa/uitest/autofilter2/tdf46184.py |2 sc/qa/uitest/autofilter2/tdf48025.py |6 sc/qa/uitest/autofilter2/tdf68113.py |4 sc/qa/uitest/autofilter2/tdf97340.py |2 sc/qa/uitest/calc_tests9/pivotTable.py |2 sc/source/ui/cctrl/checklistmenu.cxx | 370 + sc/source/ui/inc/checklistmenu.hxx | 95 ++-- sc/source/ui/inc/gridwin.hxx |4 sc/source/ui/view/gridwin.cxx | 93 ++-- sc/source/ui/view/gridwin2.cxx | 45 -- sc/uiconfig/scalc/ui/filterdropdown.ui | 367 sc/uiconfig/scalc/ui/filtersubdropdown.ui | 79 +++ vcl/unx/gtk3/gtkinst.cxx | 52 ++ 21 files changed, 693 insertions(+), 509 deletions(-) New commits: commit 2acdb3e617658ca19de26e8928e42b4955622feb Author: Caolán McNamara AuthorDate: Fri Nov 19 11:38:58 2021 + Commit: Caolán McNamara CommitDate: Tue Nov 23 17:36:13 2021 +0100 tdf#139460 improve autofilter sub-menu interaction under gtk so the submenu pops down when the mouse moves back into its parent. This removes layer of InterimItemWindow and for gtk (under wayland) the autofilter and its submenu can use native GtkPopovers Change-Id: I4c8c3d2087566f508d75eda72e272d9f7fba2f00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125428 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index c1bd1b075926..336e1710958d 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -129,6 +129,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/filldlg \ sc/uiconfig/scalc/ui/filterlist \ sc/uiconfig/scalc/ui/filterdropdown \ + sc/uiconfig/scalc/ui/filtersubdropdown \ sc/uiconfig/scalc/ui/footerdialog \ sc/uiconfig/scalc/ui/formatcellsdialog \ sc/uiconfig/scalc/ui/formulacalculationoptions \ diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index 847aa8dcf8b6..eede08073388 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -20,7 +20,7 @@ class AutofilterTest(UITestCase): xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) xFloatWindow = self.xUITest.getFloatWindow() -xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xCheckListMenu = xFloatWindow.getChild("FilterDropDown") xTreeList = xCheckListMenu.getChild("check_tree_box") xFirstEntry = xTreeList.getChild("0") @@ -42,7 +42,7 @@ class AutofilterTest(UITestCase): xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"})) xFloatWindow = self.xUITest.getFloatWindow() -xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xCheckListMenu = xFloatWindow.getChild("FilterDropDown") xTreeList = xCheckListMenu.getChild("check_list_box") xFirstEntry = xTreeList.getChild("1") @@ -64,7 +64,7 @@ class AutofilterTest(UITestCase): xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "3"})) xFloatWindow = self.xUITest.getFloatWindow() -xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xCheckListMenu = xFloatWindow.getChild("FilterDropDown") xTreeList = xCheckListMenu.getChild("check_list_box") size1 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0]) xOkBtn = xFloatWindow.getChild("cancel") @@ -72,7 +72,7 @@ class AutofilterTest(UITestCase): xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "3"})) xFloatWindow = self.xUITest.getFloatWindow() -xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xCheckListMenu = xFloatWindow.getChild("FilterDropDown") xTreeList =
[Libreoffice-commits] core.git: sc/qa sc/source sc/uiconfig
sc/qa/unit/data/functions/spreadsheet/fods/vlookup2.fods | 22 +++ sc/source/core/data/table3.cxx |9 -- sc/uiconfig/scalc/ui/optcalculatepage.ui |2 - 3 files changed, 12 insertions(+), 21 deletions(-) New commits: commit 8dec2a98ce29251936cd45ebf864a89ff767ee50 Author: Luboš Luňák AuthorDate: Tue Nov 16 01:30:24 2021 +0100 Commit: Luboš Luňák CommitDate: Wed Nov 17 10:10:58 2021 +0100 revert "vlookup - optimize SC_EQUAL and NOT_EQUAL." (tdf#139612) That commit breaks lookup when the "Search criteria = and <> must apply to whole cells" option is disabled, as it enforces whole cell checking regardless of the option. Given that the option is enabled by default in LO ('SearchCriteria' in Calc.xcs) and it's what MSOffice does as well, and this default gives good performance regardless of the option, I don't understand the purpose of the commit. Possibly it was based on a document where somebody disabled the option and then indeed got worse performance. Solution: Don't do that :). This reverts the code parts of a953fa1c0f6a40a08859570516c511f3a841 . The test I've kept but switched to ensure that partial matching does work if the option to match whole cells is disabled. I've also changed the tooltip for the option to mention performance and not suggest that off is the default. Change-Id: I56d7b6e7b8e9f0622f7ad6d447daf56c3b705a7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125267 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-by: Luboš Luňák diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/vlookup2.fods b/sc/qa/unit/data/functions/spreadsheet/fods/vlookup2.fods index d47779d928a1..fd228881a7cb 100644 --- a/sc/qa/unit/data/functions/spreadsheet/fods/vlookup2.fods +++ b/sc/qa/unit/data/functions/spreadsheet/fods/vlookup2.fods @@ -1017,14 +1017,14 @@ TRUE - VLOOKUP tests that ensure there is no partial matching of cell contents + VLOOKUP tests that ensure there is partial matching of cell contents - even though the document option of “search on whole cell” is turned off. + when the document option of “search on whole cell” is turned off. @@ -1095,10 +1095,10 @@ #N/A - - #N/A + + 2 - + TRUE @@ -1122,10 +1122,10 @@ #N/A - - #N/A + + 2 - + TRUE @@ -1149,10 +1149,10 @@ #N/A - - #N/A + + 2 - + TRUE diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 9c7417278658..0ef833511dba 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2767,11 +2767,6 @@ public: if (nIndex < 0) nStrPos = -1; -else if (rEntry.eOp == SC_EQUAL || - rEntry.eOp == SC_NOT_EQUAL) -{ -nStrPos = pCellStr == pQuer ? 0 : -1; -} else { // OUString::indexOf nStrPos = rtl_ustr_indexOfStr_WithLength( @@ -2803,14 +2798,10 @@ public: switch (rEntry.eOp) { case SC_EQUAL: -bOk = ( nStrPos == 0 ); -break; case SC_CONTAINS: bOk = ( nStrPos != -1 ); break; case SC_NOT_EQUAL: -bOk = ( nStrPos != 0 ); -break; case SC_DOES_NOT_CONTAIN: bOk = ( nStrPos == -1 ); break; diff --git a/sc/uiconfig/scalc/ui/optcalculatepage.ui b/sc/uiconfig/scalc/ui/optcalculatepage.ui index 1af846f48ff1..1c0c7f3c2928 100644 --- a/sc/uiconfig/scalc/ui/optcalculatepage.ui +++ b/sc/uiconfig/scalc/ui/optcalculatepage.ui @@ -131,7 +131,7 @@ True True False -Enable this for interoperability with Microsoft Excel +Keep this enabled for interoperability with Microsoft Excel or for better performance True True
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/calc_tests9/pivotTable.py | 35 - sc/qa/uitest/data/pivotTable.ods |binary sc/source/ui/uitest/uiobject.cxx | 19 + 3 files changed, 53 insertions(+), 1 deletion(-) New commits: commit 35d9d085436e159bdeb6cba9c94865d6346af530 Author: Xisco Fauli AuthorDate: Mon Nov 15 21:07:01 2021 +0100 Commit: Xisco Fauli CommitDate: Mon Nov 15 22:32:54 2021 +0100 uitest: sc: add support for pivot table popup Change-Id: Id990178051e81a81bf6f6a0fb920473d3ee21fff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125259 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sc/qa/uitest/calc_tests9/pivotTable.py b/sc/qa/uitest/calc_tests9/pivotTable.py index b7a4fd328b2a..559073ab0507 100644 --- a/sc/qa/uitest/calc_tests9/pivotTable.py +++ b/sc/qa/uitest/calc_tests9/pivotTable.py @@ -7,10 +7,11 @@ from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position class pivotTable(UITestCase): - def test_cancelButton(self): +def test_cancelButton(self): # This is basically a test for cf93998eb5abc193d95ae5433bf4dfd11a9d62d8 # Without the fix in place, this test would have crashed @@ -60,4 +61,36 @@ class pivotTable(UITestCase): self.assertEqual('true', get_state_as_dict(xEmptyLine)['Selected']) +def test_popup(self): +with self.ui_test.load_file(get_url_for_data_file("pivotTable.ods")) as calc_doc: + +xCalcDoc = self.xUITest.getTopFocusWindow() +gridwin = xCalcDoc.getChild("grid_window") + +self.assertEqual("a", get_cell_by_position(calc_doc, 0, 3, 1).getString()) +self.assertEqual("b", get_cell_by_position(calc_doc, 0, 3, 2).getString()) +self.assertEqual("m", get_cell_by_position(calc_doc, 0, 4, 1).getString()) +self.assertEqual("n", get_cell_by_position(calc_doc, 0, 4, 2).getString()) +self.assertEqual("1", get_cell_by_position(calc_doc, 0, 5, 1).getString()) +self.assertEqual("1", get_cell_by_position(calc_doc, 0, 5, 2).getString()) + +gridwin.executeAction("LAUNCH", mkPropertyValues({"PIVOTTABLE": "", "COL": "3", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") + +xTreeList = xCheckListMenu.getChild("check_list_box") +xFirstEntry = xTreeList.getChild("0") + +xFirstEntry.executeAction("CLICK", tuple()) + +xOkBtn = xFloatWindow.getChild("ok") +xOkBtn.executeAction("CLICK", tuple()) + +self.assertEqual("b", get_cell_by_position(calc_doc, 0, 3, 1).getString()) +self.assertEqual("Total Result", get_cell_by_position(calc_doc, 0, 3, 2).getString()) +self.assertEqual("n", get_cell_by_position(calc_doc, 0, 4, 1).getString()) +self.assertEqual("", get_cell_by_position(calc_doc, 0, 4, 2).getString()) +self.assertEqual("1", get_cell_by_position(calc_doc, 0, 5, 1).getString()) +self.assertEqual("1", get_cell_by_position(calc_doc, 0, 5, 2).getString()) + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/pivotTable.ods b/sc/qa/uitest/data/pivotTable.ods new file mode 100644 index ..cbb773857605 Binary files /dev/null and b/sc/qa/uitest/data/pivotTable.ods differ diff --git a/sc/source/ui/uitest/uiobject.cxx b/sc/source/ui/uitest/uiobject.cxx index d93da2619a77..14e464c0bf20 100644 --- a/sc/source/ui/uitest/uiobject.cxx +++ b/sc/source/ui/uitest/uiobject.cxx @@ -234,6 +234,25 @@ void ScGridWinUIObject::execute(const OUString& rAction, SCCOL nCol = itrCol->second.toUInt32(); mxGridWindow->LaunchAutoFilterMenu(nCol, nRow); } +else if ( rParameters.find("PIVOTTABLE") != rParameters.end()) +{ +auto itrCol = rParameters.find("COL"); +if (itrCol == rParameters.end()) +{ +SAL_WARN("sc.uitest", "missing COL parameter"); +return; +} + +auto itrRow = rParameters.find("ROW"); +if (itrRow == rParameters.end()) +{ +SAL_WARN("sc.uitest", "missing ROW parameter"); +return; +} +SCROW nRow = itrRow->second.toUInt32(); +SCCOL nCol = itrCol->second.toUInt32(); +mxGridWindow->LaunchDPFieldMenu(nCol, nRow); +} else if ( rParameters.find("SELECTMENU") != rParameters.end()) { auto itrCol = rParameters.find("COL");
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf143220.ods |binary sc/qa/unit/subsequent_export_test2.cxx | 14 ++ sc/source/filter/excel/xecontent.cxx |6 +- 3 files changed, 15 insertions(+), 5 deletions(-) New commits: commit 85a86ba6ba34ff0dfc92c3ce38cba86daf547121 Author: Tünde Tóth AuthorDate: Tue Oct 19 14:15:37 2021 +0200 Commit: László Németh CommitDate: Thu Nov 4 08:58:42 2021 +0100 tdf#145079 XLSX export: fix regression of internal hyperlinks Hyperlinks with internal named range targets didn't work. Regression from commit 3c3b9ad8886da916027f0fb940a2df822d63d4d7 (tdf#143220 XLSX export: fix hyperlink to sheet target) Note: original test case of the unit test document of tdf#143220 wasn't changed. It's only extended with two new test cases for verifying the fix for the regression. Change-Id: I8128ebb977dba7304bc9c69e45f6c55c71f800cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123816 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/ods/tdf143220.ods b/sc/qa/unit/data/ods/tdf143220.ods index 6aa1536eae8e..281c25626ed5 100644 Binary files a/sc/qa/unit/data/ods/tdf143220.ods and b/sc/qa/unit/data/ods/tdf143220.ods differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 8144a3cb988e..681b05398fa4 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -208,7 +208,7 @@ public: void testTdf142929_filterLessThanXLSX(); void testInvalidNamedRange(); void testExternalDefinedNameXLSX(); -void testTdf143220XLSX(); +void testHyperlinkLocationXLSX(); void testTdf142264ManyChartsToXLSX(); void testTdf143929MultiColumnToODS(); void testTdf142578(); @@ -320,7 +320,7 @@ public: CPPUNIT_TEST(testTdf142929_filterLessThanXLSX); CPPUNIT_TEST(testInvalidNamedRange); CPPUNIT_TEST(testExternalDefinedNameXLSX); -CPPUNIT_TEST(testTdf143220XLSX); +CPPUNIT_TEST(testHyperlinkLocationXLSX); CPPUNIT_TEST(testTdf142264ManyChartsToXLSX); CPPUNIT_TEST(testTdf143929MultiColumnToODS); CPPUNIT_TEST(testTdf142578); @@ -2744,7 +2744,7 @@ void ScExportTest2::testExternalDefinedNameXLSX() xDocSh->DoClose(); } -void ScExportTest2::testTdf143220XLSX() +void ScExportTest2::testHyperlinkLocationXLSX() { ScDocShellRef xDocSh = loadDoc(u"tdf143220.", FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.is()); @@ -2752,7 +2752,13 @@ void ScExportTest2::testTdf143220XLSX() xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); -assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "location", "Sheet2!A1"); + +// tdf#143220 link to sheet not valid without cell reference +assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[@ref='A1']", "location", "Sheet2!A1"); + +// tdf#145079 link with defined name target didn't work because Calc added "A1" at the end +assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[@ref='A2']", "location", "name"); +assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[@ref='A3']", "location", "db"); xDocSh->DoClose(); } diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 4baa6c00e9ad..006e3cb2c956 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -438,7 +438,11 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU } } else -aTextMark += "!A1";// tdf#143220 link to sheet not valid without cell reference +{ +SCTAB nTab; +if (rRoot.GetDoc().GetTable(aTextMark, nTab)) +aTextMark += "!A1"; // tdf#143220 link to sheet not valid without cell reference +} mxTextMark.reset( new XclExpString( aTextMark, XclStrFlags::ForceUnicode, 255 ) ); }
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/extras/macros-test.cxx |9 sc/qa/extras/sccellrangeobj.cxx |5 sc/qa/extras/scindexenumeration_tableconditionalentryenumeration.cxx | 20 - sc/qa/extras/scmodelobj.cxx |6 sc/qa/extras/scpdfexport.cxx | 29 +- sc/qa/extras/scsubtotaldescriptorbase.cxx|6 sc/qa/extras/scsubtotalfieldobj.cxx |6 sc/qa/extras/sctableconditionalentryobj.cxx | 20 - sc/qa/extras/sctableconditionalformat.cxx| 19 - sc/qa/unit/bugfix-test.cxx | 13 - sc/qa/unit/chart2dataprovider.cxx| 21 - sc/qa/unit/copy_paste_test.cxx |5 sc/qa/unit/jumbosheets-test.cxx |5 sc/qa/unit/scshapetest.cxx |5 sc/qa/unit/subsequent_export_test2.cxx |9 sc/qa/unit/tiledrendering/tiledrendering.cxx | 36 +-- sc/qa/unit/uicalc/uicalc.cxx |5 sc/source/core/data/documen3.cxx |3 sc/source/core/data/documen5.cxx | 30 +- sc/source/core/data/dpfilteredcache.cxx |9 sc/source/core/data/dpobject.cxx |9 sc/source/core/data/dpoutput.cxx |8 sc/source/core/data/dptabsrc.cxx |7 sc/source/core/data/table5.cxx | 14 - sc/source/core/data/validat.cxx | 22 -- sc/source/core/tool/charthelper.cxx |7 sc/source/core/tool/formulaparserpool.cxx|3 sc/source/core/tool/interpr4.cxx |5 sc/source/filter/excel/xichart.cxx |7 sc/source/filter/excel/xiescher.cxx | 10 sc/source/filter/excel/xltoolbar.cxx |6 sc/source/filter/excel/xltracer.cxx |5 sc/source/filter/ftools/fapihelper.cxx |5 sc/source/filter/inc/xltracer.hxx|2 sc/source/filter/oox/autofilterbuffer.cxx| 20 + sc/source/filter/oox/drawingfragment.cxx |9 sc/source/filter/oox/viewsettings.cxx|7 sc/source/filter/oox/workbooksettings.cxx| 18 - sc/source/filter/xml/XMLCodeNameProvider.cxx | 10 sc/source/filter/xml/xmldrani.cxx|2 sc/source/filter/xml/xmldrani.hxx|2 sc/source/filter/xml/xmlexprt.cxx| 13 - sc/source/filter/xml/xmlimprt.cxx|6 sc/source/filter/xml/xmlsorti.cxx| 39 +-- sc/source/ui/Accessibility/AccessibleCsvControl.cxx | 24 +- sc/source/ui/Accessibility/AccessibleDocument.cxx|6 sc/source/ui/Accessibility/AccessiblePreviewTable.cxx|2 sc/source/ui/cctrl/tbzoomsliderctrl.cxx | 10 sc/source/ui/docshell/docsh.cxx | 26 +- sc/source/ui/docshell/docsh4.cxx | 15 - sc/source/ui/drawfunc/fuins2.cxx | 27 +- sc/source/ui/miscdlgs/optsolver.cxx |5 sc/source/ui/miscdlgs/solveroptions.cxx |3 sc/source/ui/miscdlgs/solverutil.cxx |7 sc/source/ui/unoobj/PivotTableDataSequence.cxx | 11 - sc/source/ui/unoobj/cellvaluebinding.cxx | 17 - sc/source/ui/unoobj/chartuno.cxx | 27 +- sc/source/ui/unoobj/condformatuno.cxx| 19 - sc/source/ui/unoobj/dapiuno.cxx |3 sc/source/ui/unoobj/datauno.cxx | 14 - sc/source/ui/unoobj/docuno.cxx | 55 ++--- sc/source/ui/unoobj/eventuno.cxx |3 sc/source/ui/unoobj/linkuno.cxx |9 sc/source/ui/unoobj/servuno.cxx
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf145129_DefaultRowHeight_28.35pt_SavedByExcel.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx| 17 ++ sc/source/filter/oox/worksheetfragment.cxx| 7 +++- 3 files changed, 23 insertions(+), 1 deletion(-) New commits: commit 69424f0fd66a74dbabba66c9c7fb1420aa1ff4e9 Author: Attila Szűcs AuthorDate: Fri Oct 15 13:55:36 2021 +0200 Commit: László Németh CommitDate: Tue Oct 26 11:13:45 2021 +0200 tdf#145129 XLSX import: round down default row height like table layout of MSO does, e.g. 20 pt to 19.5 pt. Same as tdf#144642, but with default row height. Follow-up to commit 537cb82be8fa021fd9382cca874645c75daaef20 "tdf#144642 XLSX import: round down row height to 0.75 pt". Co-authored-by: Tibor Nagy (NISZ) Change-Id: Iefb615b56e5ddc11a5e839cf6d90516b18646045 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123655 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/xlsx/tdf145129_DefaultRowHeight_28.35pt_SavedByExcel.xlsx b/sc/qa/unit/data/xlsx/tdf145129_DefaultRowHeight_28.35pt_SavedByExcel.xlsx new file mode 100644 index ..f8041d58eb65 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf145129_DefaultRowHeight_28.35pt_SavedByExcel.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 2be6a07c4af8..53aaedb48288 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -200,6 +200,7 @@ public: void testTdf139258_rotated_image(); void testTdf142854_GridVisibilityImportXlsxInHeadlessMode(); void testTdf144642_RowHeightRounding(); +void testTdf145129_DefaultRowHeightRounding(); void testTdf140431(); void testCheckboxFormControlXlsxExport(); void testButtonFormControlXlsxExport(); @@ -311,6 +312,7 @@ public: CPPUNIT_TEST(testTdf139258_rotated_image); CPPUNIT_TEST(testTdf142854_GridVisibilityImportXlsxInHeadlessMode); CPPUNIT_TEST(testTdf144642_RowHeightRounding); +CPPUNIT_TEST(testTdf145129_DefaultRowHeightRounding); CPPUNIT_TEST(testTdf140431); CPPUNIT_TEST(testCheckboxFormControlXlsxExport); CPPUNIT_TEST(testButtonFormControlXlsxExport); @@ -2572,6 +2574,21 @@ void ScExportTest2::testTdf144642_RowHeightRounding() xShell->DoClose(); } +void ScExportTest2::testTdf145129_DefaultRowHeightRounding() +{ +// MS Excel round down row heights to 0.75pt +// Same as Tdf144642 but with default row height. + +ScDocShellRef xShell += loadDoc(u"tdf145129_DefaultRowHeight_28.35pt_SavedByExcel.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); +ScDocument& rDoc = xShell->GetDocument(); +// 555twips == 27.75pt == 9.79mm +CPPUNIT_ASSERT_EQUAL(sal_uInt16(555), rDoc.GetRowHeight(0, 0)); +CPPUNIT_ASSERT_EQUAL(sal_uLong(555 * 52), rDoc.GetRowHeight(0, 51, 0, true)); +xShell->DoClose(); +} + void ScExportTest2::testTdf140431() { ScDocShellRef xShell = loadDoc(u"129969-min.", FORMAT_XLSX); diff --git a/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx index a0e01c915dcf..218ab447545b 100644 --- a/sc/source/filter/oox/worksheetfragment.cxx +++ b/sc/source/filter/oox/worksheetfragment.cxx @@ -667,8 +667,13 @@ void WorksheetFragment::importSheetFormatPr( const AttributeList& rAttribs ) // XML_outlineLevelRow // XML_outlineLevelCol // as it will be updated during export to OOXML +double fDefaultRowHeight = rAttribs.getDouble(XML_defaultRowHeight, 0.0); +if (getFilter().isMSODocument()) +{ +fDefaultRowHeight -= fmod(fDefaultRowHeight, 0.75); //round down to 0.75pt +} setDefaultRowSettings( -rAttribs.getDouble( XML_defaultRowHeight, 0.0 ), +fDefaultRowHeight, rAttribs.getBool( XML_customHeight, false ), rAttribs.getBool( XML_zeroHeight, false ), rAttribs.getBool( XML_thickTop, false ),
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx | 14 +-- sc/source/ui/app/inputhdl.cxx| 101 ++- sc/source/ui/inc/inputhdl.hxx|6 + sc/source/ui/view/tabvwsh4.cxx |5 + 4 files changed, 101 insertions(+), 25 deletions(-) New commits: commit 4cfa840ecaa5a094a32a60a60b295858980109df Author: Dennis Francis AuthorDate: Wed Oct 13 20:24:50 2021 +0530 Commit: Dennis Francis CommitDate: Mon Oct 18 13:20:02 2021 +0200 tdf#145198: Bash like autocompletion for Calc autoinput Refer ESC minutes section "Calc auto-complete behavior changes" at https://lists.freedesktop.org/archives/libreoffice/2021-October/087911.html for context. Consider an example of the following data in a column: ABCD123xyz ABCD345qwel ABCD123pqr ABCD123xyz PQR 1. When user types A, it will show the partial suggestion BCD. 2. User can accept the suggestion with the right arrow key and then the cursor will be placed after the letter D, waiting for more input. User can choose to not accept the suggestion either by typing more or by ending the edit mode by pressing Esc key. 3. If the user accepts the suggestion BCD by right arrow key, and types 1, it will show a partial suggestion of 23. User can accept this by pressing the right arrow key. 4. If the user accepts the suggestion in the 3rd step and types x it will show the final suggestion yz. Again user can choose to accept or decline the suggestion as mentioned in the 1st step. The tiledrendering test ScTiledRenderingTest::testAutoInputExactMatch() is amended to match the new behaviour. Change-Id: Ib2cfc16af71483790384e70eb7332f864cf744c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123578 Tested-by: Jenkins Reviewed-by: Dennis Francis diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 3cfde4952b16..ac0ca40d241d 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -2712,12 +2712,12 @@ void ScTiledRenderingTest::testAutoInputExactMatch() ScAddress aA8(0, 7, 0); lcl_typeCharsInCell("S", aA8.Col(), aA8.Row(), pView, pModelObj); // Type "S" in A8 -// Should not autocomplete as there are multiple matches starting with "S". -CPPUNIT_ASSERT_EQUAL_MESSAGE("1: A8 should have just S (should not autocomplete)", OUString("S"), pDoc->GetString(aA8)); +// Should show the partial completion "i". +CPPUNIT_ASSERT_EQUAL_MESSAGE("1: A8 should have partial completion Si", OUString("Si"), pDoc->GetString(aA8)); lcl_typeCharsInCell("Si", aA8.Col(), aA8.Row(), pView, pModelObj); // Type "Si" in A8 -// Should not autocomplete as there are multiple matches starting with "Si". -CPPUNIT_ASSERT_EQUAL_MESSAGE("2: A8 should not autocomplete", OUString("Si"), pDoc->GetString(aA8)); +// Should not show any suggestions. +CPPUNIT_ASSERT_EQUAL_MESSAGE("2: A8 should not show suggestions", OUString("Si"), pDoc->GetString(aA8)); lcl_typeCharsInCell("Sim", aA8.Col(), aA8.Row(), pView, pModelObj); // Type "Sim" in A8 // Should autocomplete to "Simple" which is the only match. @@ -2727,9 +2727,9 @@ void ScTiledRenderingTest::testAutoInputExactMatch() // Should autocomplete to "Sing" which is the only match. CPPUNIT_ASSERT_EQUAL_MESSAGE("4: A8 should autocomplete", OUString("Sing"), pDoc->GetString(aA8)); -lcl_typeCharsInCell("Cas", aA8.Col(), aA8.Row(), pView, pModelObj); // Type "Cas" in A8 -// Should not autocomplete as there are multiple matches starting with "Cas". -CPPUNIT_ASSERT_EQUAL_MESSAGE("5: A8 should not autocomplete", OUString("Cas"), pDoc->GetString(aA8)); +lcl_typeCharsInCell("C", aA8.Col(), aA8.Row(), pView, pModelObj); // Type "C" in A8 +// Should show the partial completion "as". +CPPUNIT_ASSERT_EQUAL_MESSAGE("5: A8 should have partial completion Cas", OUString("Cas"), pDoc->GetString(aA8)); lcl_typeCharsInCell("Cast", aA8.Col(), aA8.Row(), pView, pModelObj); // Type "Cast" in A8 // Should autocomplete to "Castle" which is the only match. diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 9c553cec8614..97c86b34b00d 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -162,15 +162,42 @@ OUString getExactMatch(const ScTypedCaseStrSet& rDataSet, const OUString& rStrin return rString; } +// This assumes that rResults is a sorted ring w.r.t ScTypedStrData::LessCaseInsensitive() or +// in the reverse direction, whose origin is specified by nRingOrigin. +sal_Int32 getLongestCommonPrefixLength(const std::vector& rResults, const OUString& rUserEntry, sal_Int32 nRingOrigin) +{ +sal_Int32 nResults = rResults.size(); +if (!nResults) +
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/qpro/pass/ofz40008-1.wb2 |binary sc/source/core/data/table5.cxx |3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) New commits: commit 7528bb3c5098a67f32523c028d83dfbc79a7c6a0 Author: Caolán McNamara AuthorDate: Sat Oct 16 14:12:03 2021 +0100 Commit: Caolán McNamara CommitDate: Sat Oct 16 20:10:59 2021 +0200 ofz#40008 check if column exists before EndListening attempt Change-Id: Iad6a7f215aa36fb6f8bb35e14aa5b882bf9773f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123703 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/qa/unit/data/qpro/pass/ofz40008-1.wb2 b/sc/qa/unit/data/qpro/pass/ofz40008-1.wb2 new file mode 100644 index ..d4adc7d484c9 Binary files /dev/null and b/sc/qa/unit/data/qpro/pass/ofz40008-1.wb2 differ diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index 646984b7c699..e885f4c704bd 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -1148,7 +1148,8 @@ void ScTable::EndListening(sc::EndListeningContext& rCxt, const ScAddress& rAddr if (!ValidCol(rAddress.Col())) return; -aCol[rAddress.Col()].EndListening(rCxt, rAddress, rListener); +if (rAddress.Col() < aCol.size()) +aCol[rAddress.Col()].EndListening(rCxt, rAddress, rListener); } void ScTable::SetPageStyle(const OUString& rName)
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/pivottable_filters_test.cxx|7 ++- sc/qa/unit/ucalc_sharedformula.cxx|8 ++-- sc/source/core/data/column4.cxx |6 ++ sc/source/core/data/dpfilteredcache.cxx |4 +--- sc/source/core/data/formulacell.cxx |3 +-- sc/source/core/data/table3.cxx| 18 ++ sc/source/core/tool/interpr8.cxx |3 +-- sc/source/filter/excel/xlroot.cxx |3 +-- sc/source/ui/app/inputhdl.cxx |3 +-- sc/source/ui/cctrl/checklistmenu.cxx |7 +-- sc/source/ui/condformat/condformatmgr.cxx |7 +-- sc/source/ui/dialogs/searchresults.cxx|9 ++--- sc/source/ui/docshell/docfunc.cxx |3 +-- sc/source/ui/miscdlgs/conflictsdlg.cxx|9 ++--- sc/source/ui/miscdlgs/sharedocdlg.cxx | 13 + sc/source/ui/namedlg/namemgrtable.cxx |6 +++--- sc/source/ui/vba/excelvbahelper.cxx |3 +-- sc/source/ui/vba/vbawindow.cxx|3 +-- sc/source/ui/view/tabvwshf.cxx|3 +-- 19 files changed, 59 insertions(+), 59 deletions(-) New commits: commit f6a5efc7cde6e7d723e05b866bc6de1bb56913b0 Author: Julien Nabet AuthorDate: Sat Oct 16 10:16:37 2021 +0200 Commit: Julien Nabet CommitDate: Sat Oct 16 19:05:05 2021 +0200 Simplify vector initialization in sc Change-Id: If5b7632cfbc81f89d68ce8fbce1fac265e8354fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123692 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index cfca0c29cadf..8ad8fbffee81 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -432,11 +432,8 @@ void ScPivotTableFiltersTest::testPivotTableSharedCacheGroupODS() } std::sort(aGrpValues.begin(), aGrpValues.end()); -std::vector aChecks; -aChecks.push_back(ScDPItemData::DateFirst); -aChecks.push_back(2012); -aChecks.push_back(2013); -aChecks.push_back(ScDPItemData::DateLast); +std::vector aChecks{ ScDPItemData::DateFirst, 2012, 2013, +ScDPItemData::DateLast }; CPPUNIT_ASSERT_MESSAGE("Unexpected group values for the year group.", bool(aGrpValues == aChecks)); } diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index 1f7bc50ed2f5..3e96ed80ce57 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -1550,10 +1550,7 @@ void TestSharedFormula::testSharedFormulaMoveBlock() clearFormulaCellChangedFlag(*m_pDoc, aFormulaRange); // Make sure these formula cells in B1:B3 have correct positions even after the move. -std::vector aRows; -aRows.push_back(0); -aRows.push_back(1); -aRows.push_back(2); +std::vector aRows { 0, 1, 2 }; bool bRes = checkFormulaPositions(*m_pDoc, 0, 1, aRows.data(), aRows.size()); CPPUNIT_ASSERT(bRes); @@ -1928,8 +1925,7 @@ void TestSharedFormula::testSharedFormulaUnshareAreaListeners() // Set formula cell vector. { ScFormulaCell* pCell = new ScFormulaCell( *m_pDoc, aPos, "=B4"); -std::vector aCells; -aCells.push_back(pCell); +std::vector aCells { pCell }; m_pDoc->SetFormulaCells( aPos, aCells); } break; diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index f7f7d2a294da..b4491b869966 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -435,8 +435,7 @@ void ScColumn::ConvertFormulaToValue( if (!GetDoc().ValidRow(nRow1) || !GetDoc().ValidRow(nRow2) || nRow1 > nRow2) return; -std::vector aBounds; -aBounds.push_back(nRow1); +std::vector aBounds { nRow1 }; if (nRow2 < GetDoc().MaxRow()-1) aBounds.push_back(nRow2+1); @@ -496,8 +495,7 @@ void ScColumn::SwapNonEmpty( sc::TableValues& rValues, sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt ) { const ScRange& rRange = rValues.getRange(); -std::vector aBounds; -aBounds.push_back(rRange.aStart.Row()); +std::vector aBounds { rRange.aStart.Row() }; if (rRange.aEnd.Row() < GetDoc().MaxRow()-1) aBounds.push_back(rRange.aEnd.Row()+1); diff --git a/sc/source/core/data/dpfilteredcache.cxx b/sc/source/core/data/dpfilteredcache.cxx index 16e11c183b83..19b1782076c2 100644 --- a/sc/source/core/data/dpfilteredcache.cxx +++ b/sc/source/core/data/dpfilteredcache.cxx @@ -41,9 +41,7 @@ bool ScDPFilteredCache::SingleFilter::match(const ScDPItemData& rCellData) const std::vector
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf144397.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx | 62 sc/source/filter/excel/xeformula.cxx|1 sc/source/filter/excel/xelink.cxx |6 ++ sc/source/filter/excel/xename.cxx |2 sc/source/filter/oox/externallinkbuffer.cxx | 21 + sc/source/ui/docshell/externalrefmgr.cxx| 49 -- 7 files changed, 136 insertions(+), 5 deletions(-) New commits: commit 12ee423c7549ddd2b86dfc3fc6fed2c617dcca7f Author: Balazs Varga AuthorDate: Mon Sep 13 12:17:37 2021 +0200 Commit: László Németh CommitDate: Mon Oct 11 09:03:36 2021 +0200 tdf#144397 tdf#144636 XLSX: cache external named ranges and their formulas XLSX round-trip resulted corrupt XLSX with invalid named range, triggering Excel file repair, because of incomplete handling of external file reference of the named ranges (tdf#144636). Cache external named ranges and their formulas in case of updating formulas without data loss. Also we can copy cell formulas and we get valid results of formulas from the cached tables, instead of an error type. Now Calc resolves the external file reference of the named ranges, e.g. see "rangenameinotherfile" of the unit test document in Manage Names (Ctrl-F3). After the fix, it contains full path of the external file, and recalculating the sheet or changing data in the target file reveals that the named range works correctly (tdf#144397). Change-Id: Ic011a29290f8cabcc39fdc4b8d775ecf9d33612f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122026 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/xlsx/tdf144397.xlsx b/sc/qa/unit/data/xlsx/tdf144397.xlsx new file mode 100644 index ..bb0eeaa6e14a Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf144397.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 336b3ca7e167..cea7c5e00628 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -204,6 +204,7 @@ public: void testButtonFormControlXlsxExport(); void testTdf142929_filterLessThanXLSX(); void testInvalidNamedRange(); +void testExternalDefinedNameXLSX(); void testTdf143220XLSX(); void testTdf142264ManyChartsToXLSX(); void testTdf143929MultiColumnToODS(); @@ -313,6 +314,7 @@ public: CPPUNIT_TEST(testButtonFormControlXlsxExport); CPPUNIT_TEST(testTdf142929_filterLessThanXLSX); CPPUNIT_TEST(testInvalidNamedRange); +CPPUNIT_TEST(testExternalDefinedNameXLSX); CPPUNIT_TEST(testTdf143220XLSX); CPPUNIT_TEST(testTdf142264ManyChartsToXLSX); CPPUNIT_TEST(testTdf143929MultiColumnToODS); @@ -2643,6 +2645,66 @@ void ScExportTest2::testInvalidNamedRange() CPPUNIT_ASSERT(!xNamedRanges->hasByName("myname")); } +void ScExportTest2::testExternalDefinedNameXLSX() +{ +ScDocShellRef xShell = loadDoc(u"tdf144397.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +xDocSh->ReloadAllLinks(); +ScDocument& rDoc = xDocSh->GetDocument(); +rDoc.CalcAll(); + +// "January" +{ +const ScFormulaCell* pFC = rDoc.GetFormulaCell(ScAddress(1, 1, 0)); +sc::FormulaResultValue aRes = pFC->GetResult(); +CPPUNIT_ASSERT_EQUAL(sc::FormulaResultValue::String, aRes.meType); +CPPUNIT_ASSERT_EQUAL(OUString("January"), aRes.maString.getString()); +} +// "March" +{ +const ScFormulaCell* pFC = rDoc.GetFormulaCell(ScAddress(1, 3, 0)); +sc::FormulaResultValue aRes = pFC->GetResult(); +CPPUNIT_ASSERT_EQUAL(sc::FormulaResultValue::String, aRes.meType); +CPPUNIT_ASSERT_EQUAL(OUString("March"), aRes.maString.getString()); +} +// "Empty = #N/A" +{ +const ScFormulaCell* pFC = rDoc.GetFormulaCell(ScAddress(1, 5, 0)); +sc::FormulaResultValue aRes = pFC->GetResult(); +CPPUNIT_ASSERT_EQUAL(sc::FormulaResultValue::Error, aRes.meType); +CPPUNIT_ASSERT_EQUAL(OUString(""), aRes.maString.getString()); +} +// "June" +{ +const ScFormulaCell* pFC = rDoc.GetFormulaCell(ScAddress(1, 6, 0)); +sc::FormulaResultValue aRes = pFC->GetResult(); +CPPUNIT_ASSERT_EQUAL(sc::FormulaResultValue::String, aRes.meType); +CPPUNIT_ASSERT_EQUAL(OUString("June"), aRes.maString.getString()); +} + +xmlDocUniquePtr pDoc = XPathHelper::parseExport2( +*this, *xDocSh, m_xSFactory, "xl/externalLinks/externalLink1.xml", FORMAT_XLSX); + +CPPUNIT_ASSERT(pDoc); +assertXPath(pDoc, "/x:externalLink/x:externalBook/x:sheetNames/x:sheetName", "val", "Munka1"); +assertXPath(pDoc, "/x:externalLink/x:externalBook/x:definedNames/x:definedName",
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf130104_indent.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx | 91 + sc/source/filter/excel/xeextlst.cxx|2 sc/source/filter/excel/xestyle.cxx | 15 ++-- sc/source/filter/excel/xlroot.cxx |9 ++ sc/source/filter/inc/xestyle.hxx |2 sc/source/filter/inc/xlroot.hxx|9 +- sc/source/filter/oox/stylesbuffer.cxx |4 - 8 files changed, 119 insertions(+), 13 deletions(-) New commits: commit 6b93ee72df1aa42d1a3482ffc396bd0c23134f8b Author: Kevin Suo AuthorDate: Mon Oct 4 23:11:30 2021 +0800 Commit: Mike Kaganski CommitDate: Fri Oct 8 08:01:01 2021 +0200 tdf#130104 - FILESAVE XLSX: cell indent increased on each save In OOXML, 1 indent = 3 space char width. - The Old Method: - XLSX Import: As per the line: sal_Int32 nIndent = getUnitConverter().scaleToMm100( 3.0 * maModel.mnIndent, Unit::Space ); assume the width of space char is 88, then: If the OOXML indent is 1, then nIndent would be 264.5, and casted to 264. If the OOXML indent is 2, then nIndent would be 528.5, and casted to 528. If the OOXML indent is 3, then nIndent would be 792.5, and casted to 792. ... Also, as Mike Kaganski has pointed out, we use twips in sc indent internally, thus it is wrong to convert to Mm100 unit here. XLSX Export: As per the line: nTmpIndent = (nTmpIndent + 100) / 200; Assume we did not edit the document upon open, and simply save it. Now: If our indent is 264, then the calculated OOXML indent would be 1.82, and then casted to 1, while the expected value is 1. If our indent is 528, then the calculated OOXML indent would be 3.14, and then casted to 3, while the expected value is 2. If our indent is 792, then the calculated OOXML indent would be 4.46, and then casted to 4, while the expected value is 3. ... Then if you reopen the saved xlsx file with Calc, the increament of indent continues on each save which causes serious format loss. Most importantly, if you change the indent of cells using the Calc toolbar indent icon, one-click would be 10pt = 200 twips, see defined macro SC_INDENT_STEP. This causes a mess when you change the indent in an xlsx document. - The New Method - In this patch, I have changed the XLSX import to convert the excel indent unit to 3-spaces-width *in twips*. Then, per code advice from Mike Kaganski, as a mirror operation, I have changed the XLSX export logic to detect the width of the space char (which *should* be the same as the one detected at the time of xlsx import), and use this width to convert the indent in twips unit to excel unit. This way, the indent will remain the same on xlsx export. - TODO: - 1. On xlsx import of the file tdf130104_indent.xlsx, the default font (i.e. font for the "Normal" style) is "Times New Roman". However, when the UI locale is set to Simplified Chinese and "Asian" option is enabled in Tools->Options->Language Settigns-> Languages->"Default Languages for Documents", upon resave as xlsx, the default font for the document is changed to "Noto Sans CJK SC" on my system, which causes the space-width detected to be different from the width detected on xlsx import. This seems to be another bug, see tdf#131349. (Luckily the unit test in this patch passes, this is because the change of space width resulted from the change in default font is very small thus the conversion is not impacted.) 2. The UI part need to be improved, so that after xlsx import, if the user hit the "Increase Indent" or "Decrease Indent" toolar icon to change the indent, Calc should be able to detect that we are operating in an xlsx file, thus the "increment" should be 3 * width of space char, rather than the current SC_INDENT_STEP. Also, the if the user changes the default font of the xlsx document, the Calc should recalculate the indent for each cell to reflect the possible change in width of space char. Change-Id: I5f7a4ecbcd93079d1c19db3b0b641dda949f6fbf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123111 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski diff --git a/sc/qa/unit/data/xlsx/tdf130104_indent.xlsx b/sc/qa/unit/data/xlsx/tdf130104_indent.xlsx new file mode 100644 index ..9cb1e78e4587 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf130104_indent.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 0f62be048b4c..336b3ca7e167 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -208,6 +208,7 @@ public: void testTdf142264ManyChartsToXLSX(); void testTdf143929MultiColumnToODS(); void
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/rangelst_test.cxx | 14 ++ sc/source/core/tool/rangelst.cxx | 10 +- sc/source/ui/unoobj/chart2uno.cxx |8 3 files changed, 27 insertions(+), 5 deletions(-) New commits: commit e7ec79fe36a0f22f10167806da80e3c1f30b36e8 Author: Luboš Luňák AuthorDate: Wed Oct 6 12:57:15 2021 +0200 Commit: Luboš Luňák CommitDate: Wed Oct 6 16:31:35 2021 +0200 ScRangeList::UpdateReference() join all ranges properly (tdf#140901) This is basically a revert of 6eb8634a9f62bfe486ecd2f46, which made this Join() just the last range, probably under the assumption that the function is always called with just one range to update, or to avoid the possibility that Join() removes several items from the list, breaking the next step of the loop. But DeleteArea() may split several ranges, so we need to make sure to Join() all of them. Change-Id: Iea124142335ccdc8fa578344cddce8670c27573d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123135 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/qa/unit/rangelst_test.cxx b/sc/qa/unit/rangelst_test.cxx index bfd4acd5dae1..4239cc91e8a9 100644 --- a/sc/qa/unit/rangelst_test.cxx +++ b/sc/qa/unit/rangelst_test.cxx @@ -520,6 +520,20 @@ void Test::testUpdateReference_DeleteRow() ScRangeList aList2(ScRange(2,2,0,2,2,0)); aList2.UpdateReference(URM_INSDEL, m_pDoc, ScRange(0,3,0,MAXCOL,MAXROW,0), 0, -1, 0); CPPUNIT_ASSERT(aList2.empty()); + +ScRangeList aList3; +aList3.push_back(ScRange(2,2,0,2,8,0)); +aList3.push_back(ScRange(4,2,0,4,8,0)); +aList3.UpdateReference(URM_INSDEL, m_pDoc, ScRange(2,5,0,MAXCOL,MAXROW,0), 0, -1, 0); +// Verify all ranges in the list have been updated properly. +CPPUNIT_ASSERT_EQUAL(size_t(2), aList3.size()); +CPPUNIT_ASSERT_EQUAL(ScRange(2,2,0,2,7,0), aList3[0]); +CPPUNIT_ASSERT_EQUAL(ScRange(4,2,0,4,7,0), aList3[1]); + +ScRangeList aList4(ScRange(0,0,0,MAXCOL,MAXROW,0)); +ScRangeList aList4Copy = aList4; +aList4.UpdateReference(URM_INSDEL, m_pDoc, ScRange(14,3,0,MAXCOL,7,0), 0, -2, 0); +CPPUNIT_ASSERT_EQUAL(aList4Copy, aList4); } void Test::testUpdateReference_DeleteLastRow() diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index d1b7e598c67e..c1b149d7aee5 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -436,7 +436,15 @@ bool ScRangeList::UpdateReference( if( nDx < 0 || nDy < 0 ) { size_t n = maRanges.size(); -Join(maRanges[n-1], true); +for(size_t i = n-1; i > 0;) +{ +Join(maRanges[i], true); +// Join() may merge and remove even more than one item, protect against it. +if(i >= maRanges.size()) +i = maRanges.size()-1; +else +--i; +} } } diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 3ee4f1cde054..5eb7f2cc75e0 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -2778,7 +2778,7 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint } } -OSL_ENSURE(m_pRangeIndices->size() == aRanges.size(), +assert(m_pRangeIndices->size() == aRanges.size() && "range list and range index list have different sizes."); unique_ptr pUndoRanges; @@ -2791,7 +2791,7 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint if (bChanged) { -OSL_ENSURE(m_pRangeIndices->size() == aRanges.size(), +assert(m_pRangeIndices->size() == aRanges.size() && "range list and range index list have different sizes after the reference update."); // Bring the change back from the range list to the token list. @@ -2813,7 +2813,7 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint if (!m_pRangeIndices || m_pRangeIndices->empty()) { -OSL_FAIL(" faulty range indices"); +assert(false && " faulty range indices"); break; } @@ -2822,7 +2822,7 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint size_t nCount = rRanges.size(); if (nCount != m_pRangeIndices->size()) { -OSL_FAIL("range count and range index count differ."); +assert(false && "range count and range index count differ."); break; }
[Libreoffice-commits] core.git: sc/qa sc/source test/source
sc/qa/unit/data/fods/tdf144758-dbdata-no-orientation.fods | 17 +++ sc/qa/unit/subsequent_filters_test.cxx| 21 ++ sc/source/filter/xml/xmldrani.cxx |2 - test/source/sheet/xdatabaserange.cxx |2 - 4 files changed, 40 insertions(+), 2 deletions(-) New commits: commit d830179a072072f3cc3ea5d942189647bcb7e1c7 Author: Mike Kaganski AuthorDate: Fri Oct 1 19:22:18 2021 +0300 Commit: Mike Kaganski CommitDate: Sat Oct 2 01:43:31 2021 +0200 tdf#144758: default value for 'table:orientation' attribute is 'row' See [OpenDocument-v1.3-part3] section 19.690.3 . Regression after commit ed88b144ce24b9a733d4a9ab6614307c96537baa. Also fixes relevant part of unit test first introduced in commit 6069ef7976c4455c1875afecf02c41c5731f6546, which was at that time testing that IsSortColumns property returned false; then in commit fc95d20500997a1a460be6f3553727299a5080eb, the correct value was changed to true, reflecting the regression fixed here. Change-Id: I6a12a0ad13405bc388efb7c2c3bbf31e89905620 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122955 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski diff --git a/sc/qa/unit/data/fods/tdf144758-dbdata-no-orientation.fods b/sc/qa/unit/data/fods/tdf144758-dbdata-no-orientation.fods new file mode 100644 index ..922fba5ab6cb --- /dev/null +++ b/sc/qa/unit/data/fods/tdf144758-dbdata-no-orientation.fods @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx index 1bdfceb446ba..de4cea5dc961 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -71,6 +71,7 @@ #include #include #include +#include #include #include @@ -217,6 +218,7 @@ public: void testTdf129681(); void testTdf111974XLSM(); void testEscapedUnicodeXLSX(); +void testTdf144758_DBDataDefaultOrientation(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testCondFormatOperatorsSameRangeXLSX); @@ -320,6 +322,7 @@ public: CPPUNIT_TEST(testTdf129681); CPPUNIT_TEST(testTdf111974XLSM); CPPUNIT_TEST(testEscapedUnicodeXLSX); +CPPUNIT_TEST(testTdf144758_DBDataDefaultOrientation); CPPUNIT_TEST_SUITE_END(); @@ -3123,6 +3126,24 @@ void ScFiltersTest::testEscapedUnicodeXLSX() xDocSh->DoClose(); } +void ScFiltersTest::testTdf144758_DBDataDefaultOrientation() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf144758-dbdata-no-orientation.", FORMAT_FODS); +CPPUNIT_ASSERT(xDocSh); +ScDocument& rDoc = xDocSh->GetDocument(); +ScDBData* pAnonDBData = rDoc.GetAnonymousDBData(0); +CPPUNIT_ASSERT(pAnonDBData); + +ScSortParam aSortParam; +pAnonDBData->GetSortParam(aSortParam); + +// Without the fix, the default value for bByRow (in absence of 'table:orientation' attribute +// in 'table:database-range' element) was false +CPPUNIT_ASSERT(aSortParam.bByRow); + +xDocSh->DoClose(); +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "sc/qa/unit/data" ) { diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx index 820c42412b51..9d596740ef74 100644 --- a/sc/source/filter/xml/xmldrani.cxx +++ b/sc/source/filter/xml/xmldrani.cxx @@ -103,7 +103,7 @@ ScXMLDatabaseRangeContext::ScXMLDatabaseRangeContext( ScXMLImport& rImport, bSubTotalsAscending(true), bFilterConditionSourceRange(false), bHasHeader(true), -bByRow(false), +bByRow(true), meRangeType(ScDBCollection::GlobalNamed) { if( rAttrList.is() ) diff --git a/test/source/sheet/xdatabaserange.cxx b/test/source/sheet/xdatabaserange.cxx index 2c45ba0fbf0a..f1133ac00f5d 100644 --- a/test/source/sheet/xdatabaserange.cxx +++ b/test/source/sheet/xdatabaserange.cxx @@ -69,7 +69,7 @@ void XDatabaseRange::testGetSortDescriptor() { bool bIsSortColumns = true; aProp.Value >>= bIsSortColumns; -CPPUNIT_ASSERT(bIsSortColumns); +CPPUNIT_ASSERT(!bIsSortColumns); } else if (aProp.Name == "ContainsHeader") {
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf142578.ods |binary sc/qa/unit/subsequent_export_test2.cxx | 41 + sc/source/filter/excel/xestyle.cxx | 15 +--- 3 files changed, 48 insertions(+), 8 deletions(-) New commits: commit b7a425d48cb282e20059e78ad5216da833dec803 Author: Vasily Melenchuk AuthorDate: Thu Sep 30 17:50:16 2021 +0200 Commit: Vasily Melenchuk CommitDate: Fri Oct 1 17:38:53 2021 +0200 tdf#142578: xlsx export: use continuous numbering for dfx nodes Since all dxf records are stored in one place it is required from color filter and conditional formatting to use continuous numbering for dxf structures to avoid id collision. Change-Id: I91146e34d462d812b480db137cda522f6db7ef8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122915 Tested-by: Jenkins Reviewed-by: Vasily Melenchuk diff --git a/sc/qa/unit/data/ods/tdf142578.ods b/sc/qa/unit/data/ods/tdf142578.ods new file mode 100644 index ..0fb6e07d5e4b Binary files /dev/null and b/sc/qa/unit/data/ods/tdf142578.ods differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 1ca736fe07ef..0f62be048b4c 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -207,6 +207,7 @@ public: void testTdf143220XLSX(); void testTdf142264ManyChartsToXLSX(); void testTdf143929MultiColumnToODS(); +void testTdf142578(); CPPUNIT_TEST_SUITE(ScExportTest2); @@ -314,6 +315,7 @@ public: CPPUNIT_TEST(testTdf143220XLSX); CPPUNIT_TEST(testTdf142264ManyChartsToXLSX); CPPUNIT_TEST(testTdf143929MultiColumnToODS); +CPPUNIT_TEST(testTdf142578); CPPUNIT_TEST_SUITE_END(); @@ -2804,6 +2806,45 @@ void ScExportTest2::testTdf143929MultiColumnToODS() "column-gap"); } +void ScExportTest2::testTdf142578() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf142578.", FORMAT_ODS); +CPPUNIT_ASSERT(xDocSh); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocUniquePtr pSheet += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pSheet); + +// Get DxfId for color filter +sal_Int32 nDxfIdColorFilter += getXPath(pSheet, "/x:worksheet/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId") + .toInt32() + + 1; + +// Get DxfId for conditional formatting +sal_Int32 nDxfIdCondFormat += getXPath(pSheet, "/x:worksheet/x:conditionalFormatting/x:cfRule", "dxfId").toInt32() + 1; + +// Ensure they are using different dxfs +CPPUNIT_ASSERT_MESSAGE("dxfID's should be different!", nDxfIdColorFilter != nDxfIdCondFormat); + +// Check colors used by these dxfs +xmlDocUniquePtr pStyles = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/styles.xml"); +CPPUNIT_ASSERT(pStyles); + +OString sDxfColorFilterXPath("/x:styleSheet/x:dxfs/x:dxf[" + OString::number(nDxfIdColorFilter) + + "]/x:fill/x:patternFill/x:fgColor"); +assertXPath(pStyles, sDxfColorFilterXPath, "rgb", "FF81D41A"); + +OString sDxfCondFormatXPath("/x:styleSheet/x:dxfs/x:dxf[" + OString::number(nDxfIdCondFormat) ++ "]/x:fill/x:patternFill/x:bgColor"); +assertXPath(pStyles, sDxfCondFormatXPath, "rgb", ""); + +xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 7032a2667a5b..e7260ecf56c1 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -3054,8 +3054,7 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot ) xFormatter->FillKeywordTableForExcel( *mpKeywordTable ); SCTAB nTables = rRoot.GetDoc().GetTableCount(); -sal_Int32 nColorIndex = 0; -sal_Int32 nCondFormattingIndex = 0; +sal_Int32 nDxfId = 0; for(SCTAB nTab = 0; nTab < nTables; ++nTab) { // Color filters @@ -3074,21 +3073,21 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot ) // Does not matter it is text color or cell background color for (auto& rColor : aFilterEntries.getBackgroundColors()) { -if (!maColorToDxfId.emplace(rColor, nColorIndex).second) +if (!maColorToDxfId.emplace(rColor, nDxfId).second) continue; std::unique_ptr pExpCellArea(new XclExpCellArea(rColor, 0)); maDxf.push_back(std::make_unique(rRoot, std::move(pExpCellArea))); -nColorIndex++; +nDxfId++; } for (auto& rColor : aFilterEntries.getTextColors()) { -if (!maColorToDxfId.emplace(rColor,
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/autofilter-colors-fg.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx | 64 - sc/source/filter/excel/excrecds.cxx| 15 +++-- sc/source/filter/excel/xestyle.cxx | 22 +++- sc/source/filter/inc/xestyle.hxx |6 -- sc/source/filter/oox/autofilterbuffer.cxx | 14 + sc/source/filter/oox/stylesbuffer.cxx |7 +- 7 files changed, 70 insertions(+), 58 deletions(-) New commits: commit 6f908b48373b71d45c8119b296b0504fb586f6f8 Author: Vasily Melenchuk AuthorDate: Fri Sep 24 15:18:13 2021 +0200 Commit: Thorsten Behrens CommitDate: Fri Oct 1 14:00:46 2021 +0200 tdf#143104 Fix xlsx import/export of color filter colors 1. In XLSX filter colors are always stored in dxf as foreground colors, so Calc should keep them, if possible. So practically use only one color during import. 3. On export we need to distinguish type of filter, this is done with cellColor=0 or cellColor=1 attribute of . 4. Since p.1 there is no need to keep on export separate dxf structures for fg and bg colors: we always use only foreground color for color filters. Co-authored-by: Samuel Mehrbrodt Change-Id: Iacd352ae46bf84859dc15ee695b6dc63240afe7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122593 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/sc/qa/unit/data/xlsx/autofilter-colors-fg.xlsx b/sc/qa/unit/data/xlsx/autofilter-colors-fg.xlsx new file mode 100644 index ..8360ec7e92be Binary files /dev/null and b/sc/qa/unit/data/xlsx/autofilter-colors-fg.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 10743521d31c..1ca736fe07ef 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -120,7 +120,6 @@ public: void testDateAutofilterODS(); void testAutofilterColorsODF(); void testAutofilterColorsOOXML(); -void testAutofilterColorsStyleOOXML(); void testAutofilterTop10XLSX(); void testRefStringXLSX(); @@ -228,7 +227,6 @@ public: CPPUNIT_TEST(testDateAutofilterODS); CPPUNIT_TEST(testAutofilterColorsODF); CPPUNIT_TEST(testAutofilterColorsOOXML); -CPPUNIT_TEST(testAutofilterColorsStyleOOXML); CPPUNIT_TEST(testAutofilterTop10XLSX); CPPUNIT_TEST(testRefStringXLSX); @@ -793,27 +791,49 @@ void ScExportTest2::testAutofilterColorsODF() void ScExportTest2::testAutofilterColorsOOXML() { -ScDocShellRef xDocSh = loadDoc(u"autofilter-colors.", FORMAT_XLSX); -CPPUNIT_ASSERT(xDocSh.is()); - -xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, - "xl/tables/table1.xml", FORMAT_XLSX); -CPPUNIT_ASSERT(pDoc); - -assertXPath(pDoc, "/x:table/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId", "5"); -} - -void ScExportTest2::testAutofilterColorsStyleOOXML() -{ -ScDocShellRef xDocSh = loadDoc(u"autofilter-colors.", FORMAT_XLSX); -CPPUNIT_ASSERT(xDocSh.is()); - -xmlDocUniquePtr pDoc -= XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); -CPPUNIT_ASSERT(pDoc); +{ +ScDocShellRef xDocSh = loadDoc(u"autofilter-colors.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocUniquePtr pTable1 += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/tables/table1.xml"); +CPPUNIT_ASSERT(pTable1); +sal_Int32 nDxfId += getXPath(pTable1, "/x:table/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId") + .toInt32() + + 1; + +xmlDocUniquePtr pStyles += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/styles.xml"); +CPPUNIT_ASSERT(pStyles); +OString sDxfXPath("/x:styleSheet/x:dxfs/x:dxf[" + OString::number(nDxfId) + + "]/x:fill/x:patternFill/x:fgColor"); +assertXPath(pStyles, sDxfXPath, "rgb", "D7D7"); +xDocSh->DoClose(); +} -assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf[5]/x:fill/x:patternFill/x:bgColor", "rgb", -"D7D7"); +{ +ScDocShellRef xDocSh = loadDoc(u"autofilter-colors-fg.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocUniquePtr pTable1 += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/tables/table1.xml"); +CPPUNIT_ASSERT(pTable1); +sal_Int32 nDxfId += getXPath(pTable1, "/x:table/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId") + .toInt32() + + 1; + +
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/header-footer-content.ods |binary sc/qa/unit/subsequent_export_test2.cxx| 36 ++ sc/source/filter/xml/XMLTableMasterPageExport.cxx |2 - 3 files changed, 37 insertions(+), 1 deletion(-) New commits: commit 6f04952e6828cf1419b991e82070514bae24896c Author: Daniel Arato (NISZ) AuthorDate: Wed Sep 22 15:03:48 2021 +0200 Commit: László Németh CommitDate: Tue Sep 28 11:32:53 2021 +0200 tdf#144184 sc: fix first page footer export Due to a typical case of copy-paste oversight LO Calc used to lose the first page footer when exporting to ODS. With the typo fixed, the export now works again. Follow-up to commit 19fa853ce12136b5c14e0c5a0aa906c296b75388 "tdf#121715 XLSX: support custom first page header/footer". Change-Id: If8f5ab4ff9a9392768789b886218d1d9c56ddbae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122455 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/ods/header-footer-content.ods b/sc/qa/unit/data/ods/header-footer-content.ods new file mode 100644 index ..f365748ddc22 Binary files /dev/null and b/sc/qa/unit/data/ods/header-footer-content.ods differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 41a25d2c0312..10743521d31c 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -83,6 +83,7 @@ #include #include #include +#include #include using namespace ::com::sun::star; @@ -126,6 +127,7 @@ public: void testRefStringConfigXLSX(); void testRefStringUnspecified(); void testHeaderImageODS(); +void testHeaderFooterContentODS(); void testTdf88657ODS(); void testTdf41722(); @@ -233,6 +235,7 @@ public: CPPUNIT_TEST(testRefStringConfigXLSX); CPPUNIT_TEST(testRefStringUnspecified); CPPUNIT_TEST(testHeaderImageODS); +CPPUNIT_TEST(testHeaderFooterContentODS); CPPUNIT_TEST(testTdf88657ODS); CPPUNIT_TEST(testTdf41722); @@ -485,6 +488,39 @@ void ScExportTest2::testHeaderImageODS() xDocSh->DoClose(); } +void ScExportTest2::testHeaderFooterContentODS() +{ +ScDocShellRef xShell = loadDoc(u"header-footer-content.", FORMAT_ODS); +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_ODS); +uno::Reference xStyleFamiliesSupplier(xDocSh->GetModel(), + uno::UNO_QUERY); +uno::Reference xStyleFamilies += xStyleFamiliesSupplier->getStyleFamilies(); +uno::Reference xPageStyles(xStyleFamilies->getByName("PageStyles"), + uno::UNO_QUERY); +uno::Reference xStyle(xPageStyles->getByName("Default"), uno::UNO_QUERY); + +uno::Reference xContent; +xStyle->getPropertyValue("RightPageHeaderContent") >>= xContent; +CPPUNIT_ASSERT(xContent.is()); +CPPUNIT_ASSERT_EQUAL(OUString("header"), xContent->getCenterText()->getString()); + +xStyle->getPropertyValue("FirstPageHeaderContent") >>= xContent; +CPPUNIT_ASSERT(xContent.is()); +CPPUNIT_ASSERT_EQUAL(OUString("first page header"), xContent->getCenterText()->getString()); + +xStyle->getPropertyValue("RightPageFooterContent") >>= xContent; +CPPUNIT_ASSERT(xContent.is()); +CPPUNIT_ASSERT_EQUAL(OUString("footer"), xContent->getCenterText()->getString()); + +xStyle->getPropertyValue("FirstPageFooterContent") >>= xContent; +// First page footer content used to be lost upon export. +CPPUNIT_ASSERT(xContent.is()); +CPPUNIT_ASSERT_EQUAL(OUString("first page footer"), xContent->getCenterText()->getString()); + +xDocSh->DoClose(); +} + void ScExportTest2::testTextDirectionXLSX() { ScDocShellRef xDocSh = loadDoc(u"writingMode.", FORMAT_XLSX); diff --git a/sc/source/filter/xml/XMLTableMasterPageExport.cxx b/sc/source/filter/xml/XMLTableMasterPageExport.cxx index bf43b2c29fb2..59b29378ea16 100644 --- a/sc/source/filter/xml/XMLTableMasterPageExport.cxx +++ b/sc/source/filter/xml/XMLTableMasterPageExport.cxx @@ -187,7 +187,7 @@ void XMLTableMasterPageExport::exportMasterPageContent( bool bFirstFooter = (!::cppu::any2bool(rPropSet->getPropertyValue( SC_UNO_PAGE_FIRSTFTRSHARED )) && bFooter); -exportHeaderFooter( xFooterLeft, XML_FOOTER_FIRST, bFirstFooter ); +exportHeaderFooter( xFooterFirst, XML_FOOTER_FIRST, bFirstFooter ); } }
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xls/tdf144732.xls |binary sc/qa/unit/subsequent_filters_test2.cxx | 103 sc/source/filter/excel/impop.cxx|6 - 3 files changed, 105 insertions(+), 4 deletions(-) New commits: commit e753de4630fb74ac837d0339be23a305f18d0725 Author: Mike Kaganski AuthorDate: Mon Sep 27 17:05:25 2021 +0200 Commit: Mike Kaganski CommitDate: Tue Sep 28 05:54:40 2021 +0200 tdf#144732: treat invalid subtype value as worksheet Commit 9bdb1d2473510067da1ac74013595b661ac37800 for i51490 had introduced the same change for Bof2, Bof3, Bof4. Change-Id: I478a8611874d70fad0c83700efed5ea882d5f69f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122650 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/qa/unit/data/xls/tdf144732.xls b/sc/qa/unit/data/xls/tdf144732.xls new file mode 100644 index ..04f3cc0d12bf Binary files /dev/null and b/sc/qa/unit/data/xls/tdf144732.xls differ diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx index bf0dee63d885..4803e19cbab8 100644 --- a/sc/qa/unit/subsequent_filters_test2.cxx +++ b/sc/qa/unit/subsequent_filters_test2.cxx @@ -207,6 +207,7 @@ public: void testTdf129940(); void testTdf139763ShapeAnchor(); void testAutofilterNamedRangesXLSX(); +void testInvalidBareBiff5(); CPPUNIT_TEST_SUITE(ScFiltersTest2); @@ -313,6 +314,7 @@ public: CPPUNIT_TEST(testTdf129940); CPPUNIT_TEST(testTdf139763ShapeAnchor); CPPUNIT_TEST(testAutofilterNamedRangesXLSX); +CPPUNIT_TEST(testInvalidBareBiff5); CPPUNIT_TEST_SUITE_END(); @@ -2895,6 +2897,107 @@ void ScFiltersTest2::testAutofilterNamedRangesXLSX() xDocSh->DoClose(); } +void ScFiltersTest2::testInvalidBareBiff5() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf144732.", FORMAT_XLS); +CPPUNIT_ASSERT(xDocSh.is()); +ScDocument& rDoc = xDocSh->GetDocument(); +rDoc.CalcAll(); + +// Check that we import the contents from such file, as Excel does +CPPUNIT_ASSERT_EQUAL(SCTAB(1), rDoc.GetTableCount()); + +// Row 1 +ScAddress aPos(0, 0, 0); +CPPUNIT_ASSERT_EQUAL(CELLTYPE_VALUE, rDoc.GetCellType(aPos)); +CPPUNIT_ASSERT_EQUAL(1.0, rDoc.GetValue(aPos)); +aPos.IncCol(); +CPPUNIT_ASSERT_EQUAL(CELLTYPE_VALUE, rDoc.GetCellType(aPos)); +CPPUNIT_ASSERT_EQUAL(2.0, rDoc.GetValue(aPos)); +aPos.IncCol(); +CPPUNIT_ASSERT_EQUAL(CELLTYPE_VALUE, rDoc.GetCellType(aPos)); +CPPUNIT_ASSERT_EQUAL(3.0, rDoc.GetValue(aPos)); +aPos.IncCol(); +CPPUNIT_ASSERT_EQUAL(OUString(), rDoc.GetString(aPos)); + +// Row 2 +aPos = ScAddress(0, 1, 0); +CPPUNIT_ASSERT_EQUAL(CELLTYPE_FORMULA, rDoc.GetCellType(aPos)); +OUString sFormula; +rDoc.GetFormula(aPos.Col(), aPos.Row(), aPos.Tab(), sFormula); +CPPUNIT_ASSERT_EQUAL(OUString("=TRUE()"), sFormula); +CPPUNIT_ASSERT_EQUAL(1.0, rDoc.GetValue(aPos)); +aPos.IncCol(); +CPPUNIT_ASSERT_EQUAL(CELLTYPE_FORMULA, rDoc.GetCellType(aPos)); +rDoc.GetFormula(aPos.Col(), aPos.Row(), aPos.Tab(), sFormula); +CPPUNIT_ASSERT_EQUAL(OUString("=FALSE()"), sFormula); +CPPUNIT_ASSERT_EQUAL(0.0, rDoc.GetValue(aPos)); +aPos.IncCol(); +CPPUNIT_ASSERT_EQUAL(CELLTYPE_NONE, rDoc.GetCellType(aPos)); +CPPUNIT_ASSERT_EQUAL(OUString(), rDoc.GetString(aPos)); +aPos.IncCol(); +CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, rDoc.GetCellType(aPos)); +CPPUNIT_ASSERT_EQUAL(OUString(u"sheetjs"), rDoc.GetString(aPos)); + +// Row 3 +aPos = ScAddress(0, 2, 0); +CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, rDoc.GetCellType(aPos)); +CPPUNIT_ASSERT_EQUAL(OUString(u"foobar"), rDoc.GetString(aPos)); +aPos.IncCol(); +CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, rDoc.GetCellType(aPos)); +CPPUNIT_ASSERT_EQUAL(OUString(u"baz"), rDoc.GetString(aPos)); +aPos.IncCol(); +CPPUNIT_ASSERT_EQUAL(CELLTYPE_VALUE, rDoc.GetCellType(aPos)); +CPPUNIT_ASSERT_EQUAL(41689.4375, rDoc.GetValue(aPos)); +aPos.IncCol(); +CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, rDoc.GetCellType(aPos)); +CPPUNIT_ASSERT_EQUAL(OUString(u"0.3"), rDoc.GetString(aPos)); + +// Row 4 +aPos = ScAddress(0, 3, 0); +CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, rDoc.GetCellType(aPos)); +CPPUNIT_ASSERT_EQUAL(OUString(u"baz"), rDoc.GetString(aPos)); +aPos.IncCol(); +CPPUNIT_ASSERT_EQUAL(CELLTYPE_NONE, rDoc.GetCellType(aPos)); +CPPUNIT_ASSERT_EQUAL(OUString(), rDoc.GetString(aPos)); +aPos.IncCol(); +CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, rDoc.GetCellType(aPos)); +CPPUNIT_ASSERT_EQUAL(OUString(u"_"), rDoc.GetString(aPos)); +aPos.IncCol(); +CPPUNIT_ASSERT_EQUAL(CELLTYPE_VALUE, rDoc.GetCellType(aPos)); +CPPUNIT_ASSERT_EQUAL(3.14159, rDoc.GetValue(aPos)); + +// Row 5 +aPos = ScAddress(0, 4, 0); +CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, rDoc.GetCellType(aPos)); +CPPUNIT_ASSERT_EQUAL(OUString(u"hidden"),
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export_test2.cxx |2 - sc/source/filter/excel/excrecds.cxx|1 sc/source/filter/excel/xestyle.cxx | 42 + 3 files changed, 24 insertions(+), 21 deletions(-) New commits: commit d148ed642f2aef2c2cc8615296cc648249a4878d Author: Samuel Mehrbrodt AuthorDate: Fri Sep 24 15:13:44 2021 +0200 Commit: Samuel Mehrbrodt CommitDate: Sat Sep 25 11:22:02 2021 +0200 tdf#76258 Fix xlsx export of color filter colors Change-Id: I08bd46fe10a8fc35a9c2a87745ee3e8cb4c676d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116648 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 12863985d79e..41a25d2c0312 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -764,7 +764,7 @@ void ScExportTest2::testAutofilterColorsOOXML() "xl/tables/table1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); -assertXPath(pDoc, "/x:table/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId", "4"); +assertXPath(pDoc, "/x:table/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId", "5"); } void ScExportTest2::testAutofilterColorsStyleOOXML() diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 71c62bd86190..a09312d665de 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -855,6 +855,7 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm ) nDxfId = GetDxfs().GetDxfByBackColor(color); else nDxfId = GetDxfs().GetDxfByForeColor(color); +nDxfId++; // Count is 1-based rWorksheet->singleElement(XML_colorFilter, XML_dxfId, OString::number(nDxfId)); } } diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 0b6d5ae95277..e9eccbfabc05 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -3054,8 +3054,7 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot ) xFormatter->FillKeywordTableForExcel( *mpKeywordTable ); SCTAB nTables = rRoot.GetDoc().GetTableCount(); -sal_Int32 nForeColorIndex = 0; -sal_Int32 nBackColorIndex = 0; +sal_Int32 nColorIndex = 0; sal_Int32 nCondFormattingIndex = 0; for(SCTAB nTab = 0; nTab < nTables; ++nTab) { @@ -3065,27 +3064,30 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot ) { ScRange aRange; pData->GetArea(aRange); -ScFilterEntries aFilterEntries; -rRoot.GetDoc().GetFilterEntriesArea(aRange.aStart.Col(), aRange.aStart.Row(), -aRange.aEnd.Row(), nTab, true, aFilterEntries); - -for (auto& rColor : aFilterEntries.getBackgroundColors()) +for (auto nCol = aRange.aStart.Col(); nCol <= aRange.aEnd.Col(); nCol++) { -if (!maBackColorToDxfId.emplace(rColor, nBackColorIndex).second) -continue; +ScFilterEntries aFilterEntries; +rRoot.GetDoc().GetFilterEntriesArea(nCol, aRange.aStart.Row(), +aRange.aEnd.Row(), nTab, true, aFilterEntries); -std::unique_ptr pExpCellArea(new XclExpCellArea(0, rColor)); -maDxf.push_back(std::make_unique(rRoot, std::move(pExpCellArea))); -nBackColorIndex++; -} -for (auto& rColor : aFilterEntries.getTextColors()) -{ -if (!maForeColorToDxfId.emplace(rColor, nForeColorIndex).second) -continue; +for (auto& rColor : aFilterEntries.getBackgroundColors()) +{ +if (!maBackColorToDxfId.emplace(rColor, nColorIndex).second) +continue; -std::unique_ptr pExpCellArea(new XclExpCellArea(rColor, 0)); -maDxf.push_back(std::make_unique(rRoot, std::move(pExpCellArea))); -nForeColorIndex++; +std::unique_ptr pExpCellArea(new XclExpCellArea(0, rColor)); +maDxf.push_back(std::make_unique(rRoot, std::move(pExpCellArea))); +nColorIndex++; +} +for (auto& rColor : aFilterEntries.getTextColors()) +{ +if (!maForeColorToDxfId.emplace(rColor, nColorIndex).second) +continue; + +std::unique_ptr pExpCellArea(new XclExpCellArea(rColor, 0)); +maDxf.push_back(std::make_unique(rRoot, std::move(pExpCellArea))); +nColorIndex++; +} } }
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/autofilter/autofilter.py | 23 +++ sc/qa/uitest/data/autofilter/tdf144253.ods |binary sc/source/core/data/table3.cxx |2 +- sc/source/core/tool/cellform.cxx |2 +- 4 files changed, 25 insertions(+), 2 deletions(-) New commits: commit 51375b48378915b6e95c1ac26b2ccf8e39880f7e Author: Balazs Varga AuthorDate: Mon Sep 6 12:02:54 2021 +0200 Commit: Balazs Varga CommitDate: Tue Sep 21 11:06:35 2021 +0200 tdf#144253 tdf#144324 sc filter: use formatted values in filters if the results of formulas are values. Followed up of 40acda4e78127fa9f513646ef210b074d40cf307 (Related: tdf#140968 avoid duplicated filter values) Change-Id: Ib396d2b7cc08ba41b5936a53a28b5e38bf678b3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121715 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index 8351e1f868a3..847aa8dcf8b6 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -505,4 +505,27 @@ class AutofilterTest(UITestCase): self.assertFalse(is_row_hidden(doc, 6)) self.assertFalse(is_row_hidden(doc, 7)) +def test_tdf144253(self): +with self.ui_test.load_file(get_url_for_data_file("tdf144253.ods")) as doc: + +xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "4", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xTreeList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(2, len(xTreeList.getChildren())) +self.assertEqual("65.43", get_state_as_dict(xTreeList.getChild('0'))['Text']) +self.assertEqual("83.33", get_state_as_dict(xTreeList.getChild('1'))['Text']) + +xFirstEntry = xTreeList.getChild("1") +xFirstEntry.executeAction("CLICK", tuple()) + +xOkBtn = xFloatWindow.getChild("ok") +xOkBtn.executeAction("CLICK", tuple()) + +self.assertFalse(is_row_hidden(doc, 0)) +self.assertTrue(is_row_hidden(doc, 1)) +self.assertFalse(is_row_hidden(doc, 2)) + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/autofilter/tdf144253.ods b/sc/qa/uitest/data/autofilter/tdf144253.ods new file mode 100644 index ..d2581904d0ac Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf144253.ods differ diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 7e1f05450c99..83d2a9cfa99f 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2464,7 +2464,7 @@ public: nCellVal = mrDoc.RoundValueAsShown(rCell.mfValue, nNumFmt, pContext); break; case CELLTYPE_FORMULA : -nCellVal = rCell.mpFormula->GetValue(); +nCellVal = mrDoc.RoundValueAsShown(rCell.mpFormula->GetValue(), nNumFmt, pContext); break; default: nCellVal = 0.0; diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx index 7a6b9eb38bbe..6872c0579803 100644 --- a/sc/source/core/tool/cellform.cxx +++ b/sc/source/core/tool/cellform.cxx @@ -134,7 +134,7 @@ void ScCellFormat::GetInputString( if (pFC->IsEmptyDisplayedAsString()) rString = EMPTY_OUSTRING; else if (pFC->IsValue()) -rFormatter.GetInputLineString(pFC->GetValue(), nFormat, rString); +rFormatter.GetInputLineString(pFC->GetValue(), nFormat, rString, bFiltering); else rString = pFC->GetString().getString();
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/scshapetest.cxx | 84 sc/source/filter/xcl97/xcl97rec.cxx |8 ++- 2 files changed, 90 insertions(+), 2 deletions(-) New commits: commit 84d6d704682a4d0e037a28895356b073e4f992a5 Author: Regina Henschel AuthorDate: Sun Sep 5 01:28:44 2021 +0200 Commit: Regina Henschel CommitDate: Mon Sep 6 16:04:07 2021 +0200 tdf#144242 no width-height swap for line and pathline MS Office swaps width and height for rotation angle ranges 45..135 and 225..315. Line and Pathline objects incorporate the rotation into their points, so have no rotation. Line and open Pathline objects nevertheless report an rotation angle. That one is used to align the text direction to the line. But because of this reported angle, width and height were swapped. The patch excludes these objects explicitly. The case differentiation for the rotation range had forgotten to normalize the angle. Therefore, in a reopened spreadsheet, the line was accidentally exported correctly without width-height swap, because in this case the rotation angle is negative. Change-Id: I5f698d1cc734e17bcb02ff77db5224a228392e06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121661 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx index e14ffeb508cd..187bf08ba765 100644 --- a/sc/qa/unit/scshapetest.cxx +++ b/sc/qa/unit/scshapetest.cxx @@ -71,6 +71,8 @@ public: void testTdf115655_HideDetail(); void testFitToCellSize(); void testCustomShapeCellAnchoredRotatedShape(); +void testTdf144242_Line_noSwapWH(); +void testTdf144242_OpenBezier_noSwapWH(); CPPUNIT_TEST_SUITE(ScShapeTest); CPPUNIT_TEST(testTdf143619_validation_circle_pos); @@ -98,6 +100,8 @@ public: CPPUNIT_TEST(testTdf115655_HideDetail); CPPUNIT_TEST(testFitToCellSize); CPPUNIT_TEST(testCustomShapeCellAnchoredRotatedShape); +CPPUNIT_TEST(testTdf144242_Line_noSwapWH); +CPPUNIT_TEST(testTdf144242_OpenBezier_noSwapWH); CPPUNIT_TEST_SUITE_END(); }; @@ -206,6 +210,86 @@ static SdrObject* lcl_getSdrObjectWithAssert(ScDocument& rDoc, sal_uInt16 nObjNu return pObj; } +void ScShapeTest::testTdf144242_OpenBezier_noSwapWH() +{ +// Shapes, which have rotation incorporated in their points, got erroneously width-height +// swapped, because they report a rotation. (Rotation was introduced to align text with curve.) + +// Create a spreadsheet document with default row height and col width +uno::Reference xComponent += loadFromDesktop("private:factory/scalc", "com.sun.star.sheet.SpreadsheetDocument"); + +// Get ScDocShell +ScDocShell* pDocSh = lcl_getScDocShellWithAssert(xComponent); + +// Insert default open Bezier curve +ScTabViewShell* pTabViewShell = lcl_getScTabViewShellWithAssert(pDocSh); +SfxRequest aReq(pTabViewShell->GetViewFrame(), SID_DRAW_BEZIER_NOFILL); +aReq.SetModifier(KEY_MOD1); // Ctrl +pTabViewShell->ExecDraw(aReq); +pTabViewShell->SetDrawShell(false); + +// Get document and newly created object +ScDocument& rDoc = pDocSh->GetDocument(); +SdrObject* pObj = lcl_getSdrObjectWithAssert(rDoc, 0); + +// Rotate object by 300deg +pObj->Rotate(pObj->GetSnapRect().Center(), 3_deg100, sin(toRadians(3_deg100)), + cos(toRadians(3_deg100))); +tools::Rectangle aExpectRect(pObj->GetSnapRect()); + +// Save, reload and compare +saveAndReload(xComponent, "Calc Office Open XML"); +pDocSh = lcl_getScDocShellWithAssert(xComponent); +ScDocument& rDoc2 = pDocSh->GetDocument(); +pObj = lcl_getSdrObjectWithAssert(rDoc2, 0); +tools::Rectangle aSnapRect(pObj->GetSnapRect()); +// Without fix in place width and height were swapped +lcl_AssertRectEqualWithTolerance("Reload: wrong pos and size", aExpectRect, aSnapRect, 30); + +pDocSh->DoClose(); +} + +void ScShapeTest::testTdf144242_Line_noSwapWH() +{ +// Shapes, which have rotation incorporated in their points, got erroneously width-height +// swapped, because they report a rotation. (Rotation was introduced to align text with line.) + +// Create a spreadsheet document with default row height and col width +uno::Reference xComponent += loadFromDesktop("private:factory/scalc", "com.sun.star.sheet.SpreadsheetDocument"); + +// Get ScDocShell +ScDocShell* pDocSh = lcl_getScDocShellWithAssert(xComponent); + +// Insert default line +ScTabViewShell* pTabViewShell = lcl_getScTabViewShellWithAssert(pDocSh); +SfxRequest aReq(pTabViewShell->GetViewFrame(), SID_DRAW_LINE); +aReq.SetModifier(KEY_MOD1); // Ctrl +pTabViewShell->ExecDraw(aReq); +pTabViewShell->SetDrawShell(false); + +// Get document and newly created object +ScDocument& rDoc = pDocSh->GetDocument(); +SdrObject* pObj =
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx | 37 --- sc/qa/unit/ucalc.cxx | 19 ++--- sc/source/core/data/column3.cxx | 28 +--- 3 files changed, 11 insertions(+), 73 deletions(-) New commits: commit 223f3a6fac43580114bca86abb34d7cf3219f4bc Author: Ilmari Lauhakangas AuthorDate: Sat Sep 4 20:29:28 2021 +0300 Commit: Ilmari Lauhakangas CommitDate: Mon Sep 6 13:48:18 2021 +0200 Revert "tdf#142214: autocomplete: do not search across empty blocks" This reverts commit ca2ec443893731093970914feb750b31ea13e47f. Breaks user experience. Removed ScTiledRenderingTest::testAutoInputStringBlock as well. Change-Id: Id03bc645d78c29c0aa588b2133fc1cb96f3cceb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121640 Tested-by: Jenkins Reviewed-by: Heiko Tietze Reviewed-by: Xisco Fauli Reviewed-by: Ilmari Lauhakangas diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index bc9259b9dc84..dc5813740167 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -114,7 +114,6 @@ public: void testSpellOnlineRenderParameter(); void testPasteIntoWrapTextCell(); void testSortAscendingDescending(); -void testAutoInputStringBlock(); void testAutoInputExactMatch(); void testMoveShapeHandle(); void testEditCursorBounds(); @@ -168,7 +167,6 @@ public: CPPUNIT_TEST(testSpellOnlineRenderParameter); CPPUNIT_TEST(testPasteIntoWrapTextCell); CPPUNIT_TEST(testSortAscendingDescending); -CPPUNIT_TEST(testAutoInputStringBlock); CPPUNIT_TEST(testAutoInputExactMatch); CPPUNIT_TEST(testMoveShapeHandle); CPPUNIT_TEST(testEditCursorBounds); @@ -2652,41 +2650,6 @@ void lcl_typeCharsInCell(const std::string& aStr, SCCOL nCol, SCROW nRow, ScTabV Scheduler::ProcessEventsToIdle(); } -void ScTiledRenderingTest::testAutoInputStringBlock() -{ -comphelper::LibreOfficeKit::setActive(); - -ScModelObj* pModelObj = createDoc("empty.ods"); -CPPUNIT_ASSERT(pModelObj); -ScTabViewShell* pView = dynamic_cast(SfxViewShell::Current()); -CPPUNIT_ASSERT(pView); -ScDocument* pDoc = pModelObj->GetDocument(); - -pDoc->SetString(ScAddress(0, 3, 0), "ABC"); // A4 -pDoc->SetString(ScAddress(0, 4, 0), "BAC"); // A5 -ScFieldEditEngine& rEE = pDoc->GetEditEngine(); -rEE.SetText("XYZ"); -pDoc->SetEditText(ScAddress(0, 5, 0), rEE.CreateTextObject()); // A6 -pDoc->SetValue(ScAddress(0, 6, 0), 123); -pDoc->SetString(ScAddress(0, 7, 0), "ZZZ"); // A8 - -ScAddress aA1(0, 0, 0); -lcl_typeCharsInCell("X", aA1.Col(), aA1.Row(), pView, pModelObj); // Type 'X' in A1 -CPPUNIT_ASSERT_EQUAL_MESSAGE("A1 should not autocomplete", OUString("X"), pDoc->GetString(aA1)); - -ScAddress aA3(0, 2, 0); // Adjacent to the string "superblock" A4:A8 -lcl_typeCharsInCell("X", aA3.Col(), aA3.Row(), pView, pModelObj); // Type 'X' in A3 -CPPUNIT_ASSERT_EQUAL_MESSAGE("A3 should autocomplete", OUString("XYZ"), pDoc->GetString(aA3)); - -ScAddress aA9(0, 8, 0); // Adjacent to the string "superblock" A4:A8 -lcl_typeCharsInCell("X", aA9.Col(), aA9.Row(), pView, pModelObj); // Type 'X' in A9 -CPPUNIT_ASSERT_EQUAL_MESSAGE("A9 should autocomplete", OUString("XYZ"), pDoc->GetString(aA9)); - -ScAddress aA11(0, 10, 0); -lcl_typeCharsInCell("X", aA11.Col(), aA11.Row(), pView, pModelObj); // Type 'X' in A11 -CPPUNIT_ASSERT_EQUAL_MESSAGE("A11 should not autocomplete", OUString("X"), pDoc->GetString(aA11)); -} - void ScTiledRenderingTest::testAutoInputExactMatch() { comphelper::LibreOfficeKit::setActive(); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 48ad56946d93..2655ee68428c 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -821,22 +821,14 @@ void Test::testDataEntries() m_pDoc->SetString(ScAddress(0,5,0), "Andy"); m_pDoc->SetString(ScAddress(0,6,0), "Bruce"); m_pDoc->SetString(ScAddress(0,7,0), "Charlie"); -m_pDoc->SetValue(ScAddress(0,8,0), 100); -m_pDoc->SetValue(ScAddress(0,9,0), 200); m_pDoc->SetString(ScAddress(0,10,0), "Andy"); -m_pDoc->SetValue(ScAddress(0,11,0), 1000); std::vector aEntries; -m_pDoc->GetDataEntries(0, 0, 0, aEntries); // Try at the top. -std::vector::const_iterator it = aEntries.begin(); -CPPUNIT_ASSERT_MESSAGE("The entries should be empty.", bool(it == aEntries.end())); - -aEntries.clear(); -m_pDoc->GetDataEntries(0, 4, 0, aEntries); // Try at A5. +m_pDoc->GetDataEntries(0, 0, 0, aEntries); // Try at the very top. // Entries are supposed to be sorted in ascending order, and are all unique. CPPUNIT_ASSERT_EQUAL(static_cast(3), aEntries.size()); -it = aEntries.begin(); +std::vector::const_iterator it = aEntries.begin();
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/autofilter/tdf36383.py | 59 sc/source/ui/view/viewfunc.cxx | 22 + 2 files changed, 2 insertions(+), 79 deletions(-) New commits: commit 9e7f07dc1378354a5228898e339f833641f3 Author: Xisco Fauli AuthorDate: Thu Sep 2 15:29:21 2021 +0200 Commit: Xisco Fauli CommitDate: Fri Sep 3 09:34:31 2021 +0200 tdf#144155: Revert "tdf#36383 sc AutoFilter: fix changing row height" This reverts commit 3678e0efcb8bedc58dd329a430da0ac3b1572df8. Conflicts: sc/qa/uitest/autofilter/tdf36383.py Change-Id: Ie1abd0cdea013571a27b187ffcb20125a0656442 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121512 Reviewed-by: László Németh Tested-by: Jenkins diff --git a/sc/qa/uitest/autofilter/tdf36383.py b/sc/qa/uitest/autofilter/tdf36383.py deleted file mode 100644 index df0ce88b84f6.. --- a/sc/qa/uitest/autofilter/tdf36383.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -from uitest.framework import UITestCase -from uitest.uihelper.calc import enter_text_to_cell -from libreoffice.uno.propertyvalue import mkPropertyValues -from libreoffice.calc.document import get_row - -#Bug 36383 - EDITING auto row height or change row height removes AutoFilter result - -class tdf36383(UITestCase): -def test_tdf36383_row_height(self): -with self.ui_test.create_doc_in_start_center("calc") as document: -calcDoc = self.xUITest.getTopFocusWindow() -gridwin = calcDoc.getChild("grid_window") - -enter_text_to_cell(gridwin, "A1", "A") -enter_text_to_cell(gridwin, "A2", "1") -enter_text_to_cell(gridwin, "A3", "2") -enter_text_to_cell(gridwin, "A4", "3") - -gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) - -self.xUITest.executeCommand(".uno:DataFilterAutoFilter") - -gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) -xFloatWindow = self.xUITest.getFloatWindow() -xCheckListMenu = xFloatWindow.getChild("check_list_menu") -xList = xCheckListMenu.getChild("check_list_box") -xEntry = xList.getChild("1") -xEntry.executeAction("CLICK", tuple()) - -xOkButton = xFloatWindow.getChild("ok") -xOkButton.executeAction("CLICK", tuple()) - -row = get_row(document, 2) -self.assertFalse(row.getPropertyValue("IsVisible")) - -#row height -with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: -xvalue = xDialog.getChild("value") -xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) -xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) -xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - - -self.assertFalse(row.getPropertyValue("IsVisible")) - -#optimal row height -with self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight"): -pass - -self.assertFalse(row.getPropertyValue("IsVisible")) - - -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index dec4209f75a7..9e091eeed8cc 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -2186,17 +2186,7 @@ void ScViewFunc::SetWidthOrHeight( aCxt.setExtraHeight(nSizeTwips); rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab, true); if (bAll) -{ -for (SCROW nRow = nStartNo; nRow <= nEndNo; ++nRow) -{ -SCROW nLastRow = nRow; -// tdf#36383 skip consecutive rows hidden by AutoFilter -if (rDoc.RowFiltered(nRow, nTab, nullptr, )) -nRow = nLastRow; -else -rDoc.ShowRow(nRow, nTab, true); -} -} +rDoc.ShowRows( nStartNo, nEndNo, nTab, true ); // Manual-Flag already (re)set in SetOptimalHeight in case of bAll=sal_True // (set for Extra-Height, else reset). @@ -2209,15 +2199,7 @@ void ScViewFunc::SetWidthOrHeight( rDoc.SetManualHeight( nStartNo, nEndNo, nTab, true ); // height was set manually } -for (SCROW nRow = nStartNo; nRow
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf142881.xlsx|binary sc/qa/unit/subsequent_export-test2.cxx | 37 + sc/source/filter/xcl97/xcl97rec.cxx|2 - 3 files changed, 38 insertions(+), 1 deletion(-) New commits: commit eae0636311d3a1b3a1af58a3e4df686b55afa3fa Author: Daniel Arato (NISZ) AuthorDate: Mon Aug 30 14:13:52 2021 +0200 Commit: László Németh CommitDate: Tue Aug 31 13:56:38 2021 +0200 tdf#142881 XLSX import: fix shapes rotated exactly 45°, 135°, 225° and 315° by correcting their cell anchor points, like MSO does. Previously the XLSX export with the bad anchor points messed up the rotation of the shapes, resulting also broken text content in LO and MSO. Thanks to Regina Henschel for analyzing the problem. Co-authored-by: Szabolcs Tóth Change-Id: Ica625545a22a74ed027ac0fa2bbf38804611c172 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121307 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/xlsx/tdf142881.xlsx b/sc/qa/unit/data/xlsx/tdf142881.xlsx new file mode 100644 index ..a25dfec68551 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf142881.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx index 36409864817b..a25babe59134 100644 --- a/sc/qa/unit/subsequent_export-test2.cxx +++ b/sc/qa/unit/subsequent_export-test2.cxx @@ -155,6 +155,7 @@ public: void testTdf115159(); void testTdf112567(); void testTdf122191(); +void testTdf142881(); void testTdf112567b(); void testTdf123645XLSX(); void testTdf125173XLSX(); @@ -261,6 +262,7 @@ public: CPPUNIT_TEST(testTdf115159); CPPUNIT_TEST(testTdf112567); CPPUNIT_TEST(testTdf122191); +CPPUNIT_TEST(testTdf142881); CPPUNIT_TEST(testTdf112567b); CPPUNIT_TEST(testTdf123645XLSX); CPPUNIT_TEST(testTdf125173XLSX); @@ -1407,6 +1409,41 @@ void ScExportTest2::testTdf122191() xDocSh->DoClose(); } +void ScExportTest2::testTdf142881() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf142881.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load tdf142881.xlsx", xDocSh.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocUniquePtr pDrawing1 += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); +CPPUNIT_ASSERT(pDrawing1); + +// Verify that the shapes are rotated and positioned in the expected way +assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:from/xdr:col", "11"); +assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:from/xdr:row", "0"); +assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:to/xdr:col", "12"); +assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:to/xdr:row", "19"); + +assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:from/xdr:col", "2"); +assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:from/xdr:row", "8"); +assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:to/xdr:col", "7"); +assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:to/xdr:row", "10"); + +assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[3]/xdr:from/xdr:col", "10"); +assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[3]/xdr:from/xdr:row", "9"); +assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[3]/xdr:to/xdr:col", "11"); +assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[3]/xdr:to/xdr:row", "26"); + +assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[4]/xdr:from/xdr:col", "2"); +assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[4]/xdr:from/xdr:row", "17"); +assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[4]/xdr:to/xdr:col", "8"); +assertXPathContent(pDrawing1, "/xdr:wsDr/xdr:twoCellAnchor[4]/xdr:to/xdr:row", "19"); + +xDocSh->DoClose(); +} + void ScExportTest2::testTdf112567b() { // Set the system locale to Hungarian (a language with different range separator) diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 3a05578f14e2..bdc3648d7584 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1120,7 +1120,7 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& // MSO changes the anchor positions at these angles and that does an extra 90 degrees // rotation on our shapes, so we output it in such position that MSO // can draw this shape correctly. -if ((nRotation >= 4500_deg100 && nRotation < 13500_deg100) || (nRotation >= 22500_deg100 && nRotation < 31500_deg100)) +if ((nRotation > 4500_deg100 && nRotation <= 13500_deg100) || (nRotation > 22500_deg100 &&
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/two-col-shape.ods |binary sc/qa/unit/helper/qahelper.cxx | 18 +--- sc/qa/unit/helper/qahelper.hxx |2 sc/qa/unit/subsequent_export-test2.cxx | 74 + sc/source/filter/xml/xmlexprt.cxx |7 ++- 5 files changed, 94 insertions(+), 7 deletions(-) New commits: commit cfa931784082d38bb6b98058c5acccbaf9870710 Author: Mike Kaganski AuthorDate: Tue Aug 24 19:40:34 2021 +0300 Commit: Mike Kaganski CommitDate: Wed Aug 25 19:19:43 2021 +0200 tdf#143929: chain XMLTextExportPropertySetMapper to sc's shape export This allows to export editengine columns to ODS. Alternatively, we could re-introduce chaining text attributes in XMLShapeExport ctor, which was commented out in commit d5b1e4827f8e6e0661563ec856cd80d926ba7b58 without explanation; but that would affect export from other modules as well (e.g., SdXMLExport::setSourceDocument sets up respective chaining in sd), so to be on the safe side, I do it only for ScXMLShapeExport. Change-Id: Iafee77b2b57e95031cfe1bbd2d43d7361a3e8469 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120958 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski diff --git a/sc/qa/unit/data/ods/two-col-shape.ods b/sc/qa/unit/data/ods/two-col-shape.ods new file mode 100644 index ..3829546b1c27 Binary files /dev/null and b/sc/qa/unit/data/ods/two-col-shape.ods differ diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 590250847d95..64c23cef7c36 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -629,20 +629,26 @@ ScDocShellRef ScBootstrapFixture::load( return load( false, rURL, rFilter, rUserData, rTypeName, nFilterFlags, nClipboardID, nFilterVersion, pPassword ); } -ScDocShellRef ScBootstrapFixture::loadDoc( -std::u16string_view rFileName, sal_Int32 nFormat, bool bReadWrite ) +ScDocShellRef ScBootstrapFixture::load(const OUString& rURL, sal_Int32 nFormat, bool bReadWrite) { -OUString aFileExtension(aFileFormats[nFormat].pName, strlen(aFileFormats[nFormat].pName), RTL_TEXTENCODING_UTF8 ); OUString aFilterName(aFileFormats[nFormat].pFilterName, strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ; -OUString aFileName; -createFileURL( rFileName, aFileExtension, aFileName ); OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8); SfxFilterFlags nFormatType = aFileFormats[nFormat].nFormatType; SotClipboardFormatId nClipboardId = SotClipboardFormatId::NONE; if (nFormatType != SfxFilterFlags::NONE) nClipboardId = SotClipboardFormatId::STARCALC_8; -return load(bReadWrite, aFileName, aFilterName, OUString(), aFilterType, nFormatType, nClipboardId, static_cast(nFormatType)); +return load(bReadWrite, rURL, aFilterName, OUString(), aFilterType, nFormatType, nClipboardId, static_cast(nFormatType)); +} + +ScDocShellRef ScBootstrapFixture::loadDoc( +std::u16string_view rFileName, sal_Int32 nFormat, bool bReadWrite ) +{ +OUString aFileExtension = OUString::fromUtf8(aFileFormats[nFormat].pName); +OUString aFileName; +createFileURL( rFileName, aFileExtension, aFileName ); + +return load(aFileName, nFormat, bReadWrite); } ScBootstrapFixture::ScBootstrapFixture( const OUString& rsBaseString ) : m_aBaseString( rsBaseString ) {} diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index ce981b5c9346..0435ef021651 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -199,6 +199,8 @@ protected: const OUString& rTypeName, SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID, sal_uIntPtr nFilterVersion = SOFFICE_FILEFORMAT_CURRENT, const OUString* pPassword = nullptr ); +ScDocShellRef load(const OUString& rURL, sal_Int32 nFormat, bool bReadWrite = false); + ScDocShellRef loadDoc( std::u16string_view rFileName, sal_Int32 nFormat, bool bReadWrite = false ); diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx index 7b8d294b8ca3..217b9fb2795e 100644 --- a/sc/qa/unit/subsequent_export-test2.cxx +++ b/sc/qa/unit/subsequent_export-test2.cxx @@ -83,6 +83,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -202,6 +203,7 @@ public: void testInvalidNamedRange(); void testTdf143220XLSX(); void testTdf142264ManyChartsToXLSX(); +void testTdf143929MultiColumnToODS(); CPPUNIT_TEST_SUITE(ScExportTest2); @@ -306,6 +308,7 @@ public: CPPUNIT_TEST(testInvalidNamedRange); CPPUNIT_TEST(testTdf143220XLSX); CPPUNIT_TEST(testTdf142264ManyChartsToXLSX); +CPPUNIT_TEST(testTdf143929MultiColumnToODS); CPPUNIT_TEST_SUITE_END(); @@ -2564,6 +2567,77 @@ void
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/many_charts.ods|binary sc/qa/unit/subsequent_export-test2.cxx | 90 - sc/source/filter/excel/xeescher.cxx| 16 +++-- sc/source/filter/inc/xeescher.hxx |3 - 4 files changed, 99 insertions(+), 10 deletions(-) New commits: commit 420e834007ca654db9803030726edb32c3ba5710 Author: Mike Kaganski AuthorDate: Wed Aug 18 23:13:05 2021 +0300 Commit: Mike Kaganski CommitDate: Thu Aug 19 06:41:04 2021 +0200 tdf#142264: make sure to load potentially unloaded objects when saving Commit 574eec9036c5f185b3572ba1e0ca9d111eb361dc happened to reveal a pre-existing problem that XLSX export only saved those OLE objects that were kept loaded in the OLE object cache, subject to thevalue of org.openoffice.Office.Common/Cache/DrawingEngine/OLE_Objects. Before that change, the imported charts were marked modified on load, and that prevented them from unloading in OLEObjCache::UnloadCheckHdl, because SdrOle2Obj::CanUnloadRunningObj returned false. After the mentioned change, the charts started to load without the wrong "modified" state, which allowed them to be properly managed by the cache, and the export filter implementation error surfaced. It's likely that commit 692878e3bb83c0fc104c5cca946c25ccf2d84ab2 tried to workaround the same underlying problem for charts that for some reason / at some point in time didn't get marked modified on load, and that commit converted an error shown in Excel into silently missing charts. This change makes sure that whenever a reference to chart document is requested from XclExpChartObj, it is actually loaded and ready for reading data. Possibly something could be done on the level of old reference that becomes non-functional (although valid) as the result of unloading, so that it would automatically reload on following use. That would make operating on the references robust. I didn't find an obvious way to do that. It is interesting to investigate, it the heizenbug related to images disappearing from documents, as users keep reporting without robust reproducers, might possibly be caused by a similar problem. Change-Id: I45fcdc98254157d805c7519340b5265526f27166 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120688 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/qa/unit/data/ods/many_charts.ods b/sc/qa/unit/data/ods/many_charts.ods new file mode 100644 index ..31acdf66e1ed Binary files /dev/null and b/sc/qa/unit/data/ods/many_charts.ods differ diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx index 05f102cd1f38..7b8d294b8ca3 100644 --- a/sc/qa/unit/subsequent_export-test2.cxx +++ b/sc/qa/unit/subsequent_export-test2.cxx @@ -73,7 +73,12 @@ #include #include -#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -196,6 +201,7 @@ public: void testTdf142929_filterLessThanXLSX(); void testInvalidNamedRange(); void testTdf143220XLSX(); +void testTdf142264ManyChartsToXLSX(); CPPUNIT_TEST_SUITE(ScExportTest2); @@ -299,6 +305,7 @@ public: CPPUNIT_TEST(testTdf142929_filterLessThanXLSX); CPPUNIT_TEST(testInvalidNamedRange); CPPUNIT_TEST(testTdf143220XLSX); +CPPUNIT_TEST(testTdf142264ManyChartsToXLSX); CPPUNIT_TEST_SUITE_END(); @@ -2476,6 +2483,87 @@ void ScExportTest2::testTdf143220XLSX() xDocSh->DoClose(); } +void ScExportTest2::testTdf142264ManyChartsToXLSX() +{ +// The cache size for the test should be small enough, to make sure that some charts get +// unloaded in the process, and then loaded on demand properly (default is currently 20) +CPPUNIT_ASSERT_LESS(sal_Int32(40), + officecfg::Office::Common::Cache::DrawingEngine::OLE_Objects::get()); + +ScDocShellRef xDocSh = loadDoc(u"many_charts.", FORMAT_ODS); +CPPUNIT_ASSERT(xDocSh.is()); +xDocSh = saveAndReload(xDocSh.get(), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +auto xModel = xDocSh->GetModel(); +css::uno::Reference xSupplier(xModel, + css::uno::UNO_QUERY_THROW); +auto xDrawPages = xSupplier->getDrawPages(); + +// No charts (or other objects) on the first sheet, and resp. first draw page +css::uno::Reference xPage(xDrawPages->getByIndex(0), + css::uno::UNO_QUERY_THROW); +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xPage->getCount()); + +// 20 charts on the second sheet, and resp. second draw page +xPage.set(xDrawPages->getByIndex(1), css::uno::UNO_QUERY_THROW); +// Without the fix in place, this test would have failed with +// - Expected: 20 +// - Actual : 0 +// Because only the last 20 charts
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx |4 - sc/source/filter/oox/richstring.cxx | 112 +- 2 files changed, 113 insertions(+), 3 deletions(-) New commits: commit 2d5ba784a341aea1b7b2403842d2521d1548ea8f Author: Dennis Francis AuthorDate: Tue Aug 17 14:38:21 2021 +0530 Commit: Andras Timar CommitDate: Wed Aug 18 20:28:28 2021 +0200 tdf#118470: sc oox: recover escaped unicode chars in strings import according to OOX open spec 2.1.1742 Part 1 Section 22.9.2.19, ST_Xstring (Escaped String). In this implementation, some restrictions mentioned in this spec are not kept for simplicity. Change-Id: If27797a9625d49be54c600c8a864965f1101ceb1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120665 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 31c0aae3dd71..e1d3f78bb93b 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -3672,9 +3672,9 @@ void ScExportTest::testTdf80149() CPPUNIT_ASSERT_EQUAL(OUString("row 1"), rDoc.GetString(0, 0, 0)); // Without the fix in place, this test would have failed with -// - Expected: Character 0x16 is here ->>_x0016_<<-- +// - Expected: Character 0x16 is here ->><<-- // - Actual : -CPPUNIT_ASSERT_EQUAL(OUString("Character 0x16 is here ->>_x0016_<<--"), rDoc.GetString(1, 0, 0)); +CPPUNIT_ASSERT_EQUAL(OUString("Character 0x16 is here ->><<--"), rDoc.GetString(1, 0, 0)); CPPUNIT_ASSERT_EQUAL(OUString("File opens in libre office, but can't be saved as xlsx"), rDoc.GetString(2, 0, 0)); CPPUNIT_ASSERT_EQUAL(OUString("row 2"), rDoc.GetString(0, 1, 0)); CPPUNIT_ASSERT_EQUAL(OUString("Subsequent rows get truncated"), rDoc.GetString(1, 1, 0)); diff --git a/sc/source/filter/oox/richstring.cxx b/sc/source/filter/oox/richstring.cxx index a9d058f75ba5..7f8809824caa 100644 --- a/sc/source/filter/oox/richstring.cxx +++ b/sc/source/filter/oox/richstring.cxx @@ -48,6 +48,116 @@ bool lclNeedsRichTextFormat( const oox::xls::Font* pFont ) return pFont && pFont->needsRichTextFormat(); } +sal_Int32 lcl_getHexLetterValue(sal_Unicode nCode) +{ +if (nCode >= '0' && nCode <= '9') +return nCode - '0'; + +if (nCode >= 'A' && nCode <= 'F') +return nCode - 'A' + 10; + +if (nCode >= 'a' && nCode <= 'f') +return nCode - 'a' + 10; + +return -1; +} + +bool lcl_validEscape(sal_Unicode nCode) +{ +// Valid XML chars that can be escaped (ignoring the restrictions) as in the OOX open spec +// 2.1.1742 Part 1 Section 22.9.2.19, ST_Xstring (Escaped String) +if (nCode == 0x000D || nCode == 0x000A || nCode == 0x0009 || nCode == 0x005F) +return true; + +// Other valid XML chars in basic multilingual plane that cannot be escaped. +if ((nCode >= 0x0020 && nCode <= 0xD7FF) || (nCode >= 0xE000 && nCode <= 0xFFFD)) +return false; + +return true; +} + +OUString lcl_unEscapeUnicodeChars(const OUString& rSrc) +{ +// Example: Escaped representation of unicode char 0x000D is _x000D_ + +sal_Int32 nLen = rSrc.getLength(); +if (!nLen) +return rSrc; + +sal_Int32 nStart = 0; +bool bFound = true; +const OUString aPrefix = "_x"; +sal_Int32 nPrefixStart = rSrc.indexOf(aPrefix, nStart); + +if (nPrefixStart == -1) +return rSrc; + +OUStringBuffer aBuf(rSrc); +sal_Int32 nOffset = 0; // index offset in aBuf w.r.t rSrc. + +do +{ +sal_Int32 nEnd = -1; +sal_Unicode nCode = 0; +bool bFoundThis = false; +for (sal_Int32 nIdx = 0; nIdx < 5; ++nIdx) +{ +sal_Int32 nThisIdx = nPrefixStart + nIdx + 2; +if (nThisIdx >= nLen) +break; + +sal_Unicode nThisCode = rSrc[nThisIdx]; +sal_Int32 nLetter = lcl_getHexLetterValue(nThisCode); + +if (!nIdx && nLetter < 0) +break; + +if (nLetter >= 0) +{ +nCode = (nCode << 4) + static_cast(nLetter); +} +else if (nThisCode == '_') +{ +nEnd = nThisIdx + 1; +bFoundThis = true; +break; +} +else +{ +break; +} +} + +if (bFoundThis) +{ +// nEnd is already set inside the inner loop in this case. +if (lcl_validEscape(nCode)) +{ +bFound = true; +sal_Int32 nEscStrLen = nEnd - nPrefixStart; +aBuf.remove(nPrefixStart - nOffset, nEscStrLen); +aBuf.insert(nPrefixStart - nOffset, nCode); + +nOffset += nEscStrLen - 1; +} +} +else +{ +// Start the next search just after last "_x" +nEnd =
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf143619_validationCirclePos.ods |binary sc/qa/unit/scshapetest.cxx| 34 ++ sc/source/core/data/drwlayer.cxx |7 +++ 3 files changed, 41 insertions(+) New commits: commit 0cff1aa48453ee0c05bafcac5360329fb6bf9557 Author: Regina Henschel AuthorDate: Fri Jul 30 23:18:39 2021 +0200 Commit: Regina Henschel CommitDate: Mon Aug 2 19:22:10 2021 +0200 tdf#143619 validation circle anchor is special For usual drawing objects, maStart in its Calc user data means the cell address of left/top of snapRect/logicRect. For validation circle it means 'address of cell to be validated'. Thus corrections might be needed, if a general method is used for validation circle. Here the method SetLogicRect() calls via broadcast ScDrawLayer::SetCellAnchoredFromPosition(), which calculates maStart from snapRect/logicRect. Because the circle is extended to cover a larger area than the to be validated cell, maStart got the cell address of the cell one left and one above of the to be validated cell. Now the old, correct address is backuped and restored. Change-Id: I9646da3f22fef45a6e47e59ef55a70307e2f9cc6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119715 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/sc/qa/unit/data/ods/tdf143619_validationCirclePos.ods b/sc/qa/unit/data/ods/tdf143619_validationCirclePos.ods new file mode 100644 index ..6470d6a1f430 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf143619_validationCirclePos.ods differ diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx index fad81ddd0e6b..c178c28578a6 100644 --- a/sc/qa/unit/scshapetest.cxx +++ b/sc/qa/unit/scshapetest.cxx @@ -46,6 +46,7 @@ public: ScShapeTest(); void saveAndReload(css::uno::Reference& xComponent, const OUString& rFilter); +void testTdf143619_validation_circle_pos(); void testTdf140252_DragCreateFormControl(); void testTdf134355_DragCreateCustomShape(); void testTdf140252_LayerOfControl(); @@ -72,6 +73,7 @@ public: void testCustomShapeCellAnchoredRotatedShape(); CPPUNIT_TEST_SUITE(ScShapeTest); +CPPUNIT_TEST(testTdf143619_validation_circle_pos); CPPUNIT_TEST(testTdf140252_DragCreateFormControl); CPPUNIT_TEST(testTdf134355_DragCreateCustomShape); CPPUNIT_TEST(testTdf140252_LayerOfControl); @@ -204,6 +206,38 @@ static SdrObject* lcl_getSdrObjectWithAssert(ScDocument& rDoc, sal_uInt16 nObjNu return pObj; } +void ScShapeTest::testTdf143619_validation_circle_pos() +{ +// Load a document, which has validation circle around cell E6. + +OUString aFileURL; +createFileURL(u"tdf143619_validationCirclePos.ods", aFileURL); +uno::Reference xComponent = loadFromDesktop(aFileURL); + +// Get document +ScDocShell* pDocSh = lcl_getScDocShellWithAssert(xComponent); +ScDocument& rDoc = pDocSh->GetDocument(); + +// Get shape. That is the validation circle. +SdrObject* pObj = lcl_getSdrObjectWithAssert(rDoc, 0); + +// Error was, that deleting row and col before E6 does not move circle to D5, but to B3. +// Delete first row and first column. +uno::Sequence aPropertyValues = { +comphelper::makePropertyValue("ToPoint", OUString("$A$1")), +}; +dispatchCommand(xComponent, ".uno:GoToCell", aPropertyValues); +dispatchCommand(xComponent, ".uno:DeleteRows", {}); +dispatchCommand(xComponent, ".uno:GoToCell", aPropertyValues); +dispatchCommand(xComponent, ".uno:DeleteColumns", {}); + +// Without fix in place the position was (2007, 833) +Point aPos = pObj->GetSnapRect().TopLeft(); +lcl_AssertPointEqualWithTolerance("after row and col delete", Point(6523, 1736), aPos, 1); + +pDocSh->DoClose(); +} + void ScShapeTest::testTdf140252_DragCreateFormControl() { // Error was, that drag-created form controls were initially not on layer 'controls' and thus diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 1174cb656019..79b52627e015 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -1049,6 +1049,7 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati // Validation circle for detective. rData.setShapeRect(GetDocument(), pObj->GetLogicRect()); +// rData.maStart should contain the address of the be validated cell. tools::Rectangle aRect = GetCellRect(*GetDocument(), rData.maStart, true); aRect.AdjustLeft( -250 ); aRect.AdjustRight(250 ); @@ -1062,7 +1063,13 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati if (bRecording) AddCalcUndo( std::make_unique( *pObj ) ); rData.setShapeRect(GetDocument(), lcl_makeSafeRectangle(aRect)); +
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/extras/scpdfexport.cxx| 19 sc/qa/extras/testdocuments/tdf64703_hiddenPageBreak.ods |binary sc/source/ui/view/printfun.cxx |6 +++-- 3 files changed, 23 insertions(+), 2 deletions(-) New commits: commit 8b2a2de2481843502f0566e773ed11532520bc70 Author: Attila Szűcs AuthorDate: Thu Jul 15 15:50:09 2021 +0200 Commit: László Németh CommitDate: Fri Jul 30 16:30:52 2021 +0200 tdf#64703 sc: fix regression of printing page breaks After hidden rows or rows hidden by Autofilter, printing removed the page breaks between the visible rows, too. Now Calc supports WYSWYG: it prints all the visible page breaks, which includes the page breaks between the visible rows, and page breaks between the hidden rows (multiple page breaks of a hidden row sequence converted to a single page break). This was a regression since LO 3.6, introducing Autofilter with multichoice. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I87858d36fc62b8a5952cfd5bc39dbe90f1452ac0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118984 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx index 6dfa426fddc0..825c4e248403 100644 --- a/sc/qa/extras/scpdfexport.cxx +++ b/sc/qa/extras/scpdfexport.cxx @@ -65,11 +65,13 @@ public: void testExportRange_Tdf120161(); void testExportFitToPage_Tdf103516(); void testUnoCommands_Tdf120161(); +void testTdf64703_hiddenPageBreak(); CPPUNIT_TEST_SUITE(ScPDFExportTest); CPPUNIT_TEST(testExportRange_Tdf120161); CPPUNIT_TEST(testExportFitToPage_Tdf103516); CPPUNIT_TEST(testUnoCommands_Tdf120161); +CPPUNIT_TEST(testTdf64703_hiddenPageBreak); CPPUNIT_TEST_SUITE_END(); }; @@ -437,6 +439,23 @@ void ScPDFExportTest::testUnoCommands_Tdf120161() } } +void ScPDFExportTest::testTdf64703_hiddenPageBreak() +{ +mxComponent = loadFromDesktop(m_directories.getURLFromSrc(DATA_DIRECTORY) + + "tdf64703_hiddenPageBreak.ods", + "com.sun.star.sheet.SpreadsheetDocument"); +uno::Reference xModel(mxComponent, uno::UNO_QUERY); + +// A1:A11: 4-page export +{ +ScRange range1(0, 0, 0, 0, 10, 0); +std::shared_ptr pPDFFile = exportToPDF(xModel, range1); +bool bFound = false; +CPPUNIT_ASSERT(hasTextInPdf(pPDFFile, "/Count 4>>", bFound)); +CPPUNIT_ASSERT_EQUAL(true, bFound); +} +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScPDFExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/qa/extras/testdocuments/tdf64703_hiddenPageBreak.ods b/sc/qa/extras/testdocuments/tdf64703_hiddenPageBreak.ods new file mode 100644 index ..87f110915d69 Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf64703_hiddenPageBreak.ods differ diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index e02e4badcab6..0fc79a76b397 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -3197,8 +3197,10 @@ void PrintPageRanges::calculate(ScDocument& rDoc, nLastVisibleRow = nLastRow; } else -// skip all hidden rows. -nRow = nLastRow; +{ +// Skip all hidden rows until next pagebreak. +nRow = std::min(nLastRow, nNextPageBreak - 1); +} } if (!bVisRow)
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf143220.ods |binary sc/qa/unit/subsequent_export-test2.cxx | 15 +++ sc/source/filter/excel/xecontent.cxx |8 +--- 3 files changed, 20 insertions(+), 3 deletions(-) New commits: commit 3c3b9ad8886da916027f0fb940a2df822d63d4d7 Author: Tünde Tóth AuthorDate: Wed Jul 14 14:57:00 2021 +0200 Commit: László Németh CommitDate: Mon Jul 26 13:54:57 2021 +0200 tdf#143220 XLSX export: fix hyperlink to sheet target Hyperlink to another sheet didn't work in Excel. Change-Id: Ic63e581d5de8f7ff1eac50a5e56a51d7ba2e72ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118935 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/ods/tdf143220.ods b/sc/qa/unit/data/ods/tdf143220.ods new file mode 100644 index ..6aa1536eae8e Binary files /dev/null and b/sc/qa/unit/data/ods/tdf143220.ods differ diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx index 030e4a4ae7df..6ee07223a824 100644 --- a/sc/qa/unit/subsequent_export-test2.cxx +++ b/sc/qa/unit/subsequent_export-test2.cxx @@ -194,6 +194,7 @@ public: void testButtonFormControlXlsxExport(); void testTdf142929_filterLessThanXLSX(); void testInvalidNamedRange(); +void testTdf143220XLSX(); CPPUNIT_TEST_SUITE(ScExportTest2); @@ -296,6 +297,7 @@ public: CPPUNIT_TEST(testButtonFormControlXlsxExport); CPPUNIT_TEST(testTdf142929_filterLessThanXLSX); CPPUNIT_TEST(testInvalidNamedRange); +CPPUNIT_TEST(testTdf143220XLSX); CPPUNIT_TEST_SUITE_END(); @@ -2460,6 +2462,19 @@ void ScExportTest2::testInvalidNamedRange() CPPUNIT_ASSERT(!xNamedRanges->hasByName("myname")); } +void ScExportTest2::testTdf143220XLSX() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf143220.", FORMAT_ODS); +CPPUNIT_ASSERT(xDocSh.is()); + +xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, + "xl/worksheets/sheet1.xml", FORMAT_XLSX); +CPPUNIT_ASSERT(pDoc); +assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "location", "Sheet2!A1"); + +xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 0848745b8d4a..0a7a3baeb953 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -428,15 +428,17 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU aTextMark = aTextMark.replaceAt( nSepPos, 1, "!" ); } -if(nSepPos != -1) +if (nSepPos != -1) { -OUString aSheetName( aTextMark.copy(0, nSepPos)); +OUString aSheetName(aTextMark.copy(0, nSepPos)); -if ( aSheetName.indexOf(' ') != -1 && aSheetName[0] != '\'') +if (aSheetName.indexOf(' ') != -1 && aSheetName[0] != '\'') { aTextMark = "'" + aTextMark.replaceAt(nSepPos, 0, "'"); } } +else +aTextMark += "!A1";// tdf#143220 link to sheet not valid without cell reference mxTextMark.reset( new XclExpString( aTextMark, XclStrFlags::ForceUnicode, 255 ) ); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/calc_tests9/tdf126541_GridVisibilityImportXlsx.py | 26 ++ sc/qa/uitest/data/tdf126541_GridOff.xlsx |binary sc/qa/uitest/data/tdf126541_GridOffGlobally.ods|binary sc/qa/unit/subsequent_export-test2.cxx | 14 +++-- sc/source/filter/oox/viewsettings.cxx | 18 ++ 5 files changed, 51 insertions(+), 7 deletions(-) New commits: commit ad4e6f8c8f3d9d96586967f8e9a813bf29c3033a Author: Attila Szűcs AuthorDate: Thu Jul 8 08:45:00 2021 +0200 Commit: László Németh CommitDate: Wed Jul 21 11:35:53 2021 +0200 tdf#142854 XLSX import: fix grid visibility in headless mode Fix regression from commit 759103fd65f82fc131679eba0de05f2ddc7294c8 (tdf#126541 XLSX import: fix View grid lines). Sheet based grid visibility shouldn't overwrite the global grid visibility, except for headless mode (i.e. for command line batch mode, see --convert-to in ./soffice --help, otherwise we could get a regression here: The sheet based grid visibility (bShowGrid) is stored in view settings. Headless mode means not to export view setting, including sheet based grid visibility. As the old workaround, use global visibility to keep the losing sheet visibility. FIXME: headless mode only works correctly if all sheets have the same grid visibility. The sheet based bShowGrid should be moved to another location, which is supported by the headless mode, too. Note: now the modified tdf#126541 unit test checks the fix for the regression of the headless mode, and the new Python UI test checks the (now improved) fix for tdf#126541 on the desktop. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I93551d22cc5d858dc64f93a46cd8aa202b4b2df5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118599 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/uitest/calc_tests9/tdf126541_GridVisibilityImportXlsx.py b/sc/qa/uitest/calc_tests9/tdf126541_GridVisibilityImportXlsx.py new file mode 100644 index ..a5acb2fbf39b --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf126541_GridVisibilityImportXlsx.py @@ -0,0 +1,26 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +class tdf126541(UITestCase): + +def test_tdf126541_GridVisibilityImportXlsx(self): +# Import an ods file with 'Hide' global grid visibility setting. +with self.ui_test.load_file(get_url_for_data_file("tdf126541_GridOffGlobally.ods")) as document: +controller = document.getCurrentController() +grid = controller.ShowGrid +self.assertEqual(grid, False) + +# Importing xlsx file should set the global grid visibility setting to 'Show' +# Sheet based grid line visibility setting should not overwrite the global setting. +with self.ui_test.load_file(get_url_for_data_file("tdf126541_GridOff.xlsx")) as document: +controller = document.getCurrentController() +grid = controller.ShowGrid +self.assertEqual(grid, True) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/tdf126541_GridOff.xlsx b/sc/qa/uitest/data/tdf126541_GridOff.xlsx new file mode 100644 index ..e27089b01603 Binary files /dev/null and b/sc/qa/uitest/data/tdf126541_GridOff.xlsx differ diff --git a/sc/qa/uitest/data/tdf126541_GridOffGlobally.ods b/sc/qa/uitest/data/tdf126541_GridOffGlobally.ods new file mode 100644 index ..389fe347d493 Binary files /dev/null and b/sc/qa/uitest/data/tdf126541_GridOffGlobally.ods differ diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx index 4eab1c9bf1e9..030e4a4ae7df 100644 --- a/sc/qa/unit/subsequent_export-test2.cxx +++ b/sc/qa/unit/subsequent_export-test2.cxx @@ -188,7 +188,7 @@ public: void testTdf84874(); void testTdf136721_paper_size(); void testTdf139258_rotated_image(); -void testTdf126541_SheetVisibilityImportXlsx(); +void testTdf142854_GridVisibilityImportXlsxInHeadlessMode(); void testTdf140431(); void testCheckboxFormControlXlsxExport(); void testButtonFormControlXlsxExport(); @@ -290,7 +290,7 @@ public: CPPUNIT_TEST(testTdf84874); CPPUNIT_TEST(testTdf136721_paper_size); CPPUNIT_TEST(testTdf139258_rotated_image); -CPPUNIT_TEST(testTdf126541_SheetVisibilityImportXlsx); +CPPUNIT_TEST(testTdf142854_GridVisibilityImportXlsxInHeadlessMode); CPPUNIT_TEST(testTdf140431); CPPUNIT_TEST(testCheckboxFormControlXlsxExport);
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/autofilter/tdf46184.py | 84 sc/source/ui/view/gridwin.cxx | 35 ++- 2 files changed, 109 insertions(+), 10 deletions(-) New commits: commit d824db8ee208cff8029752ca753815be8ca2fff4 Author: Tünde Tóth AuthorDate: Thu Jul 8 10:04:53 2021 +0200 Commit: László Németh CommitDate: Tue Jul 20 15:15:28 2021 +0200 tdf#46184 sc AutoFilter: reset filter options to default values when the old filter entries are removed in auto-filter rules, because these options are not visible from the AutoFilter. E.g. now using AutoFilter doesn't apply copying of the previous standard filtering, changing also the active sheet etc. This fixes regression from LibreOffice 3.5 or more. Change-Id: I26b272dc738f3918ff5b2ca7e8fee3481d21460a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118603 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/uitest/autofilter/tdf46184.py b/sc/qa/uitest/autofilter/tdf46184.py new file mode 100755 index ..08dfc520b640 --- /dev/null +++ b/sc/qa/uitest/autofilter/tdf46184.py @@ -0,0 +1,84 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import select_by_text, get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_row + +#Bug 46184 - [Calc] [AutoFilter] Option "Copy results to ..." remains activated in AutoFilter + +class tdf46184(UITestCase): +def test_tdf46184_copy_results_to(self): +with self.ui_test.create_doc_in_start_center("calc") as document: +calcDoc = self.xUITest.getTopFocusWindow() +gridwin = calcDoc.getChild("grid_window") + +enter_text_to_cell(gridwin, "A1", "A") +enter_text_to_cell(gridwin, "A2", "1") +enter_text_to_cell(gridwin, "A3", "2") +enter_text_to_cell(gridwin, "A4", "3") + +gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + +self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + +gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +#Choose Standard Filter... button +xMenu = xFloatWindow.getChild("menu") +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +self.assertEqual("Standard Filter...", get_state_as_dict(xMenu)['SelectEntryText']) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + +xDialog = self.xUITest.getTopFocusWindow() +xfield1 = xDialog.getChild("field1") +xcond1 = xDialog.getChild("cond1") +xval1 = xDialog.getChild("val1") +xcopyresult = xDialog.getChild("copyresult") +xedcopyarea = xDialog.getChild("edcopyarea") +xdestpers = xDialog.getChild("destpers") + +select_by_text(xfield1, "A") +select_by_text(xcond1, ">") +xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) +xcopyresult.executeAction("CLICK", tuple()) +xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"A6"})) +if get_state_as_dict(xdestpers)['Selected'] == 'false': +xdestpers.executeAction("CLICK", tuple()) +self.assertEqual('true', get_state_as_dict(xcopyresult)['Selected']) +xOKBtn = xDialog.getChild("ok") +self.ui_test.close_dialog_through_button(xOKBtn) + + +row1 = get_row(document, 1) +row2 = get_row(document, 2) +row3 = get_row(document, 3) +self.assertTrue(row1.getPropertyValue("IsVisible")) +self.assertTrue(row2.getPropertyValue("IsVisible")) +self.assertTrue(row3.getPropertyValue("IsVisible")) + +gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu =
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf142929.xlsx |binary sc/qa/unit/subsequent_export-test2.cxx| 17 + sc/source/filter/oox/autofilterbuffer.cxx |2 +- 3 files changed, 18 insertions(+), 1 deletion(-) New commits: commit 0d3398e5d141b79706653c04f1ab6dc9381a5cc1 Author: Tünde Tóth AuthorDate: Thu Jul 1 13:40:03 2021 +0200 Commit: László Németh CommitDate: Tue Jul 13 18:40:56 2021 +0200 tdf#142929 XLSX: fix import of "Less than" filter condition "Less than" standard filter condition became <> instead of <. Change-Id: I53435590de3a03d9fcaf0359e8421ae3ef941316 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118227 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/xlsx/tdf142929.xlsx b/sc/qa/unit/data/xlsx/tdf142929.xlsx new file mode 100644 index ..6bf23b951360 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf142929.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx index 0a0a7cff9f8c..4eab1c9bf1e9 100644 --- a/sc/qa/unit/subsequent_export-test2.cxx +++ b/sc/qa/unit/subsequent_export-test2.cxx @@ -192,6 +192,7 @@ public: void testTdf140431(); void testCheckboxFormControlXlsxExport(); void testButtonFormControlXlsxExport(); +void testTdf142929_filterLessThanXLSX(); void testInvalidNamedRange(); CPPUNIT_TEST_SUITE(ScExportTest2); @@ -293,6 +294,7 @@ public: CPPUNIT_TEST(testTdf140431); CPPUNIT_TEST(testCheckboxFormControlXlsxExport); CPPUNIT_TEST(testButtonFormControlXlsxExport); +CPPUNIT_TEST(testTdf142929_filterLessThanXLSX); CPPUNIT_TEST(testInvalidNamedRange); CPPUNIT_TEST_SUITE_END(); @@ -2424,6 +2426,21 @@ void ScExportTest2::testButtonFormControlXlsxExport() assertXPathNoAttribute(pDoc, "//x:controlPr", "macro"); } +void ScExportTest2::testTdf142929_filterLessThanXLSX() +{ +// Document contains a standard filter with '<' condition. +ScDocShellRef xDocSh = loadDoc(u"tdf142929.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, + "xl/worksheets/sheet1.xml", FORMAT_XLSX); +CPPUNIT_ASSERT(pDoc); +assertXPath(pDoc, "//x:customFilters/x:customFilter", "val", "2"); +assertXPath(pDoc, "//x:customFilters/x:customFilter", "operator", "lessThan"); + +xDocSh->DoClose(); +} + void ScExportTest2::testInvalidNamedRange() { // Given a document which has a named range (myname) that refers to the "1" external link, but diff --git a/sc/source/filter/oox/autofilterbuffer.cxx b/sc/source/filter/oox/autofilterbuffer.cxx index 8eb24f231bd4..ab0ff9a43c68 100644 --- a/sc/source/filter/oox/autofilterbuffer.cxx +++ b/sc/source/filter/oox/autofilterbuffer.cxx @@ -77,7 +77,7 @@ bool lclGetApiOperatorFromToken( sal_Int32& rnApiOperator, sal_Int32 nToken ) { switch( nToken ) { -case XML_lessThan: rnApiOperator = FilterOperator2::NOT_EQUAL; return true; +case XML_lessThan: rnApiOperator = FilterOperator2::LESS; return true; case XML_equal: rnApiOperator = FilterOperator2::EQUAL; return true; case XML_lessThanOrEqual: rnApiOperator = FilterOperator2::LESS_EQUAL;return true; case XML_greaterThan: rnApiOperator = FilterOperator2::GREATER; return true; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf143068_top10filter.xlsx |binary sc/qa/unit/subsequent_export-test2.cxx | 16 sc/source/filter/excel/excrecds.cxx | 16 +--- 3 files changed, 25 insertions(+), 7 deletions(-) New commits: commit d79de2a2975db6b34f47b7ccfe8d18692373d6f0 Author: Tünde Tóth AuthorDate: Fri Jul 2 14:19:16 2021 +0200 Commit: László Németh CommitDate: Tue Jul 13 18:23:43 2021 +0200 tdf#143068 XLSX: fix export of top10 filter condition Top10 filter condition lost after XLSX export. Change-Id: I5f9974e7d73f9ada84e284790c2928547f9ec7e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118291 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/xlsx/tdf143068_top10filter.xlsx b/sc/qa/unit/data/xlsx/tdf143068_top10filter.xlsx new file mode 100644 index ..8626e74e60dc Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf143068_top10filter.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx index e222c202e885..0a0a7cff9f8c 100644 --- a/sc/qa/unit/subsequent_export-test2.cxx +++ b/sc/qa/unit/subsequent_export-test2.cxx @@ -113,6 +113,7 @@ public: void testAutofilterColorsODF(); void testAutofilterColorsOOXML(); void testAutofilterColorsStyleOOXML(); +void testAutofilterTop10XLSX(); void testRefStringXLSX(); void testRefStringConfigXLSX(); @@ -213,6 +214,7 @@ public: CPPUNIT_TEST(testAutofilterColorsODF); CPPUNIT_TEST(testAutofilterColorsOOXML); CPPUNIT_TEST(testAutofilterColorsStyleOOXML); +CPPUNIT_TEST(testAutofilterTop10XLSX); CPPUNIT_TEST(testRefStringXLSX); CPPUNIT_TEST(testRefStringConfigXLSX); @@ -740,6 +742,20 @@ void ScExportTest2::testAutofilterColorsStyleOOXML() "D7D7"); } +void ScExportTest2::testAutofilterTop10XLSX() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf143068_top10filter.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, + "xl/worksheets/sheet1.xml", FORMAT_XLSX); +CPPUNIT_ASSERT(pDoc); +assertXPath(pDoc, "//x:autoFilter/x:filterColumn", "colId", "0"); +assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:top10", "val", "4"); + +xDocSh->DoClose(); +} + void ScExportTest2::testTdf88657ODS() { ScDocShellRef xDocSh = loadDoc(u"tdf88657.", FORMAT_ODS); diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 8c66caebdea5..8ce820bb2389 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -809,7 +809,7 @@ void XclExpAutofilter::WriteBody( XclExpStream& rStrm ) void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm ) { -if (meType == FilterCondition && !HasCondition()) +if (meType == FilterCondition && !HasCondition() && !HasTop10()) return; sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); @@ -833,12 +833,14 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm ) // OOXTODO: XML_filterVal ); } - -rWorksheet->startElement( XML_customFilters, -XML_and, ToPsz((nFlags & EXC_AFFLAG_ANDORMASK) == EXC_AFFLAG_AND) ); -aCond[ 0 ].SaveXml( rStrm ); -aCond[ 1 ].SaveXml( rStrm ); -rWorksheet->endElement( XML_customFilters ); +else +{ +rWorksheet->startElement(XML_customFilters, XML_and, + ToPsz((nFlags & EXC_AFFLAG_ANDORMASK) == EXC_AFFLAG_AND)); +aCond[0].SaveXml(rStrm); +aCond[1].SaveXml(rStrm); +rWorksheet->endElement(XML_customFilters); +} // OOXTODO: XML_dynamicFilter, XML_extLst, XML_filters, XML_iconFilter } break; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export-test2.cxx |6 ++ sc/source/filter/excel/xeescher.cxx|5 - 2 files changed, 10 insertions(+), 1 deletion(-) New commits: commit d67085cd86dc1e74941c8337d1eba39981117977 Author: Miklos Vajna AuthorDate: Thu Jul 8 10:15:29 2021 +0200 Commit: Miklos Vajna CommitDate: Thu Jul 8 11:06:31 2021 +0200 XSLX export, button form control: fix handling of no macros Turns out that in case there is no macro, then the attribute should be omitted, leaving it empty is not OK. Excel warns about this. Change-Id: I2dbc4d837bd585674e013eb3ce6b898f12498c4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118600 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx index 0a44090734ab..74e795709b0e 100644 --- a/sc/qa/unit/subsequent_export-test2.cxx +++ b/sc/qa/unit/subsequent_export-test2.cxx @@ -2367,6 +2367,12 @@ void ScExportTest2::testButtonFormControlXlsxExport() assertXPathContent(pDoc, "//x:anchor/x:from/xdr:row", "3"); assertXPathContent(pDoc, "//x:anchor/x:to/xdr:col", "3"); assertXPathContent(pDoc, "//x:anchor/x:to/xdr:row", "7"); + +// Also make sure that an empty macro attribute is not written. +// Without the fix in place, this test would have failed with: +// - XPath '//x:controlPr' unexpected 'macro' attribute +// i.e. macro in an xlsx file was not omitted, which is considered invalid by Excel. +assertXPathNoAttribute(pDoc, "//x:controlPr", "macro"); } void ScExportTest2::testInvalidNamedRange() diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index eafc30de8b0a..2f92384c25b4 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -1481,9 +1481,12 @@ void XclExpTbxControlObj::SaveSheetXml(XclExpXmlStream& rStrm, const OUString& a rWorksheet->startElement(XML_control, XML_shapeId, OString::number(mnShapeId).getStr(), FSNS(XML_r, XML_id), aIdFormControlPr, XML_name, msCtrlName); +OString aMacroName = GetMacroName().toUtf8(); +// Omit the macro attribute if it would be empty. +const char* pMacroName = aMacroName.isEmpty() ? nullptr : aMacroName.getStr(); rWorksheet->startElement(XML_controlPr, XML_defaultSize, "0", XML_print, mbPrint ? "true" : "false", XML_autoFill, "0", XML_autoPict, - "0", XML_macro, GetMacroName()); + "0", XML_macro, pMacroName); rWorksheet->startElement(XML_anchor, XML_moveWithCells, "true", XML_sizeWithCells, "false"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf142764.ods|binary sc/qa/unit/subsequent_export-test2.cxx | 19 +++ sc/source/filter/xml/XMLTableHeaderFooterContext.cxx | 12 +--- 3 files changed, 28 insertions(+), 3 deletions(-) New commits: commit 52beb3907dd3c7e6ae112e263def1005272cecd8 Author: Daniel Arato (NISZ) AuthorDate: Thu Jun 24 15:01:54 2021 +0200 Commit: László Németh CommitDate: Wed Jul 7 15:27:43 2021 +0200 tdf#142764 sc: import "Same content on first/left page" Different header of the first page was never imported (related to the missing UI support), despite its working ODF export. This commit sets the values of those options at ODS file load according to the "display" attribute used to hide or show a particular header/footer. Follow-up to commit 19fa853ce12136b5c14e0c5a0aa906c296b75388 "tdf#121715 XLSX: support custom first page header/footer". Change-Id: I3409ad94a4d3ff86fd7f6d8afede3e7603024515 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117788 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/ods/tdf142764.ods b/sc/qa/unit/data/ods/tdf142764.ods new file mode 100644 index ..bbc4355dab32 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf142764.ods differ diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx index ad08aa2802d0..0a44090734ab 100644 --- a/sc/qa/unit/subsequent_export-test2.cxx +++ b/sc/qa/unit/subsequent_export-test2.cxx @@ -142,6 +142,7 @@ public: void testPivotCacheAfterExportXLSX(); void testTdf114969XLSX(); void testTdf115192XLSX(); +void testTdf142764(); void testTdf91634XLSX(); void testTdf115159(); void testTdf112567(); @@ -240,6 +241,7 @@ public: CPPUNIT_TEST(testPivotCacheAfterExportXLSX); CPPUNIT_TEST(testTdf114969XLSX); CPPUNIT_TEST(testTdf115192XLSX); +CPPUNIT_TEST(testTdf142764); CPPUNIT_TEST(testTdf91634XLSX); CPPUNIT_TEST(testTdf115159); CPPUNIT_TEST(testTdf112567); @@ -1217,6 +1219,23 @@ void ScExportTest2::testTdf115192XLSX() xDocSh->DoClose(); } +void ScExportTest2::testTdf142764() +{ +ScDocShellRef xShell = loadDoc(u"tdf142764.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell); + +auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); + +xmlDocUniquePtr pSheet += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pSheet); + +assertXPath(pSheet, "/x:worksheet/x:headerFooter", "differentOddEven", "true"); +assertXPath(pSheet, "/x:worksheet/x:headerFooter", "differentFirst", "true"); + +xShell->DoClose(); +} + void ScExportTest2::testTdf91634XLSX() { ScDocShellRef xDocSh = loadDoc(u"image_hyperlink.", FORMAT_XLSX); diff --git a/sc/source/filter/xml/XMLTableHeaderFooterContext.cxx b/sc/source/filter/xml/XMLTableHeaderFooterContext.cxx index a34015a999cf..c0b5c6eb6cc1 100644 --- a/sc/source/filter/xml/XMLTableHeaderFooterContext.cxx +++ b/sc/source/filter/xml/XMLTableHeaderFooterContext.cxx @@ -53,6 +53,7 @@ XMLTableHeaderFooterContext::XMLTableHeaderFooterContext( SvXMLImport& rImport, OUString sContentLeft( bFooter ? OUString(SC_UNO_PAGE_LEFTFTRCONT) : OUString(SC_UNO_PAGE_LEFTHDRCONT) ); OUString sContentFirst( bFooter ? OUString(SC_UNO_PAGE_FIRSTFTRCONT) : OUString(SC_UNO_PAGE_FIRSTHDRCONT) ); OUString sShareContent( bFooter ? OUString(SC_UNO_PAGE_FTRSHARED) : OUString(SC_UNO_PAGE_HDRSHARED) ); +OUString sShareFirstContent( bFooter ? OUString(SC_UNO_PAGE_FIRSTFTRSHARED) : OUString(SC_UNO_PAGE_FIRSTHDRSHARED) ); bool bDisplay( true ); for( auto : sax_fastparser::castToFastAttributeList( xAttrList ) ) { @@ -61,10 +62,9 @@ XMLTableHeaderFooterContext::XMLTableHeaderFooterContext( SvXMLImport& rImport, else XMLOFF_WARN_UNKNOWN("sc", aIter); } +bool bOn(::cppu::any2bool(xPropSet->getPropertyValue( sOn ))); if( bLeft ) { -bool bOn(::cppu::any2bool(xPropSet->getPropertyValue( sOn ))); - if( bOn && bDisplay ) { if( ::cppu::any2bool(xPropSet->getPropertyValue( sShareContent )) ) @@ -80,16 +80,22 @@ XMLTableHeaderFooterContext::XMLTableHeaderFooterContext( SvXMLImport& rImport, } else { -bool bOn(::cppu::any2bool(xPropSet->getPropertyValue( sOn ))); if ( bOn != bDisplay ) xPropSet->setPropertyValue( sOn, uno::makeAny(bDisplay) ); } if (bLeft) +{ sCont = sContentLeft; +} else if (bFirst) +{ sCont = sContentFirst; +xPropSet->setPropertyValue( sShareFirstContent, uno::makeAny(!bDisplay) ); +} else +{ sCont = sContent; +} xPropSet->getPropertyValue( sCont ) >>= xHeaderFooterContent; }
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/checkbox-form-control.xlsx |binary sc/qa/unit/subsequent_export-test2.cxx | 20 sc/source/filter/excel/xeescher.cxx | 98 +++- sc/source/filter/inc/xeescher.hxx |3 sc/source/filter/xcl97/xcl97rec.cxx | 12 ++ 5 files changed, 131 insertions(+), 2 deletions(-) New commits: commit 94678a7b9c6b7e577c15adacc885e03551bcf17b Author: Miklos Vajna AuthorDate: Wed Jun 30 16:22:42 2021 +0200 Commit: Miklos Vajna CommitDate: Wed Jun 30 20:33:39 2021 +0200 XLSX export: improve handling of checkbox (form controls) This builds on top of commit fd238380ae7820f12ac1f7c52d0f7180a93f3ba3 (tdf#106181 XLSX export: output form controls, 2020-05-13) and adds the missing VML version which seems to be mandated by Excel 2019. It is not perfect (e.g. there is still an unwanted border around the checkbox), but the checkbox has a correct position and its label is readable, while it was just lost previously. Change-Id: I08198d068a0eb85061d138719cfc60d73c46398e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118168 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sc/qa/unit/data/xlsx/checkbox-form-control.xlsx b/sc/qa/unit/data/xlsx/checkbox-form-control.xlsx new file mode 100644 index ..ad761a573aae Binary files /dev/null and b/sc/qa/unit/data/xlsx/checkbox-form-control.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx index 1c088c813f21..eb6db21167d3 100644 --- a/sc/qa/unit/subsequent_export-test2.cxx +++ b/sc/qa/unit/subsequent_export-test2.cxx @@ -187,6 +187,7 @@ public: void testTdf139258_rotated_image(); void testTdf126541_SheetVisibilityImportXlsx(); void testTdf140431(); +void testCheckboxFormControlXlsxExport(); CPPUNIT_TEST_SUITE(ScExportTest2); @@ -282,6 +283,7 @@ public: CPPUNIT_TEST(testTdf139258_rotated_image); CPPUNIT_TEST(testTdf126541_SheetVisibilityImportXlsx); CPPUNIT_TEST(testTdf140431); +CPPUNIT_TEST(testCheckboxFormControlXlsxExport); CPPUNIT_TEST_SUITE_END(); @@ -2301,6 +2303,24 @@ void ScExportTest2::testTdf140431() xDocSh->DoClose(); } +void ScExportTest2::testCheckboxFormControlXlsxExport() +{ +// Given a document that has a checkbox form control: +ScDocShellRef xShell = loadDoc(u"checkbox-form-control.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +// When exporting to XLSX: +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); + +// Then make sure its VML markup is written and it has a correct position + size: +xmlDocUniquePtr pDoc += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/vmlDrawing1.vml"); +// Without the fix in place, this test would have failed as there was no such stream. +CPPUNIT_ASSERT(pDoc); +assertXPathContent(pDoc, "/xml/v:shape/xx:ClientData/xx:Anchor", "1, 22, 3, 3, 3, 30, 6, 1"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 1bc1a753acad..2f1253c0a16e 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -70,6 +70,7 @@ #include #include #include +#include #include using namespace com::sun::star; @@ -651,7 +652,8 @@ XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rRoot, Reference< mbScrollHor( false ), mbPrint( false ), mbVisible( false ), -mnShapeId( 0 ) +mnShapeId( 0 ), +mrRoot(rRoot) { namespace FormCompType = css::form::FormComponentType; namespace AwtVisualEffect = css::awt::VisualEffect; @@ -1084,6 +1086,100 @@ void XclExpTbxControlObj::setShapeId(sal_Int32 aShapeId) mnShapeId = aShapeId; } +namespace +{ +/// Handles the VML export of form controls (e.g. checkboxes). +class VmlFormControlExporter : public oox::vml::VMLExport +{ +sal_uInt16 m_nObjType; +tools::Rectangle m_aAreaFrom; +tools::Rectangle m_aAreaTo; +OUString m_aLabel; + +public: +VmlFormControlExporter(const sax_fastparser::FSHelperPtr& p, sal_uInt16 nObjType, + const tools::Rectangle& rAreaFrom, const tools::Rectangle& rAreaTo, + const OUString& rLabel); + +protected: +using VMLExport::StartShape; +sal_Int32 StartShape() override; +using VMLExport::EndShape; +void EndShape(sal_Int32 nShapeElement) override; +}; + +VmlFormControlExporter::VmlFormControlExporter(const sax_fastparser::FSHelperPtr& p, + sal_uInt16 nObjType, + const tools::Rectangle& rAreaFrom, + const tools::Rectangle& rAreaTo, +
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/129969-min.xlsx |binary sc/qa/unit/subsequent_export-test2.cxx | 19 +++ sc/source/filter/excel/xecontent.cxx |4 ++-- 3 files changed, 21 insertions(+), 2 deletions(-) New commits: commit 67e2cc17bad3fd7aacb94da47f9024b731434a84 Author: Tünde Tóth AuthorDate: Tue Jun 29 13:58:59 2021 +0200 Commit: László Németh CommitDate: Wed Jun 30 13:36:18 2021 +0200 tdf#140431 XLSX export: fix double file:// prefix Regression from commit: fc58d7d65b9683db7b7632137126680b8483f6c5 (tdf#129969 XLSX export: file URLs need IURI encoding) Change-Id: I5bfb0ef9ba7fe82cd3f4d0e0b3fdcf8f705cba64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118090 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/xlsx/129969-min.xlsx b/sc/qa/unit/data/xlsx/129969-min.xlsx new file mode 100644 index ..b6fd8e9e2069 Binary files /dev/null and b/sc/qa/unit/data/xlsx/129969-min.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx index 8e4f77ebbd79..1c088c813f21 100644 --- a/sc/qa/unit/subsequent_export-test2.cxx +++ b/sc/qa/unit/subsequent_export-test2.cxx @@ -186,6 +186,7 @@ public: void testTdf136721_paper_size(); void testTdf139258_rotated_image(); void testTdf126541_SheetVisibilityImportXlsx(); +void testTdf140431(); CPPUNIT_TEST_SUITE(ScExportTest2); @@ -280,6 +281,7 @@ public: CPPUNIT_TEST(testTdf136721_paper_size); CPPUNIT_TEST(testTdf139258_rotated_image); CPPUNIT_TEST(testTdf126541_SheetVisibilityImportXlsx); +CPPUNIT_TEST(testTdf140431); CPPUNIT_TEST_SUITE_END(); @@ -2282,6 +2284,23 @@ void ScExportTest2::testTdf126541_SheetVisibilityImportXlsx() CPPUNIT_ASSERT(xShell->GetDocument().GetViewOptions().GetOption(VOPT_GRID)); } +void ScExportTest2::testTdf140431() +{ +ScDocShellRef xShell = loadDoc(u"129969-min.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); +ScDocument& rDoc = xDocSh->GetDocument(); +ScAddress aPos(0, 2, 0); +const EditTextObject* pEditText = rDoc.GetEditText(aPos); +const SvxFieldData* pData = pEditText->GetFieldData(0, 0, text::textfield::Type::URL); +const SvxURLField* pURLData = static_cast(pData); +CPPUNIT_ASSERT(pURLData->GetURL().startsWith("file://ndhlis")); + +xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index cf0c3777f39f..0848745b8d4a 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -394,9 +394,9 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU for( int i = 0; i < nLevel; ++i ) msTarget = "../" + msTarget; } -else +else if (rRoot.GetOutput() != EXC_OUTPUT_XML_2007) { -// ooxml expects the file:/// part appended ( or at least +// xls expects the file:/// part appended ( or at least // ms2007 does, ms2010 is more tolerant ) msTarget = "file:///" + msTarget; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf142607.ods |binary sc/qa/unit/subsequent_export-test.cxx | 20 + sc/source/core/data/table3.cxx|5 +- sc/source/filter/excel/excrecds.cxx | 74 ++ sc/source/filter/inc/excrecds.hxx |6 -- 5 files changed, 56 insertions(+), 49 deletions(-) New commits: commit 11cc770ad2af1f31c1e5c9512e5688dff38f009b Author: Balazs Varga AuthorDate: Wed Jun 2 09:17:02 2021 +0200 Commit: László Németh CommitDate: Mon Jun 21 10:46:17 2021 +0200 tdf#142607 XLSX export: keep formatted dates in standard filter Do not convert the formatted string filter criteria values to 'double' if they are numbers (dates). Also export the equal relation criteria into XML_filters tag instead of XML_customFilters. Previously the formatted dates replaced with numbers in standard filter criteria, first during the export, and after the import, in the standard filter dialog window. Note: fix and optimize also filtering by formatted dates by allowing CanOptimizeQueryStringToNumber() to create double values for them. This unifies the same dates with different date formatting. Follow-up to commit 1f755525189884e4b2824889a6b9dea8933402db "tdf#142402 sc UI: store formatted values in standard filter". Change-Id: If4c22e8b0142720ccfda038f89367061058693aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116566 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/ods/tdf142607.ods b/sc/qa/unit/data/ods/tdf142607.ods new file mode 100644 index ..91649056e728 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf142607.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index ae2784a832e7..31c0aae3dd71 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -205,6 +205,7 @@ public: void testPreserveTextWhitespaceXLSX(); void testPreserveTextWhitespace2XLSX(); void testTdf113646(); +void testDateStandardfilterXLSX(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -308,6 +309,7 @@ public: CPPUNIT_TEST(testHyperlinkXLSX); CPPUNIT_TEST(testMoveCellAnchoredShapesODS); CPPUNIT_TEST(testTdf113646); +CPPUNIT_TEST(testDateStandardfilterXLSX); CPPUNIT_TEST_SUITE_END(); private: @@ -4184,6 +4186,24 @@ void ScExportTest::testTdf113646() xShell->DoClose(); } +void ScExportTest::testDateStandardfilterXLSX() +{ +// XLSX Roundtripping standard filter with date +ScDocShellRef xDocSh = loadDoc(u"tdf142607.", FORMAT_ODS); +CPPUNIT_ASSERT(xDocSh.is()); + +xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); +CPPUNIT_ASSERT(pDoc); + +assertXPath(pDoc, "//x:autoFilter", "ref", "A1:B6"); +assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "day", "03"); +assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "month", "12"); +assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "year", "2011"); +assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "dateTimeGrouping", "day"); + +xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 47d1ea2b852d..f8e9aada25b7 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -3055,8 +3055,9 @@ public: { if (rItem.meType != ScQueryEntry::ByString && rItem.meType != ScQueryEntry::ByDate) return; - -if (rItem.mbFormattedValue) +// return only if the type is ByString and the values are formatted, in other cases +// we have to optimize the filter in CanOptimizeQueryStringToNumber(). +if (rItem.mbFormattedValue && rItem.meType == ScQueryEntry::ByString) return; sal_uInt32 nIndex = 0; diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index c1f45823efcd..8c66caebdea5 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -528,8 +528,7 @@ XclExpAutofilterinfo::XclExpAutofilterinfo( const ScAddress& rStartPos, SCCOL nS ExcFilterCondition::ExcFilterCondition() : nType( EXC_AFTYPE_NOTUSED ), -nOper( EXC_AFOPER_EQUAL ), -fVal( 0.0 ) +nOper( EXC_AFOPER_EQUAL ) { } @@ -542,32 +541,23 @@ std::size_t ExcFilterCondition::GetTextBytes() const return pText ? (1 + pText->GetBufferSize()) : 0; } -void ExcFilterCondition::SetCondition( sal_uInt8 nTp, sal_uInt8 nOp, double fV, const OUString* pT ) +void ExcFilterCondition::SetCondition( sal_uInt8 nTp, sal_uInt8 nOp, const
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/statistics/descriptiveStatistics.py |6 +- sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx | 21 +++--- 2 files changed, 18 insertions(+), 9 deletions(-) New commits: commit e0237886450dcd3e6d3200ef533d2b3d7f0f8c19 Author: Andreas Heinisch AuthorDate: Tue Jun 8 17:21:09 2021 +0200 Commit: Andreas Heinisch CommitDate: Sat Jun 12 17:44:29 2021 +0200 tdf#128018 - Add column/row labels to the descriptive statistics Change-Id: I22840433954a217ef5b5c1d3ea20e935d322e767 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116852 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sc/qa/uitest/statistics/descriptiveStatistics.py b/sc/qa/uitest/statistics/descriptiveStatistics.py index 112803418dac..b0fe011fee66 100644 --- a/sc/qa/uitest/statistics/descriptiveStatistics.py +++ b/sc/qa/uitest/statistics/descriptiveStatistics.py @@ -99,7 +99,7 @@ class descriptiveStatistics(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 5, 14).getString() , "Sum") self.assertEqual(get_cell_by_position(document, 0, 5, 15).getString() , "Count") -self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString() , "Column 1") +self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString() , "Math") self.assertEqual(round(get_cell_by_position(document, 0, 6, 1).getValue(),12) , 41.909090909091) self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),13) , 3.5610380137731) self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue() , 47) @@ -116,7 +116,7 @@ class descriptiveStatistics(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 6, 14).getValue() , 461) self.assertEqual(get_cell_by_position(document, 0, 6, 15).getValue() , 11) -self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString() , "Column 2") +self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString() , "Physics") self.assertEqual(round(get_cell_by_position(document, 0, 7, 1).getValue(),1) , 59.7) self.assertEqual(round(get_cell_by_position(document, 0, 7, 2).getValue(),14) , 5.35837869343164) self.assertEqual(get_cell_by_position(document, 0, 7, 3).getValue() , 49) @@ -133,7 +133,7 @@ class descriptiveStatistics(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 7, 14).getValue() , 597) self.assertEqual(get_cell_by_position(document, 0, 7, 15).getValue() , 10) -self.assertEqual(get_cell_by_position(document, 0, 8, 0).getString() , "Column 3") +self.assertEqual(get_cell_by_position(document, 0, 8, 0).getString() , "Biology") self.assertEqual(get_cell_by_position(document, 0, 8, 1).getValue() , 44.7) self.assertEqual(round(get_cell_by_position(document, 0, 8, 2).getValue(),13) , 4.7680650629416) self.assertEqual(get_cell_by_position(document, 0, 8, 3).getValue() , 60) diff --git a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx index f42e9cf12923..ca2da6458860 100644 --- a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx @@ -88,13 +88,22 @@ ScRange ScDescriptiveStatisticsDialog::ApplyOutput(ScDocShell* pDocShell) // Write column/row labels for( ; pIterator->hasNext(); pIterator->next() ) { -if (mGroupedBy == BY_COLUMN) -aTemplate.setTemplate(ScResId(STR_COLUMN_LABEL_TEMPLATE)); -else -aTemplate.setTemplate(ScResId(STR_ROW_LABEL_TEMPLATE)); +// tdf#128018 - add column/row labels to the output +OUString aColRowLabel = mDocument.GetString(pIterator->get().aStart); +if (aColRowLabel.isEmpty()) +{ +if (mGroupedBy == BY_COLUMN) +aTemplate.setTemplate(ScResId(STR_COLUMN_LABEL_TEMPLATE)); +else +aTemplate.setTemplate(ScResId(STR_ROW_LABEL_TEMPLATE)); -aTemplate.applyNumber(u"%NUMBER%", pIterator->index() + 1); -aOutput.writeBoldString(aTemplate.getTemplate()); +aTemplate.applyNumber(u"%NUMBER%", pIterator->index() + 1); +aOutput.writeBoldString(aTemplate.getTemplate()); +} +else +{ +aOutput.writeBoldString(aColRowLabel); +} aOutput.nextColumn(); } aOutput.nextRow(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/extras/scchartobj.cxx |3 -- sc/qa/extras/scchartsobj.cxx |6 +--- sc/qa/extras/scdatapilotfieldgroupitemobj.cxx |5 --- sc/qa/extras/scdatapilotfieldgroupobj.cxx |5 --- sc/qa/extras/scdatapilotfieldgroupsobj.cxx|5 --- sc/qa/extras/scindexenumeration_scenariosenumeration.cxx |5 +-- sc/qa/extras/scindexenumeration_subtotalfieldsenumeration.cxx |5 --- sc/qa/extras/scindexenumeration_tablechartsenumeration.cxx|6 +--- sc/qa/extras/scscenariosobj.cxx |4 -- sc/qa/extras/sctablesheetobj.cxx |9 ++ sc/qa/perf/scperfobj.cxx |4 -- sc/source/core/data/dptabsrc.cxx |8 ++--- sc/source/filter/xml/xmlimprt.cxx | 15 ++ sc/source/ui/Accessibility/AccessiblePreviewTable.cxx |4 +- sc/source/ui/docshell/docsh4.cxx |3 -- sc/source/ui/unoobj/appluno.cxx |4 +- sc/source/ui/unoobj/cellsuno.cxx | 14 - sc/source/ui/unoobj/chart2uno.cxx |3 -- sc/source/ui/unoobj/chartuno.cxx |2 - sc/source/ui/unoobj/condformatuno.cxx |8 +++-- sc/source/ui/unoobj/dapiuno.cxx |2 - sc/source/ui/unoobj/datauno.cxx |2 - sc/source/ui/unoobj/fielduno.cxx |3 -- sc/source/ui/unoobj/nameuno.cxx |2 - sc/source/ui/vba/vbachart.cxx |5 --- 25 files changed, 53 insertions(+), 79 deletions(-) New commits: commit b1fe17f280b24e78e7ee55d4762dc64a98d6f302 Author: Julien Nabet AuthorDate: Wed Jun 9 17:28:19 2021 +0200 Commit: Julien Nabet CommitDate: Fri Jun 11 14:54:14 2021 +0200 Simplify Sequences initializations (sc) Change-Id: I0c581b3a900a6b89c0f4e203310d65600545987f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116929 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/sc/qa/extras/scchartobj.cxx b/sc/qa/extras/scchartobj.cxx index d5cd726f9164..04eaeba8131d 100644 --- a/sc/qa/extras/scchartobj.cxx +++ b/sc/qa/extras/scchartobj.cxx @@ -157,8 +157,7 @@ uno::Reference ScChartObj::init() uno::UNO_SET_THROW); uno::Reference xCRA(xCellRange1, uno::UNO_QUERY_THROW); -uno::Sequence aCRA(1); -aCRA[0] = xCRA->getRangeAddress(); +uno::Sequence aCRA{ xCRA->getRangeAddress() }; uno::Reference xTCS(xSheet0, uno::UNO_QUERY_THROW); uno::Reference xTC = xTCS->getCharts(); diff --git a/sc/qa/extras/scchartsobj.cxx b/sc/qa/extras/scchartsobj.cxx index 7424e1d68c76..0b85a2988d25 100644 --- a/sc/qa/extras/scchartsobj.cxx +++ b/sc/qa/extras/scchartsobj.cxx @@ -165,12 +165,10 @@ uno::Reference ScChartsObj::init() uno::UNO_SET_THROW); uno::Reference xCRA(xCellRange1, uno::UNO_QUERY_THROW); -uno::Sequence aCRA(1); -aCRA[0] = xCRA->getRangeAddress(); - uno::Reference xTCS(xSheet0, uno::UNO_QUERY_THROW); uno::Reference xTC = xTCS->getCharts(); -xTC->addNewByName("ScChartsObj", awt::Rectangle(500, 3000, 25000, 11000), aCRA, true, true); +xTC->addNewByName("ScChartsObj", awt::Rectangle(500, 3000, 25000, 11000), + { xCRA->getRangeAddress() }, true, true); return xTC; } diff --git a/sc/qa/extras/scdatapilotfieldgroupitemobj.cxx b/sc/qa/extras/scdatapilotfieldgroupitemobj.cxx index e40170e5198c..6e0716020957 100644 --- a/sc/qa/extras/scdatapilotfieldgroupitemobj.cxx +++ b/sc/qa/extras/scdatapilotfieldgroupitemobj.cxx @@ -146,10 +146,7 @@ uno::Reference ScDataPilotFieldGroupItemObj::init() uno::Reference xDPFG(xIA_RF0->getByIndex(0), uno::UNO_QUERY_THROW); -uno::Sequence aElements(2); -aElements[0] = "aName"; -aElements[1] = "otherName"; -xDPFG->createNameGroup(aElements); +xDPFG->createNameGroup({ "aName", "otherName" }); uno::Reference xIA_DPT1(xDPTS->getDataPilotTables(), uno::UNO_QUERY_THROW); diff --git a/sc/qa/extras/scdatapilotfieldgroupobj.cxx b/sc/qa/extras/scdatapilotfieldgroupobj.cxx index 8fc85a85faea..f908dd160c6b 100644 --- a/sc/qa/extras/scdatapilotfieldgroupobj.cxx +++ b/sc/qa/extras/scdatapilotfieldgroupobj.cxx @@ -172,10 +172,7 @@ uno::Reference ScDataPilotFieldGroupObj::init() uno::Reference xDPFG(xIA_RF0->getByIndex(0), uno::UNO_QUERY_THROW); -uno::Sequence
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc_copypaste.cxx | 40 sc/source/ui/view/viewfun3.cxx |6 -- 2 files changed, 24 insertions(+), 22 deletions(-) New commits: commit 940dad058c199c6b6990ad313db5a17758a19c65 Author: scito AuthorDate: Fri May 28 13:56:29 2021 +0200 Commit: Eike Rathke CommitDate: Fri Jun 4 12:18:56 2021 +0200 tdf#141683 fix missing flag in multi sel pasted transposed as links For transpose, the links for option 'as links' will be set during TransposeClip(). Thus, formulas will be created. So, the formula flag must be set for subsequent copying to the document. This flag must be set in the multi range selection code path for transposed as links. I've adapted the tests. Unfortunately, this fix cannot be tested directly with automatic tests. However, the same behavior is applied in the unit tests. Change-Id: Ia16a8371894a784fc7fcfa1c7b5242f552bef956 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116332 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index 18f1bb07c970..f38f59afd74b 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -1059,7 +1059,7 @@ void TestCopyPaste::testCopyPasteSpecialAsLinkFilteredTranspose() } // tdf#141683 -// InsertDeleteFlags::CONTENTS +// InsertDeleteFlags::VALUE void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkTranspose() { const SCTAB srcSheet = 0; @@ -1090,14 +1090,14 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkTranspose() // transpose ScDocumentUniquePtr pTransClip(new ScDocument(SCDOCMODE_CLIP)); -aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::CONTENTS, true, false); +aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::VALUE, true, false); ScRange aDestRange(1, 1, destSheet, 2, 4, destSheet); // Paste to B2:C5 on Sheet2. ScMarkData aMark(m_pDoc->GetSheetLimits()); aMark.SetMarkArea(aDestRange); -m_pDoc->CopyMultiRangeFromClip(ScAddress(1, 1, destSheet), aMark, InsertDeleteFlags::CONTENTS, - pTransClip.get(), true, false /* false fixes tdf#141683 */, - false, false); +m_pDoc->CopyMultiRangeFromClip( +ScAddress(1, 1, destSheet), aMark, InsertDeleteFlags::VALUE | InsertDeleteFlags::FORMULA, +pTransClip.get(), true, false /* false fixes tdf#141683 */, false, false); pTransClip.reset(); OUString aString; @@ -1149,7 +1149,7 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkTranspose() } // tdf#141683 -// InsertDeleteFlags::CONTENTS +// InsertDeleteFlags::VALUE void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkFilteredTranspose() { const SCTAB srcSheet = 0; @@ -1217,7 +1217,7 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkFilteredTranspose() printRange(m_pDoc, aClipParam.getWholeRange(), "Src range"); // transpose ScDocumentUniquePtr pTransClip(new ScDocument(SCDOCMODE_CLIP)); -aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::CONTENTS, true, false); +aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::VALUE, true, false); printRange(, ScRange(0, 0, 0, 4, 5, 0), "Base doc ()"); printRange(pTransClip.get(), ScRange(0, 0, 0, 3, 3, 0), @@ -1225,9 +1225,9 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkFilteredTranspose() ScRange aDestRange(1, 1, destSheet, 3, 4, destSheet); // Paste to B2:D5 on Sheet2. ScMarkData aMark(m_pDoc->GetSheetLimits()); aMark.SetMarkArea(aDestRange); -m_pDoc->CopyMultiRangeFromClip(ScAddress(1, 1, destSheet), aMark, InsertDeleteFlags::CONTENTS, - pTransClip.get(), true, false /* false fixes tdf#141683 */, - false, false); +m_pDoc->CopyMultiRangeFromClip( +ScAddress(1, 1, destSheet), aMark, InsertDeleteFlags::VALUE | InsertDeleteFlags::FORMULA, +pTransClip.get(), true, false /* false fixes tdf#141683 */, false, false); pTransClip.reset(); printRange(m_pDoc, aDestRange, "Transposed dest sheet"); @@ -1301,7 +1301,7 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkFilteredTranspose() } // tdf#141683 -// InsertDeleteFlags::CONTENTS +// InsertDeleteFlags::VALUE void TestCopyPaste::testCopyPasteSpecialMultiRangeColAsLinkTranspose() { const SCTAB srcSheet = 0; @@ -1332,14 +1332,14 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeColAsLinkTranspose() // transpose ScDocumentUniquePtr pTransClip(new ScDocument(SCDOCMODE_CLIP)); -aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::CONTENTS, true, false); +aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::VALUE, true, false); ScRange aDestRange(1, 1, destSheet, 4, 2,
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/autofilter/autofilter.py | 13 ++--- sc/qa/uitest/autofilter/autofilterBugs.py | 18 +- sc/qa/uitest/autofilter/tdf68113.py |8 sc/source/ui/view/gridwin.cxx | 29 +++-- 4 files changed, 42 insertions(+), 26 deletions(-) New commits: commit 361b95b39c0ad3028f82b9893bb3c84dcbd1932f Author: Tünde Tóth AuthorDate: Mon May 31 11:09:35 2021 +0200 Commit: László Németh CommitDate: Tue Jun 1 13:03:26 2021 +0200 tdf#140745 sc AutoFilter: fix placing of "(empty)" Show entry "(empty)" on top of the checkbox list in the Autofilter dropdown (instead of between the numerical and string values). Change-Id: I5b6d339d07b886bd52d24c7d900b53c6f921c2ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116439 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index 70c6b3c3b89d..060ada717844 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -409,7 +409,14 @@ class AutofilterTest(UITestCase): xFloatWindow = self.xUITest.getFloatWindow() xCheckListMenu = xFloatWindow.getChild("check_list_menu") xList = xCheckListMenu.getChild("check_list_box") -xEntry = xList.getChild("2") + +# tdf140745 show (empty) entry on top of the checkbox list +self.assertEqual(3, len(xList.getChildren())) +self.assertEqual("(empty)", get_state_as_dict(xList.getChild('0'))['Text']) +self.assertEqual("0", get_state_as_dict(xList.getChild('1'))['Text']) +self.assertEqual("1", get_state_as_dict(xList.getChild('2'))['Text']) + +xEntry = xList.getChild("0") xEntry.executeAction("CLICK", tuple()) xOkButton = xFloatWindow.getChild("ok") @@ -424,9 +431,9 @@ class AutofilterTest(UITestCase): xCheckListMenu = xFloatWindow.getChild("check_list_menu") xList = xCheckListMenu.getChild("check_list_box") self.assertEqual(3, len(xList.getChildren())) -self.assertEqual('true', get_state_as_dict(xList.getChild('0'))['IsChecked']) +self.assertEqual('false', get_state_as_dict(xList.getChild('0'))['IsChecked']) self.assertEqual('true', get_state_as_dict(xList.getChild('1'))['IsChecked']) -self.assertEqual('false', get_state_as_dict(xList.getChild('2'))['IsChecked']) +self.assertEqual('true', get_state_as_dict(xList.getChild('2'))['IsChecked']) xCloseButton = xFloatWindow.getChild("cancel") xCloseButton.executeAction("CLICK", tuple()) diff --git a/sc/qa/uitest/autofilter/autofilterBugs.py b/sc/qa/uitest/autofilter/autofilterBugs.py index 9eb45d83a3a0..fabde9aabce9 100644 --- a/sc/qa/uitest/autofilter/autofilterBugs.py +++ b/sc/qa/uitest/autofilter/autofilterBugs.py @@ -220,15 +220,15 @@ class autofilter(UITestCase): x8Entry = xTreeList.getChild("7") x9Entry = xTreeList.getChild("8") -self.assertEqual(get_state_as_dict(x1Entry)["Text"], "0") -self.assertEqual(get_state_as_dict(x2Entry)["Text"], "0.1") -self.assertEqual(get_state_as_dict(x3Entry)["Text"], "0.2") -self.assertEqual(get_state_as_dict(x4Entry)["Text"], "0.3") -self.assertEqual(get_state_as_dict(x5Entry)["Text"], "0.5") -self.assertEqual(get_state_as_dict(x6Entry)["Text"], "0.8") -self.assertEqual(get_state_as_dict(x7Entry)["Text"], "0.9") -self.assertEqual(get_state_as_dict(x8Entry)["Text"], "1") -self.assertEqual(get_state_as_dict(x9Entry)["Text"], "(empty)") +self.assertEqual(get_state_as_dict(x1Entry)["Text"], "(empty)") +self.assertEqual(get_state_as_dict(x2Entry)["Text"], "0") +self.assertEqual(get_state_as_dict(x3Entry)["Text"], "0.1") +self.assertEqual(get_state_as_dict(x4Entry)["Text"], "0.2") +self.assertEqual(get_state_as_dict(x5Entry)["Text"], "0.3") +self.assertEqual(get_state_as_dict(x6Entry)["Text"], "0.5") +self.assertEqual(get_state_as_dict(x7Entry)["Text"], "0.8") +self.assertEqual(get_state_as_dict(x8Entry)["Text"], "0.9") +self.assertEqual(get_state_as_dict(x9Entry)["Text"], "1") self.assertEqual(get_state_as_dict(xTreeList)["Children"], "9") xCancel = xFloatWindow.getChild("cancel") diff --git a/sc/qa/uitest/autofilter/tdf68113.py b/sc/qa/uitest/autofilter/tdf68113.py index dd211665f614..f62ac9ce95c0 100644 --- a/sc/qa/uitest/autofilter/tdf68113.py +++ b/sc/qa/uitest/autofilter/tdf68113.py @@ -44,9 +44,9 @@ class tdf68113(UITestCase): xCheckListMenu = xFloatWindow.getChild("check_list_menu") xTreeList = xCheckListMenu.getChild("check_list_box") self.assertEqual(5, len(xTreeList.getChildren())) -self.assertEqual('false', get_state_as_dict(xTreeList.getChild('0'))['IsChecked']) +
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/uicalc/uicalc.cxx | 13 + sc/source/ui/view/tabvwshf.cxx |2 ++ 2 files changed, 15 insertions(+) New commits: commit 5ead135faaee76bea78f481d7c63d54f56e9098c Author: Attila Szűcs AuthorDate: Mon May 17 15:26:34 2021 +0200 Commit: László Németh CommitDate: Tue Jun 1 10:05:55 2021 +0200 tdf#126540 sc: toggling grid lines sets document as modified View->View Grid Lines modifies a sheet-level option which must be saved in the document. Co-authored-by: Tibor Nagy (NISZ) Change-Id: Ifcee59d27fbe0bb50b9fe99e16c70e2062a714f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115711 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index aa5d8b5fcd02..d133876f6d04 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -1640,6 +1640,19 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf99913) CPPUNIT_ASSERT(pDoc->RowFiltered(2, 0)); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126540_GridToggleModifiesTheDocument) +{ +ScModelObj* pModelObj = createDoc("tdf99913.xlsx"); +ScDocument* pDoc = pModelObj->GetDocument(); +CPPUNIT_ASSERT(pDoc); + +// Toggling the grid of a sheet, must set the document modified state +ScDocShell* pDocSh = ScDocShell::GetViewData()->GetDocShell(); +CPPUNIT_ASSERT(!pDocSh->IsModified()); +dispatchCommand(mxComponent, ".uno:ToggleSheetGrid", {}); +CPPUNIT_ASSERT(pDocSh->IsModified()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index 40f78b7fc85b..57b0bf6696d1 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -735,6 +735,8 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) rViewData.SetShowGrid(!bShowGrid); SfxBindings& rBindings = GetViewFrame()->GetBindings(); rBindings.Invalidate( FID_TAB_TOGGLE_GRID ); +ScDocShellModificator aModificator(*rViewData.GetDocShell()); +aModificator.SetDocumentModified(); PaintGrid(); rReq.Done(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/autofilter/autofilter.py | 25 ++ sc/qa/uitest/data/autofilter/tdf138438.ods |binary sc/source/core/data/table3.cxx | 105 ++--- 3 files changed, 79 insertions(+), 51 deletions(-) New commits: commit fbfb57635b602b50cb22465047ae5bcdbef3dd0a Author: Balazs Varga AuthorDate: Sun May 9 10:31:21 2021 +0200 Commit: László Németh CommitDate: Fri May 28 12:14:08 2021 +0200 tdf#138438 sc: fix "Top 10" autoFilter in multiple columns Check all QueryItems instead of just the first one. Now top 10 values are visible (except the values hidden by the filters of the previous columns). Change-Id: I317d0c6843e568f8645b744968352a0e895a42dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115267 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index 3f20175ef618..334f7a90b3dd 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -430,5 +430,30 @@ class AutofilterTest(UITestCase): xCloseButton = xFloatWindow.getChild("cancel") xCloseButton.executeAction("CLICK", tuple()) +self.ui_test.close_doc() + +def test_tdf138438(self): +doc = self.ui_test.load_file(get_url_for_data_file("tdf138438.ods")) + +xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + +# Top 10 filer +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xMenu = xFloatWindow.getChild("menu") +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + +self.assertFalse(is_row_hidden(doc, 0)) +self.assertTrue(is_row_hidden(doc, 1)) +self.assertTrue(is_row_hidden(doc, 2)) +self.assertFalse(is_row_hidden(doc, 3)) +self.assertFalse(is_row_hidden(doc, 4)) +self.assertFalse(is_row_hidden(doc, 5)) +self.assertFalse(is_row_hidden(doc, 6)) +self.assertTrue(is_row_hidden(doc, 7)) +self.assertFalse(is_row_hidden(doc, 8)) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/autofilter/tdf138438.ods b/sc/qa/uitest/data/autofilter/tdf138438.ods new file mode 100644 index ..1dbecc37fc80 Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf138438.ods differ diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index e8837f6ca95a..216aa98e978a 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2906,48 +2906,50 @@ void ScTable::TopTenQuery( ScQueryParam& rParam ) for ( SCSIZE i=0; (i(rEntry.nField) ); -aSortParam = aLocalSortParam; // used in CreateSortInfoArray, Compare -if ( !bSortCollatorInitialized ) -{ -bSortCollatorInitialized = true; -InitSortCollator( aLocalSortParam ); -} -std::unique_ptr pArray(CreateSortInfoArray(aSortParam, nRow1, rParam.nRow2, bGlobalKeepQuery, false)); -DecoladeRow( pArray.get(), nRow1, rParam.nRow2 ); -QuickSort( pArray.get(), nRow1, rParam.nRow2 ); -std::unique_ptr const & ppInfo = pArray->GetFirstArray(); -SCSIZE nValidCount = nCount; -// Don't count note or blank cells, they are sorted to the end -while (nValidCount > 0 && ppInfo[nValidCount-1].maCell.isEmpty()) -nValidCount--; -// Don't count Strings, they are between Value and blank -while (nValidCount > 0 && ppInfo[nValidCount-1].maCell.hasString()) -nValidCount--; -if ( nValidCount > 0 ) +case SC_TOPVAL: +case SC_BOTVAL: +case SC_TOPPERC: +case SC_BOTPERC: { -if ( rItem.meType == ScQueryEntry::ByString ) -{ // by string ain't going to work -rItem.meType = ScQueryEntry::ByValue; -rItem.mfVal = 10; // 10 and 10% respectively +ScSortParam aLocalSortParam(rParam, static_cast(rEntry.nField)); +aSortParam = aLocalSortParam; // used in CreateSortInfoArray, Compare +if (!bSortCollatorInitialized) +{ +bSortCollatorInitialized = true; +InitSortCollator(aLocalSortParam); } -SCSIZE nVal = (rItem.mfVal >= 1 ?
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/autofilter/tdf68113.py | 77 sc/source/ui/view/gridwin.cxx | 12 - 2 files changed, 87 insertions(+), 2 deletions(-) New commits: commit 00e13be1c3dd45597237f805a06b3e8a74187125 Author: Balazs Varga AuthorDate: Thu May 13 17:49:59 2021 +0200 Commit: László Németh CommitDate: Fri May 28 09:32:56 2021 +0200 tdf#68113 sc autofilter: fix not empty button unchecks all entries Instead unchecks all entries, unchecks only empty entries. Change-Id: I6f0d6432151ad2c65871dc5f1dd206883994217a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115562 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/uitest/autofilter/tdf68113.py b/sc/qa/uitest/autofilter/tdf68113.py new file mode 100644 index ..dd211665f614 --- /dev/null +++ b/sc/qa/uitest/autofilter/tdf68113.py @@ -0,0 +1,77 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 68113 - UI Selecting "Not empty" unchecks all entries + +class tdf68113(UITestCase): +def test_tdf68113_empty_notempty_button(self): +self.ui_test.create_doc_in_start_center("calc") +document = self.ui_test.get_component() +calcDoc = self.xUITest.getTopFocusWindow() +xGridWin = calcDoc.getChild("grid_window") +document = self.ui_test.get_component() + +enter_text_to_cell(xGridWin, "A1", "A") +enter_text_to_cell(xGridWin, "A2", "1") +enter_text_to_cell(xGridWin, "A3", "2") +enter_text_to_cell(xGridWin, "A5", "4") +enter_text_to_cell(xGridWin, "A7", "6") + +xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A7"})) + +self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + +# Empty button +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xMenu = xFloatWindow.getChild("menu") +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + +# Checkbox elements +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xTreeList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(5, len(xTreeList.getChildren())) +self.assertEqual('false', get_state_as_dict(xTreeList.getChild('0'))['IsChecked']) +self.assertEqual('false', get_state_as_dict(xTreeList.getChild('2'))['IsChecked']) +self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked']) +xCancelBtn = xFloatWindow.getChild("cancel") +xCancelBtn.executeAction("CLICK", tuple()) + +# Not Empty button +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xMenu = xFloatWindow.getChild("menu") +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) +xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + +# Checkbox elements +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xTreeList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(5, len(xTreeList.getChildren())) +self.assertEqual('true', get_state_as_dict(xTreeList.getChild('0'))['IsChecked']) +self.assertEqual('true', get_state_as_dict(xTreeList.getChild('2'))['IsChecked']) +self.assertEqual('false', get_state_as_dict(xTreeList.getChild('4'))['IsChecked']) +xCancelBtn = xFloatWindow.getChild("cancel") +xCancelBtn.executeAction("CLICK", tuple()) + +self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/autofilter/autofilter.py| 25 +++-- sc/qa/uitest/data/autofilter/tdf140968.xlsx |binary sc/qa/uitest/data/autofilter/time_value.xlsx |binary sc/source/ui/unoobj/datauno.cxx | 13 - 4 files changed, 23 insertions(+), 15 deletions(-) New commits: commit 6a2060cef22b19dbe04676c8c16776c4693b4dd8 Author: Balazs Varga AuthorDate: Wed May 12 11:39:08 2021 +0200 Commit: László Németh CommitDate: Thu May 27 13:03:47 2021 +0200 tdf#141309 tdf#142215 OOXML import: fix double conversion in autofilter resulting missing selection of filtered time values and numbers ending with zeroes. No need to convert the filter values from string to number and back at OOXML import, because we'll do that later in the model by filtering with the formatted cell values. Follow-up to commit d5c2584bf36d21580db677b231c57f99f49aa2cb "Related: tdf#140968 avoid duplicated filter values". Change-Id: I75e5b2391624ff85a8ed545926ec519355a356bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115473 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index 00cfa6fbd9ba..3f20175ef618 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -325,6 +325,19 @@ class AutofilterTest(UITestCase): xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xTreeList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(5, len(xTreeList.getChildren())) +self.assertEqual('true', get_state_as_dict(xTreeList.getChild('0'))['IsChecked']) +self.assertEqual('false', get_state_as_dict(xTreeList.getChild('1'))['IsChecked']) +self.assertEqual('true', get_state_as_dict(xTreeList.getChild('2'))['IsChecked']) +self.assertEqual('false', get_state_as_dict(xTreeList.getChild('3'))['IsChecked']) +self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked']) +xOkBtn = xFloatWindow.getChild("cancel") +xOkBtn.executeAction("CLICK", tuple()) + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) xFloatWindow = self.xUITest.getFloatWindow() xCheckListMenu = xFloatWindow.getChild("check_list_menu") @@ -344,11 +357,18 @@ class AutofilterTest(UITestCase): xFloatWindow = self.xUITest.getFloatWindow() xCheckListMenu = xFloatWindow.getChild("check_list_menu") xTreeList = xCheckListMenu.getChild("check_list_box") -self.assertEqual(4, len(xTreeList.getChildren())) +self.assertEqual(5, len(xTreeList.getChildren())) self.assertEqual("0.000", get_state_as_dict(xTreeList.getChild('0'))['Text']) self.assertEqual("0.046", get_state_as_dict(xTreeList.getChild('1'))['Text']) self.assertEqual("0.365", get_state_as_dict(xTreeList.getChild('2'))['Text']) -self.assertEqual("0.516", get_state_as_dict(xTreeList.getChild('3'))['Text']) +self.assertEqual("0.500", get_state_as_dict(xTreeList.getChild('3'))['Text']) +self.assertEqual("0.516", get_state_as_dict(xTreeList.getChild('4'))['Text']) + +self.assertEqual('false', get_state_as_dict(xTreeList.getChild('0'))['IsChecked']) +self.assertEqual('true', get_state_as_dict(xTreeList.getChild('1'))['IsChecked']) +self.assertEqual('false', get_state_as_dict(xTreeList.getChild('2'))['IsChecked']) +self.assertEqual('true', get_state_as_dict(xTreeList.getChild('3'))['IsChecked']) +self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked']) xFirstEntry = xTreeList.getChild("0") xFirstEntry.executeAction("CLICK", tuple()) @@ -365,6 +385,7 @@ class AutofilterTest(UITestCase): self.assertTrue(is_row_hidden(doc, 4)) self.assertFalse(is_row_hidden(doc, 5)) self.assertFalse(is_row_hidden(doc, 6)) +self.assertFalse(is_row_hidden(doc, 7)) self.ui_test.close_doc() diff --git a/sc/qa/uitest/data/autofilter/tdf140968.xlsx b/sc/qa/uitest/data/autofilter/tdf140968.xlsx index b2b5b2a3e654..e4dd31bd14dd 100644 Binary files a/sc/qa/uitest/data/autofilter/tdf140968.xlsx and b/sc/qa/uitest/data/autofilter/tdf140968.xlsx differ diff --git a/sc/qa/uitest/data/autofilter/time_value.xlsx b/sc/qa/uitest/data/autofilter/time_value.xlsx index 4dc6cf85eb2e..e81b4f24e3e4 100644 Binary files a/sc/qa/uitest/data/autofilter/time_value.xlsx and b/sc/qa/uitest/data/autofilter/time_value.xlsx differ diff --git a/sc/source/ui/unoobj/datauno.cxx
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf142231.ods|binary sc/qa/unit/subsequent_export-test.cxx| 14 ++ sc/source/filter/xml/XMLExportDatabaseRanges.cxx |4 3 files changed, 18 insertions(+) New commits: commit f2c9da1ef662d10726a2dc709b46722ec7d4a016 Author: Szabolcs Toth AuthorDate: Wed May 19 08:25:11 2021 +0200 Commit: Balazs Varga CommitDate: Wed May 26 09:11:26 2021 +0200 tdf#142231 sc odf: fix export of single date filter value by export the sting value of the filter condition, if its filter by date. Change-Id: I537fbd43810c78c0834480c9f1a480481aedd742 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115775 Tested-by: Balazs Varga Reviewed-by: Balazs Varga diff --git a/sc/qa/unit/data/ods/tdf142231.ods b/sc/qa/unit/data/ods/tdf142231.ods new file mode 100644 index ..8b3e235625ce Binary files /dev/null and b/sc/qa/unit/data/ods/tdf142231.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 7a74e6ebf1f6..ee9f0ee110e5 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -220,6 +220,7 @@ public: void testTdf95640_ods_to_xlsx_with_standard_list(); void testTdf95640_xlsx_to_xlsx(); void testDateAutofilterXLSX(); +void testDateAutofilterODS(); void testAutofilterColorsODF(); void testAutofilterColorsOOXML(); void testAutofilterColorsStyleOOXML(); @@ -410,6 +411,7 @@ public: CPPUNIT_TEST(testTdf95640_ods_to_xlsx_with_standard_list); CPPUNIT_TEST(testTdf95640_xlsx_to_xlsx); CPPUNIT_TEST(testDateAutofilterXLSX); +CPPUNIT_TEST(testDateAutofilterODS); CPPUNIT_TEST(testAutofilterColorsODF); CPPUNIT_TEST(testAutofilterColorsOOXML); CPPUNIT_TEST(testAutofilterColorsStyleOOXML); @@ -4643,6 +4645,18 @@ void ScExportTest::testDateAutofilterXLSX() xDocSh->DoClose(); } +void ScExportTest::testDateAutofilterODS() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf142231.", FORMAT_ODS); +CPPUNIT_ASSERT(xDocSh.is()); + +xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "content.xml", FORMAT_ODS); +CPPUNIT_ASSERT(pDoc); + +assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[1]", "value", "Calc"); +assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[2]", "value", "2021-05-04"); +} + void ScExportTest::testAutofilterColorsODF() { ScDocShellRef xDocSh = loadDoc(u"autofilter-colors.", FORMAT_ODS); diff --git a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx index c3f651e5416b..4e171d5b9da6 100644 --- a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx +++ b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx @@ -459,6 +459,10 @@ private: mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_TEXT); mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_VALUE, rItem.maString.getString()); } +else if (rItem.meType == ScQueryEntry::ByDate) +{ +mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_VALUE, rItem.maString.getString()); +} else if (rItem.meType == ScQueryEntry::ByTextColor || rItem.meType == ScQueryEntry::ByBackgroundColor) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/autofilter/autofilter.py | 43 ++ sc/source/ui/view/gridwin.cxx |9 ++- 2 files changed, 51 insertions(+), 1 deletion(-) New commits: commit 45a49b7a1b552f204e7b417cfbe2d86e4b169993 Author: Tünde Tóth AuthorDate: Tue May 18 15:41:51 2021 +0200 Commit: László Németh CommitDate: Fri May 21 18:04:20 2021 +0200 tdf#142350 sc AutoFilter: fix (empty) entry checking When a column was filtered for values that included 0, but not the (empty) entry, the (empty) entry also was checked in the Autofilter dropdown. Regression from commit 4fd1333ba4bb4f2311e9098291154772bd310429 "tdf#140968 tdf#140978 XLSX import: fix lost rounded filters". Change-Id: Ic2595c707bd43f1a19c86d2ee796f06d9b1af1e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115755 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index 7b1c043c67e2..00cfa6fbd9ba 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -366,5 +366,48 @@ class AutofilterTest(UITestCase): self.assertFalse(is_row_hidden(doc, 5)) self.assertFalse(is_row_hidden(doc, 6)) +self.ui_test.close_doc() + +def test_tdf142350(self): +self.ui_test.create_doc_in_start_center("calc") +document = self.ui_test.get_component() +calcDoc = self.xUITest.getTopFocusWindow() +gridwin = calcDoc.getChild("grid_window") +document = self.ui_test.get_component() + +enter_text_to_cell(gridwin, "A1", "A") +enter_text_to_cell(gridwin, "A2", "0") +enter_text_to_cell(gridwin, "A3", "") +enter_text_to_cell(gridwin, "A4", "1") + +gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + +self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + +gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xList = xCheckListMenu.getChild("check_list_box") +xEntry = xList.getChild("2") +xEntry.executeAction("CLICK", tuple()) + +xOkButton = xFloatWindow.getChild("ok") +xOkButton.executeAction("CLICK", tuple()) + +self.assertFalse(is_row_hidden(document, 1)) +self.assertTrue(is_row_hidden(document, 2)) +self.assertFalse(is_row_hidden(document, 3)) + +gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(3, len(xList.getChildren())) +self.assertEqual('true', get_state_as_dict(xList.getChild('0'))['IsChecked']) +self.assertEqual('true', get_state_as_dict(xList.getChild('1'))['IsChecked']) +self.assertEqual('false', get_state_as_dict(xList.getChild('2'))['IsChecked']) +xCloseButton = xFloatWindow.getChild("cancel") +xCloseButton.executeAction("CLICK", tuple()) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 0cd90461a37c..644feab4b654 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -684,7 +684,14 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow) const double aDoubleVal = rEntry.GetValue(); bool bSelected = true; if (!aSelectedValue.empty() || !aSelectedString.empty()) -bSelected = aSelectedValue.count(aDoubleVal) > 0 || aSelectedString.count(aStringVal) > 0; +{ +if (aStringVal.isEmpty()) +bSelected = aSelectedString.count(aStringVal) > 0; +else +bSelected += aSelectedValue.count(aDoubleVal) > 0 || aSelectedString.count(aStringVal) > 0; +} + if ( rEntry.IsDate() ) rControl.addDateMember( aStringVal, rEntry.GetValue(), bSelected ); else ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc_copypaste.cxx | 57 +++ sc/source/core/data/documen3.cxx |2 - 2 files changed, 58 insertions(+), 1 deletion(-) New commits: commit fd0779f6a0fd04263155d293320546ce7cbae84b Author: scito AuthorDate: Fri May 21 11:06:20 2021 +0200 Commit: Mike Kaganski CommitDate: Fri May 21 12:32:47 2021 +0200 tdf#71058 cut paste transposed: use correct clipdoc ScDocument: :UpdateTranspose() operated on the wrong clipdoc Change-Id: I10fb010c7b6a1d523a1af92d67fc127957f9d17f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115901 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index 40536a573d90..0bbd326eb128 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -114,6 +114,7 @@ public: void testCopyPasteFormulas(); void testCopyPasteFormulasExternalDoc(); void testCopyPasteReferencesExternalDoc(); // tdf#106456 +void testTdf71058(); CPPUNIT_TEST_SUITE(TestCopyPaste); @@ -188,6 +189,8 @@ public: CPPUNIT_TEST(testCopyPasteFormulasExternalDoc); CPPUNIT_TEST(testCopyPasteReferencesExternalDoc); +CPPUNIT_TEST(testTdf71058); + CPPUNIT_TEST_SUITE_END(); private: @@ -6817,6 +6820,60 @@ void TestCopyPaste::testCopyPasteReferencesExternalDoc() xExtDocSh->DoClose(); } +void TestCopyPaste::testTdf71058() +{ +const SCTAB nTab = 0; +m_pDoc->InsertTab(nTab, "Test"); + +m_pDoc->SetString(2, 2, nTab, "=C4"); // C3 +m_pDoc->SetString(3, 2, nTab, "=D4"); // D3 +m_pDoc->SetValue(2, 3, nTab, 1.0); // C4 +m_pDoc->SetValue(3, 3, nTab, 2.0); // D4 + +// Cut C4:C5 to the clip document. +ScDocument aClipDoc(SCDOCMODE_CLIP); +ScRange aSrcRange(2, 3, nTab, 3, 3, nTab); +cutToClip(*m_xDocShell, aSrcRange, , false); + +// To E6:E7 +ScRange aDestRange(4, 5, nTab, 4, 6, nTab); +ScMarkData aDestMark(m_pDoc->GetSheetLimits()); + +// Transpose +ScDocument* pOrigClipDoc = +ScDocumentUniquePtr pTransClip(new ScDocument(SCDOCMODE_CLIP)); +aClipDoc.TransposeClip(pTransClip.get(), InsertDeleteFlags::ALL, false, true); +aDestMark.SetMarkArea(aDestRange); +// Paste +m_pDoc->CopyFromClip(aDestRange, aDestMark, InsertDeleteFlags::ALL, nullptr, pTransClip.get(), + true, false, true, false); +m_pDoc->UpdateTranspose(aDestRange.aStart, pOrigClipDoc, aDestMark, nullptr); +pTransClip.reset(); + +// Check precondition +CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(4, 5, nTab)); +CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(4, 6, nTab)); + +// Check results +// Without the fix in place, this would have failed with +// - Expected: =E6 +// - Actual : =C4 +ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(2, 2, nTab), "E6", "Wrong formula"); +// Without the fix in place, this would have failed with +// - Expected: 1 +// - Actual : 0 +CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(2, 2, nTab)); + +// Without the fix in place, this would have failed with +// - Expected: =E7 +// - Actual : =D4 +ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(3, 2, nTab), "E7", "Wrong formula"); +// Without the fix in place, this would have failed with +// - Expected: 2 +// - Actual : 0 +CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(3, 2, nTab)); +} + CPPUNIT_TEST_SUITE_REGISTRATION(TestCopyPaste); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 8de06d151d78..5db63b6e7815 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1112,7 +1112,7 @@ void ScDocument::UpdateTranspose( const ScAddress& rDestPos, ScDocument* pClipDo OSL_ENSURE(pClipDoc->bIsClip, "UpdateTranspose: No Clip"); ScRange aSource; -ScClipParam& rClipParam = GetClipParam(); +ScClipParam& rClipParam = pClipDoc->GetClipParam(); if (!rClipParam.maRanges.empty()) aSource = rClipParam.maRanges.front(); ScAddress aDest = rDestPos; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/autofilter-colors.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 29 +++ sc/source/filter/excel/excrecds.cxx | 33 +++- sc/source/filter/excel/xestyle.cxx | 115 +--- sc/source/filter/excel/xlstyle.cxx |7 + sc/source/filter/inc/excrecds.hxx | 10 ++ sc/source/filter/inc/xestyle.hxx|9 ++ sc/source/filter/inc/xlstyle.hxx|1 8 files changed, 192 insertions(+), 12 deletions(-) New commits: commit b8cfea65ddcba33572e9687022de3c813711e298 Author: Samuel Mehrbrodt AuthorDate: Wed May 19 11:05:27 2021 +0200 Commit: Samuel Mehrbrodt CommitDate: Wed May 19 15:41:34 2021 +0200 tdf#76258 Add OOXML export for color filter Change-Id: I4c0e2fbe27de6d48a33aba230c35d3b74854e27e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115789 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt diff --git a/sc/qa/unit/data/xlsx/autofilter-colors.xlsx b/sc/qa/unit/data/xlsx/autofilter-colors.xlsx new file mode 100644 index ..e4f8e67b202d Binary files /dev/null and b/sc/qa/unit/data/xlsx/autofilter-colors.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 4864266b8790..6d1b927e931a 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -221,6 +221,8 @@ public: void testTdf95640_xlsx_to_xlsx(); void testDateAutofilterXLSX(); void testAutofilterColorsODF(); +void testAutofilterColorsOOXML(); +void testAutofilterColorsStyleOOXML(); void testRefStringXLSX(); void testRefStringConfigXLSX(); @@ -409,6 +411,8 @@ public: CPPUNIT_TEST(testTdf95640_xlsx_to_xlsx); CPPUNIT_TEST(testDateAutofilterXLSX); CPPUNIT_TEST(testAutofilterColorsODF); +CPPUNIT_TEST(testAutofilterColorsOOXML); +CPPUNIT_TEST(testAutofilterColorsStyleOOXML); CPPUNIT_TEST(testRefStringXLSX); CPPUNIT_TEST(testRefStringConfigXLSX); @@ -4653,6 +4657,31 @@ void ScExportTest::testAutofilterColorsODF() assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[2][@loext:data-type='text-color']"); } +void ScExportTest::testAutofilterColorsOOXML() +{ +ScDocShellRef xDocSh = loadDoc(u"autofilter-colors.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, + "xl/tables/table1.xml", FORMAT_XLSX); +CPPUNIT_ASSERT(pDoc); + +assertXPath(pDoc, "/x:table/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId", "4"); +} + +void ScExportTest::testAutofilterColorsStyleOOXML() +{ +ScDocShellRef xDocSh = loadDoc(u"autofilter-colors.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +xmlDocUniquePtr pDoc += XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); +CPPUNIT_ASSERT(pDoc); + +assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf[5]/x:fill/x:patternFill/x:bgColor", "rgb", +"D7D7"); +} + void ScExportTest::testTdf88657ODS() { ScDocShellRef xDocSh = loadDoc(u"tdf88657.", FORMAT_ODS); diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index b73c695391bd..c1f45823efcd 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -711,6 +712,10 @@ bool XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry ) } else if(rEntry.IsQueryByNonEmpty()) bConflict = !AddCondition( rEntry.eConnect, EXC_AFTYPE_NOTEMPTY, EXC_AFOPER_NONE, 0.0, nullptr, true ); +else if (rEntry.IsQueryByTextColor() || rEntry.IsQueryByBackgroundColor()) +{ +AddColorEntry(rEntry); +} // other conditions else { @@ -794,6 +799,17 @@ void XclExpAutofilter::AddMultiValueEntry( const ScQueryEntry& rEntry ) } } +void XclExpAutofilter::AddColorEntry(const ScQueryEntry& rEntry) +{ +meType = ColorValue; +const ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems(); +for (const auto& rItem : rItems) +{ +maColorValues.push_back( +std::make_pair(rItem.maColor, rItem.meType == ScQueryEntry::ByBackgroundColor)); +} +} + void XclExpAutofilter::WriteBody( XclExpStream& rStrm ) { rStrm << nCol << nFlags; @@ -835,8 +851,21 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm ) aCond[ 0 ].SaveXml( rStrm ); aCond[ 1 ].SaveXml( rStrm ); rWorksheet->endElement( XML_customFilters ); -// OOXTODO: XLM_colorFilter, XML_dynamicFilter, -// XML_extLst, XML_filters, XML_iconFilter, XML_top10 +// OOXTODO: XML_dynamicFilter, XML_extLst, XML_filters, XML_iconFilter +} +break; +
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx | 26 ++ sc/source/ui/unoobj/defltuno.cxx |3 +++ 2 files changed, 29 insertions(+) New commits: commit a796aa9d65e3d4292232820d424b3f62c673fa07 Author: Maxim Monastirsky AuthorDate: Sun Feb 7 17:42:27 2021 +0200 Commit: Eike Rathke CommitDate: Thu May 13 18:26:12 2021 +0200 tdf#112559 sc: Expose font height via the Defaults UNO API This fixes both ODF import and export of the default cell style. Change-Id: I776591c6ed932a136b95107d3c4a0f25c1bebdf1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110539 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 01cf0a236a24..4864266b8790 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -89,6 +90,7 @@ public: virtual void tearDown() override; void test(); +void testDefaultFontHeight(); void testTdf139167(); void testTdf113271(); void testTdf139394(); @@ -293,6 +295,7 @@ public: CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); +CPPUNIT_TEST(testDefaultFontHeight); CPPUNIT_TEST(testTdf139167); CPPUNIT_TEST(testTdf113271); CPPUNIT_TEST(testTdf139394); @@ -544,6 +547,29 @@ void ScExportTest::test() xDocSh->DoClose(); } +void ScExportTest::testDefaultFontHeight() +{ +ScDocShellRef xDocSh = new ScDocShell; +xDocSh->DoInitNew(); + +ScDocumentPool* pPool = xDocSh->GetDocument().GetPool(); +pPool->SetPoolDefaultItem(SvxFontHeightItem(400, 100, ATTR_FONT_HEIGHT)); +pPool->SetPoolDefaultItem(SvxFontHeightItem(400, 100, ATTR_CJK_FONT_HEIGHT)); +pPool->SetPoolDefaultItem(SvxFontHeightItem(400, 100, ATTR_CTL_FONT_HEIGHT)); + +xDocSh = saveAndReload(xDocSh.get(), FORMAT_ODS); + +pPool = xDocSh->GetDocument().GetPool(); +const SvxFontHeightItem& rItem = pPool->GetDefaultItem(ATTR_FONT_HEIGHT); +CPPUNIT_ASSERT_EQUAL(sal_uInt32(400), rItem.GetHeight()); +const SvxFontHeightItem& rCJKItem = pPool->GetDefaultItem(ATTR_CJK_FONT_HEIGHT); +CPPUNIT_ASSERT_EQUAL(sal_uInt32(400), rCJKItem.GetHeight()); +const SvxFontHeightItem& rCTLItem = pPool->GetDefaultItem(ATTR_CTL_FONT_HEIGHT); +CPPUNIT_ASSERT_EQUAL(sal_uInt32(400), rCTLItem.GetHeight()); + +xDocSh->DoClose(); +} + void ScExportTest::testTdf139167() { ScDocShellRef xShell = loadDoc(u"tdf139167.", FORMAT_XLSX); diff --git a/sc/source/ui/unoobj/defltuno.cxx b/sc/source/ui/unoobj/defltuno.cxx index b09a5a004d2b..ae2fe0242892 100644 --- a/sc/source/ui/unoobj/defltuno.cxx +++ b/sc/source/ui/unoobj/defltuno.cxx @@ -59,6 +59,9 @@ static const SfxItemPropertyMapEntry* lcl_GetDocDefaultsMap() {u"" SC_UNONAME_CLOCAL, ATTR_FONT_LANGUAGE, cppu::UnoType::get(), 0, MID_LANG_LOCALE }, {u"" SC_UNO_CJK_CLOCAL, ATTR_CJK_FONT_LANGUAGE, cppu::UnoType::get(), 0, MID_LANG_LOCALE }, {u"" SC_UNO_CTL_CLOCAL, ATTR_CTL_FONT_LANGUAGE, cppu::UnoType::get(), 0, MID_LANG_LOCALE }, +{u"" SC_UNONAME_CHEIGHT, ATTR_FONT_HEIGHT, cppu::UnoType::get(), 0, MID_FONTHEIGHT | CONVERT_TWIPS }, +{u"" SC_UNO_CJK_CHEIGHT, ATTR_CJK_FONT_HEIGHT, cppu::UnoType::get(), 0, MID_FONTHEIGHT | CONVERT_TWIPS }, +{u"" SC_UNO_CTL_CHEIGHT, ATTR_CTL_FONT_HEIGHT, cppu::UnoType::get(), 0, MID_FONTHEIGHT | CONVERT_TWIPS }, {u"" SC_UNO_STANDARDDEC, 0, cppu::UnoType::get(),0, 0 }, {u"" SC_UNO_TABSTOPDIS, 0, cppu::UnoType::get(),0, 0 }, { u"", 0, css::uno::Type(), 0, 0 } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx| 19 --- sc/source/core/data/column3.cxx | 28 2 files changed, 36 insertions(+), 11 deletions(-) New commits: commit ca2ec443893731093970914feb750b31ea13e47f Author: Dennis Francis AuthorDate: Fri May 7 16:32:52 2021 +0530 Commit: Dennis Francis CommitDate: Thu May 13 16:23:46 2021 +0200 tdf#142214: autocomplete: do not search across empty blocks Change-Id: Ia5b0be1eed2bf645fa1e53d71abc7b2e67dfaa0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115458 Tested-by: Jenkins Reviewed-by: Dennis Francis diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 72e25f2f5b91..32db14e20be2 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -613,14 +613,22 @@ void Test::testDataEntries() m_pDoc->SetString(ScAddress(0,5,0), "Andy"); m_pDoc->SetString(ScAddress(0,6,0), "Bruce"); m_pDoc->SetString(ScAddress(0,7,0), "Charlie"); +m_pDoc->SetValue(ScAddress(0,8,0), 100); +m_pDoc->SetValue(ScAddress(0,9,0), 200); m_pDoc->SetString(ScAddress(0,10,0), "Andy"); +m_pDoc->SetValue(ScAddress(0,11,0), 1000); std::vector aEntries; -m_pDoc->GetDataEntries(0, 0, 0, aEntries); // Try at the very top. +m_pDoc->GetDataEntries(0, 0, 0, aEntries); // Try at the top. +std::vector::const_iterator it = aEntries.begin(); +CPPUNIT_ASSERT_MESSAGE("The entries should be empty.", bool(it == aEntries.end())); + +aEntries.clear(); +m_pDoc->GetDataEntries(0, 4, 0, aEntries); // Try at A5. // Entries are supposed to be sorted in ascending order, and are all unique. CPPUNIT_ASSERT_EQUAL(static_cast(3), aEntries.size()); -std::vector::const_iterator it = aEntries.begin(); +it = aEntries.begin(); CPPUNIT_ASSERT_EQUAL(OUString("Andy"), it->GetString()); ++it; CPPUNIT_ASSERT_EQUAL(OUString("Bruce"), it->GetString()); @@ -630,7 +638,7 @@ void Test::testDataEntries() CPPUNIT_ASSERT_MESSAGE("The entries should have ended here.", bool(it == aEntries.end())); aEntries.clear(); -m_pDoc->GetDataEntries(0, MAXROW, 0, aEntries); // Try at the very bottom. +m_pDoc->GetDataEntries(0, 12, 0, aEntries); // Try at A13. CPPUNIT_ASSERT_EQUAL(static_cast(3), aEntries.size()); // Make sure we get the same set of suggestions. @@ -643,6 +651,11 @@ void Test::testDataEntries() ++it; CPPUNIT_ASSERT_MESSAGE("The entries should have ended here.", bool(it == aEntries.end())); +aEntries.clear(); +m_pDoc->GetDataEntries(0, MAXROW, 0, aEntries); // Try at the bottom. +it = aEntries.begin(); +CPPUNIT_ASSERT_MESSAGE("The entries should be empty.", bool(it == aEntries.end())); + m_pDoc->DeleteTab(0); } diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index eef630c6f297..51bc475d135f 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2585,6 +2585,11 @@ public: return (maPos.first->type == sc::element_type_string || maPos.first->type == sc::element_type_edittext); } +bool isEmpty() const +{ +return maPos.first->type == sc::element_type_empty; +} + bool prev() { if (!has()) @@ -2592,7 +2597,7 @@ public: // Not in a string block. Move back until we hit a string block. while (!has()) { -if (maPos.first == miBeg) +if (isEmpty() || maPos.first == miBeg) return false; --maPos.first; // move to the preceding block. @@ -2618,6 +2623,10 @@ public: // Move to the last cell of the previous block. --maPos.first; maPos.second = maPos.first->size - 1; + +if (isEmpty()) +return false; + if (has()) break; } @@ -2632,6 +2641,9 @@ public: // Not in a string block. Move forward until we hit a string block. while (!has()) { +if (isEmpty()) +return false; + ++maPos.first; if (maPos.first == miEnd) return false; @@ -2653,6 +2665,10 @@ public: return false; maPos.second = 0; + +if (isEmpty()) +return false; + if (has()) break; } @@ -2694,16 +2710,12 @@ bool ScColumn::GetDataEntries( // going upward and downward directions in parallel. The start position // cell must be skipped. -StrCellIterator aItrUp(maCells, nStartRow, ()); +StrCellIterator aItrUp(maCells, nStartRow-1, ()); StrCellIterator aItrDown(maCells, nStartRow+1, ()); bool bMoveUp = aItrUp.valid(); -if (!bMoveUp) -// Current cell is invalid. -return false; - -// Skip
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/autofilternamedrange.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx | 23 +++ sc/source/filter/inc/workbookhelper.hxx|4 ++-- sc/source/filter/oox/defnamesbuffer.cxx| 11 ++- sc/source/filter/oox/workbookhelper.cxx| 25 ++--- 5 files changed, 45 insertions(+), 18 deletions(-) New commits: commit 3cd6402c5443c8069c07d9e420d5ef5b43af6bef Author: Balazs Varga AuthorDate: Thu May 6 18:47:30 2021 +0200 Commit: László Németh CommitDate: Mon May 10 12:39:38 2021 +0200 tdf#127301 XLSX import: hide hidden named range of autofilter Create but not insert/add hidden FILTER_CRITERIA (_xlnm._FilterDatabase) to ScRangeName, because no need for them, so avoid of creating extra named ranges by autofilter re-range (shown in Sheet -> Named Ranges and Expressions -> Manage...). See also commit 3a2263a20629b0a3e9b4935dd43dc59817d0241c "mib17: #163146# XLS import: do not skip hidden names[...]". Change-Id: Ibfd86942a99b251a59394955bc890e6dbe0390f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115189 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/xlsx/autofilternamedrange.xlsx b/sc/qa/unit/data/xlsx/autofilternamedrange.xlsx new file mode 100644 index ..51490d9229ea Binary files /dev/null and b/sc/qa/unit/data/xlsx/autofilternamedrange.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 0d8e08fd1813..4529a123edb8 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -317,6 +317,7 @@ public: void testDeleteCirclesInRowAndCol(); void testTdf129940(); void testTdf139763ShapeAnchor(); +void testAutofilterNamedRangesXLSX(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testCondFormatOperatorsSameRangeXLSX); @@ -517,6 +518,7 @@ public: CPPUNIT_TEST(testDeleteCirclesInRowAndCol); CPPUNIT_TEST(testTdf129940); CPPUNIT_TEST(testTdf139763ShapeAnchor); +CPPUNIT_TEST(testAutofilterNamedRangesXLSX); CPPUNIT_TEST_SUITE_END(); @@ -5795,6 +5797,27 @@ void ScFiltersTest::testTdf139763ShapeAnchor() xDocSh->DoClose(); } +void ScFiltersTest::testAutofilterNamedRangesXLSX() +{ +ScDocShellRef xDocSh = loadDoc(u"autofilternamedrange.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load autofilternamedrange.xlsx", xDocSh.is()); + +ScDocument& rDoc = xDocSh->GetDocument(); +const ScDBData* pDBData = rDoc.GetDBCollection()->GetDBNearCursor(0, 0, 0); +CPPUNIT_ASSERT(pDBData); +ScRange aRange; +pDBData->GetArea(aRange); +CPPUNIT_ASSERT_EQUAL(ScRange(0, 0, 0, 0, 3, 0), aRange); +OUString aPosStr; +bool bSheetLocal = false; +// test there is no '_xlnm._FilterDatabase' named range on the filter area +const ScRangeData* pRData = rDoc.GetRangeAtBlock(aRange, aPosStr, ); +CPPUNIT_ASSERT(!pRData); +CPPUNIT_ASSERT_EQUAL(OUString(), aPosStr); + +xDocSh->DoClose(); +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "sc/qa/unit/data" ) { diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx index 4491dcbb084f..e6633d15f4f9 100644 --- a/sc/source/filter/inc/workbookhelper.hxx +++ b/sc/source/filter/inc/workbookhelper.hxx @@ -167,7 +167,7 @@ public: OUString& orName, const css::uno::Sequence< css::sheet::FormulaToken>& rTokens, sal_Int32 nIndex, -sal_Int32 nNameFlags ) const; +sal_Int32 nNameFlags, bool bHidden ) const; /** Creates and returns a defined name on-the-fly in the sheet. The name will not be buffered in the global defined names buffer. @@ -176,7 +176,7 @@ public: OUString& orName, const css::uno::Sequence< css::sheet::FormulaToken>& rTokens, sal_Int32 nIndex, -sal_Int32 nNameFlags, sal_Int32 nTab ) const; +sal_Int32 nNameFlags, sal_Int32 nTab, bool bHidden ) const; /** Creates and returns a database range on-the-fly in the Calc document. The range will not be buffered in the global table buffer. diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx index 733d4790f8ff..5f1bc1c01bf4 100644 --- a/sc/source/filter/oox/defnamesbuffer.cxx +++ b/sc/source/filter/oox/defnamesbuffer.cxx @@ -225,16 +225,17 @@ void DefinedName::createNameObject( sal_Int32 nIndex ) using namespace ::com::sun::star::sheet::NamedRangeFlag; if( !isGlobalName() ) switch( mcBuiltinId ) { -case BIFF_DEFNAME_CRITERIA: nNameFlags = FILTER_CRITERIA; break; -
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/functions/statistical/fods/forecast.ets.mult.fods | 22 +-- sc/source/core/tool/interpr8.cxx | 56 +- 2 files changed, 41 insertions(+), 37 deletions(-) New commits: commit 38c88aca77f8c8ef47470723557ddf9e5d9d7b66 Author: dante AuthorDate: Wed May 5 10:57:14 2021 +0200 Commit: Mike Kaganski CommitDate: Fri May 7 14:29:39 2021 +0200 tdf#137679 Use Kahan summation for interpr8.cxx Change-Id: Id43765f7d8f51066da4bbebcfc175a0e69a58fde Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115127 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/qa/unit/data/functions/statistical/fods/forecast.ets.mult.fods b/sc/qa/unit/data/functions/statistical/fods/forecast.ets.mult.fods index 0c45eb46cd8c..150ec6b68115 100644 --- a/sc/qa/unit/data/functions/statistical/fods/forecast.ets.mult.fods +++ b/sc/qa/unit/data/functions/statistical/fods/forecast.ets.mult.fods @@ -8555,10 +8555,10 @@ - - 190.641123921524 + + 190.641123921525 - + 190.641124 @@ -9014,11 +9014,11 @@ - - 268.59802115122 + + 268.598021151221 - - 268.59802115122 + + 268.598021151221 TRUE @@ -9196,11 +9196,11 @@ - - 267.531016699979 + + 267.531016699980 - - 267.531016699979 + + 267.531016699980 TRUE diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx index 750b42572706..64bb3d1d8a8e 100644 --- a/sc/source/core/tool/interpr8.cxx +++ b/sc/source/core/tool/interpr8.cxx @@ -353,9 +353,9 @@ bool ScETSForecastCalculation::PreprocessDataRange( const ScMatrixRef& rMatX, co { // gap, insert missing data points double fYGap = ( maRange[ i ].Y + maRange[ i - 1 ].Y ) / 2.0; -for ( double fXGap = maRange[ i - 1].X + mfStepSize; fXGap < maRange[ i ].X; fXGap += mfStepSize ) +for ( KahanSum fXGap = maRange[ i - 1].X + mfStepSize; fXGap < maRange[ i ].X; fXGap += mfStepSize ) { -maRange.insert( maRange.begin() + i, DataPoint( fXGap, ( bDataCompletion ? fYGap : 0.0 ) ) ); +maRange.insert( maRange.begin() + i, DataPoint( fXGap.get(), ( bDataCompletion ? fYGap : 0.0 ) ) ); i++; mnCount++; nMissingXCount++; @@ -419,10 +419,13 @@ bool ScETSForecastCalculation::prefillTrendData() return false; } -double fSum = 0.0; +KahanSum fSum = 0.0; for ( SCSIZE i = 0; i < mnSmplInPrd; i++ ) -fSum += maRange[ i + mnSmplInPrd ].Y - maRange[ i ].Y; -double fTrend = fSum / static_cast< double >( mnSmplInPrd * mnSmplInPrd ); +{ +fSum += maRange[ i + mnSmplInPrd ].Y; +fSum -= maRange[ i ].Y; +} +double fTrend = fSum.get() / static_cast< double >( mnSmplInPrd * mnSmplInPrd ); mpTrend[ 0 ] = fTrend; } @@ -442,7 +445,7 @@ bool ScETSForecastCalculation::prefillPerIdx() return false; } SCSIZE nPeriods = mnCount / mnSmplInPrd; -std::vector< double > aPeriodAverage( nPeriods, 0.0 ); +std::vector< KahanSum > aPeriodAverage( nPeriods, 0.0 ); for ( SCSIZE i = 0; i < nPeriods ; i++ ) { for ( SCSIZE j = 0; j < mnSmplInPrd; j++ ) @@ -458,20 +461,20 @@ bool ScETSForecastCalculation::prefillPerIdx() for ( SCSIZE j = 0; j < mnSmplInPrd; j++ ) { -double fI = 0.0; +KahanSum fI = 0.0; for ( SCSIZE i = 0; i < nPeriods ; i++ ) { // adjust average value for position within period if ( bAdditive ) -fI += ( maRange[ i * mnSmplInPrd + j ].Y - -( aPeriodAverage[ i ] + ( static_cast< double >( j ) - 0.5 * ( mnSmplInPrd - 1 ) ) * - mpTrend[ 0 ] ) ); +fI += maRange[ i * mnSmplInPrd + j ].Y - +( aPeriodAverage[ i ].get() + ( static_cast< double >( j ) - 0.5 * ( mnSmplInPrd - 1 ) ) * + mpTrend[ 0 ] ); else -fI += ( maRange[ i * mnSmplInPrd + j ].Y / -( aPeriodAverage[ i ] + ( static_cast< double >( j ) - 0.5 * ( mnSmplInPrd - 1 ) ) * - mpTrend[ 0 ] ) ); +fI += maRange[ i * mnSmplInPrd + j ].Y / +( aPeriodAverage[ i ].get() + ( static_cast< double >( j ) - 0.5 * ( mnSmplInPrd - 1 ) ) * + mpTrend[ 0 ] ); } -mpPerIdx[ j ] = fI / nPeriods; +mpPerIdx[ j ] = fI.get() /
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/uicalc/uicalc.cxx | 39 ++- sc/source/ui/view/cellsh1.cxx |2 ++ 2 files changed, 36 insertions(+), 5 deletions(-) New commits: commit 7b450b6ccd9f9bee0bb47500e7bf71f9ba641e36 Author: scito AuthorDate: Thu May 6 20:33:48 2021 +0200 Commit: Mike Kaganski CommitDate: Fri May 7 09:20:54 2021 +0200 tdf#102255 improve test and docu of .uno:PasteTransposed check that relevant types, notes and attributes are pasted, i.e. the uno command sets the right parameters Improvement of my former commit 02b72784e5601636d26c8e4592958c262efb1a7d Change-Id: I1d8e7d09a867bbabe719bcdd8c7e908ab100aa4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115191 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 2dff22da94b0..abd9ad47646e 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -521,8 +521,25 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testPasteTransposed) CPPUNIT_ASSERT(pDoc); insertStringToCell(*pModelObj, "A1", "1"); -insertStringToCell(*pModelObj, "A2", "2"); -insertStringToCell(*pModelObj, "A3", "3"); +insertStringToCell(*pModelObj, "A2", "a"); +insertStringToCell(*pModelObj, "A3", "=A1"); + +// Add a note to A1 +goToCell("A1"); +uno::Sequence aArgs += comphelper::InitPropertySequence({ { "Text", uno::makeAny(OUString("Note in A1")) } }); +dispatchCommand(mxComponent, ".uno:InsertAnnotation", aArgs); + +// Set A2 bold +goToCell("A2"); +dispatchCommand(mxComponent, ".uno:Bold", {}); + +// Check preconditions +CPPUNIT_ASSERT_MESSAGE("There should be a note on A1", pDoc->HasNote(ScAddress(0, 0, 0))); +const ScPatternAttr* pPattern = pDoc->GetPattern(0, 1, 0); +vcl::Font aFont; +pPattern->GetFont(aFont, SC_AUTOCOL_RAW); +CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, aFont.GetWeight()); goToCell("A1:A3"); @@ -539,9 +556,21 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testPasteTransposed) dispatchCommand(mxComponent, ".uno:PasteTransposed", {}); -CPPUNIT_ASSERT_EQUAL(OUString("1"), pDoc->GetString(ScAddress(0, 0, 0))); // A1 -CPPUNIT_ASSERT_EQUAL(OUString("2"), pDoc->GetString(ScAddress(1, 0, 0))); // B1 -CPPUNIT_ASSERT_EQUAL(OUString("3"), pDoc->GetString(ScAddress(2, 0, 0))); // C1 +OUString aFormula; +CPPUNIT_ASSERT_EQUAL(OUString("1"), pDoc->GetString(0, 0, 0)); // A1 +CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(0, 0, 0)); // A1 +CPPUNIT_ASSERT_EQUAL(OUString("a"), pDoc->GetString(1, 0, 0)); // B1 +pDoc->GetFormula(2, 0, 0, aFormula); // C1 +CPPUNIT_ASSERT_EQUAL(OUString("=A1"), aFormula); // C1 +CPPUNIT_ASSERT_EQUAL(OUString("1"), pDoc->GetString(2, 0, 0)); // C1 +CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(2, 0, 0)); // C1 + +CPPUNIT_ASSERT_MESSAGE("There should be a note on A1", pDoc->HasNote(ScAddress(0, 0, 0))); +CPPUNIT_ASSERT_EQUAL(OUString("Note in A1"), pDoc->GetNote(ScAddress(0, 0, 0))->GetText()); + +pPattern = pDoc->GetPattern(1, 0, 0); +pPattern->GetFont(aFont, SC_AUTOCOL_RAW); +CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, aFont.GetWeight()); } CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf131442) diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index efa1e4dae4c8..f7abd1908f1a 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1517,6 +1517,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ScTabViewShell::GetClipData(GetViewData().GetActiveWin( // own cell data { rReq.SetSlot(FID_INS_CELL_CONTENTS); +// By default content (values/numbers, strings, formulas and dates), +// attributes and notes are pasted rReq.AppendItem(SfxBoolItem(FN_PARAM_3, true)); // transpose ExecuteSlot(rReq, GetInterface()); rReq.SetReturnValue(SfxInt16Item(nSlot, 1)); // 1 = success ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/functions/statistical/fods/forecast.fods | 10 +- sc/source/core/tool/interpr3.cxx | 70 +++ 2 files changed, 38 insertions(+), 42 deletions(-) New commits: commit 040451e19087d8cb8ff4376166ca8248f909a4e0 Author: dante AuthorDate: Sat May 1 10:41:43 2021 +0200 Commit: Mike Kaganski CommitDate: Mon May 3 13:53:58 2021 +0200 tdf#137679 Use Kahan summation for interpr3.cxx (1/2) Change-Id: I8b07af0ad71f2be5acc8a660b93a48b9db6728f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114964 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/qa/unit/data/functions/statistical/fods/forecast.fods b/sc/qa/unit/data/functions/statistical/fods/forecast.fods index 2ec105af4d80..aafec26860b6 100644 --- a/sc/qa/unit/data/functions/statistical/fods/forecast.fods +++ b/sc/qa/unit/data/functions/statistical/fods/forecast.fods @@ -4197,11 +4197,11 @@ - - 129.554682838848 + + 129.554682838849 - - 129.554682838848 + + 129.554682838849 TRUE @@ -4950,4 +4950,4 @@ - \ No newline at end of file + diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index 193a9ca4b553..d0cd61c0a228 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -2915,7 +2915,7 @@ void ScInterpreter::ScKurt() void ScInterpreter::ScHarMean() { short nParamCount = GetByte(); -double nVal = 0.0; +KahanSum nVal = 0.0; double nValCount = 0.0; ScAddress aAdr; ScRange aRange; @@ -3028,7 +3028,7 @@ void ScInterpreter::ScHarMean() } } if (nGlobalError == FormulaError::NONE) -PushDouble( nValCount / nVal ); +PushDouble( nValCount / nVal.get() ); else PushError( nGlobalError); } @@ -3036,7 +3036,7 @@ void ScInterpreter::ScHarMean() void ScInterpreter::ScGeoMean() { short nParamCount = GetByte(); -double nVal = 0.0; +KahanSum nVal = 0.0; double nValCount = 0.0; ScAddress aAdr; ScRange aRange; @@ -3200,7 +3200,7 @@ void ScInterpreter::ScGeoMean() } } if (nGlobalError == FormulaError::NONE) -PushDouble(exp(nVal / nValCount)); +PushDouble(exp(nVal.get() / nValCount)); else PushError( nGlobalError); } @@ -3846,10 +3846,10 @@ void ScInterpreter::ScTrimMean() nIndex--; nIndex /= 2; OSL_ENSURE(nIndex < nSize, "ScTrimMean: wrong index"); -double fSum = 0.0; +KahanSum fSum = 0.0; for (SCSIZE i = nIndex; i < nSize-nIndex; i++) fSum += aSortArray[i]; -PushDouble(fSum/static_cast(nSize-2*nIndex)); +PushDouble(fSum.get()/static_cast(nSize-2*nIndex)); } } @@ -4285,7 +4285,7 @@ void ScInterpreter::ScAveDev() return; sal_uInt16 SaveSP = sp; double nMiddle = 0.0; -double rVal = 0.0; +KahanSum rVal = 0.0; double rValCount = 0.0; ScAddress aAdr; ScRange aRange; @@ -4369,7 +4369,7 @@ void ScInterpreter::ScAveDev() PushError( nGlobalError); return; } -nMiddle = rVal / rValCount; +nMiddle = rVal.get() / rValCount; sp = SaveSP; rVal = 0.0; nParam = nParamCount; @@ -4398,7 +4398,7 @@ void ScInterpreter::ScAveDev() ScValueIterator aValIter( mrDoc, aRange, mnSubTotalFlags ); if (aValIter.GetFirst(nCellVal, nErr)) { -rVal += (fabs(nCellVal - nMiddle)); +rVal += fabs(nCellVal - nMiddle); while (aValIter.GetNext(nCellVal, nErr)) rVal += fabs(nCellVal - nMiddle); } @@ -4433,7 +4433,7 @@ void ScInterpreter::ScAveDev() default : SetError(FormulaError::IllegalParameter); break; } } -PushDouble(rVal / rValCount); +PushDouble(rVal.get() / rValCount); } void ScInterpreter::ScDevSq() @@ -4477,8 +4477,8 @@ void ScInterpreter::ScProbability() PushNA(); else { -double fSum = 0.0; -double fRes = 0.0; +KahanSum fSum = 0.0; +KahanSum fRes = 0.0; bool bStop = false; double fP, fW; for ( SCSIZE i = 0; i < nC1 && !bStop; i++ ) @@ -4502,10 +4502,10 @@ void ScInterpreter::ScProbability() SetError( FormulaError::IllegalArgument); } } -if (bStop || fabs(fSum -1.0) > 1.0E-7) +if (bStop || std::abs((fSum -1.0).get()) > 1.0E-7) PushNoValue(); else -PushDouble(fRes); +PushDouble(fRes.get()); } } } @@ -4667,8 +4667,8 @@ void ScInterpreter::CalculateSlopeIntercept(bool bSlope) } // #i78250# numerical stability improved double fCount = 0.0; -
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/extras/macros-test.cxx| 35 sc/qa/extras/testdocuments/tdf90278.xls |binary sc/source/ui/vba/vbaborders.cxx |2 - 3 files changed, 36 insertions(+), 1 deletion(-) New commits: commit 357b36c7797ca7ac249714e5ddca1f04e0228c0e Author: Andreas Heinisch AuthorDate: Sat May 1 23:43:58 2021 +0200 Commit: Andreas Heinisch CommitDate: Mon May 3 11:27:49 2021 +0200 tdf#90278 - Set the vba border to the default border The default border width in calc is 0.75[pt] * 1/72[inch] * 2.54[cm/inch] = 0.0264[cm] set in 2f527738ea4f8e93acafdd7f0ae06de1678cfdd8 which contradicts the border setting of OOLineThin used in order to parse vba borders. The latter was set to 1.00[pt] * 1/72[inch] * 2.54[cm/inch] = 0.0352[cm]. This mismatch leads to an exception when the corresponding weight of a cell is parsed. Change-Id: I945d8aecdf31e5ad76d0d04e76eaaf4668e3d8ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114980 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index fa58d7e51f33..751e31a28eda 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -57,6 +58,7 @@ public: void testTdf133889(); void testTdf138646(); void testTdf105558(); +void testTdf90278(); CPPUNIT_TEST_SUITE(ScMacrosTest); CPPUNIT_TEST(testStarBasic); @@ -81,6 +83,7 @@ public: CPPUNIT_TEST(testTdf133889); CPPUNIT_TEST(testTdf138646); CPPUNIT_TEST(testTdf105558); +CPPUNIT_TEST(testTdf90278); CPPUNIT_TEST_SUITE_END(); }; @@ -1050,6 +1053,38 @@ void ScMacrosTest::testTdf105558() xCloseable->close(true); } +void ScMacrosTest::testTdf90278() +{ +OUString aFileName; +createFileURL(u"tdf90278.xls", aFileName); +auto xComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument"); +CPPUNIT_ASSERT(xComponent); + +SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); +CPPUNIT_ASSERT(pFoundShell); + +ScDocShellRef xDocSh = dynamic_cast(pFoundShell); +CPPUNIT_ASSERT(xDocSh); + +Any aRet; +Sequence aOutParamIndex; +Sequence aOutParam; +Sequence aParams; + +// Without the fix in place, changing the border weight +// would cause a Basic exception/error in the following script. +SfxObjectShell::CallXScript( +xComponent, + "vnd.sun.Star.script:VBAProject.Module1.BorderWeight?language=Basic=document", +aParams, aRet, aOutParamIndex, aOutParam); + +// Check the border weight of the corresponding cell in the test document +sal_Int32 aReturnValue; +aRet >>= aReturnValue; +CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aReturnValue); + +xDocSh->DoClose(); +} ScMacrosTest::ScMacrosTest() : UnoApiTest("/sc/qa/extras/testdocuments") diff --git a/sc/qa/extras/testdocuments/tdf90278.xls b/sc/qa/extras/testdocuments/tdf90278.xls new file mode 100644 index ..2d794555666d Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf90278.xls differ diff --git a/sc/source/ui/vba/vbaborders.cxx b/sc/source/ui/vba/vbaborders.cxx index b4366a4e1897..34f2f0fe3f42 100644 --- a/sc/source/ui/vba/vbaborders.cxx +++ b/sc/source/ui/vba/vbaborders.cxx @@ -45,7 +45,7 @@ const sal_Int16 supportedIndexTable[] = { XlBordersIndex::xlEdgeLeft, XlBorders constexpr OUStringLiteral sTableBorder = u"TableBorder"; // Equiv widths in 1/100 mm -const sal_Int32 OOLineThin = 35; +const sal_Int32 OOLineThin = 26; const sal_Int32 OOLineMedium = 88; const sal_Int32 OOLineThick = 141; const sal_Int32 OOLineHairline = 2; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/statistics/anova.py |4 +-- sc/source/core/tool/interpr5.cxx | 48 --- 2 files changed, 17 insertions(+), 35 deletions(-) New commits: commit 296367e0a91d0e6169da280d6a5efa83ae56de5d Author: dante AuthorDate: Thu Apr 29 16:56:41 2021 +0200 Commit: Mike Kaganski CommitDate: Fri Apr 30 22:10:51 2021 +0200 tdf#137679 Use kahan summation for ScInterpreter::SumProduct Change-Id: Id0ef5b30a01054337f0ad3afd8c71311e6b2b469 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114888 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/qa/uitest/statistics/anova.py b/sc/qa/uitest/statistics/anova.py index 50237ef928f9..579b9d29014d 100644 --- a/sc/qa/uitest/statistics/anova.py +++ b/sc/qa/uitest/statistics/anova.py @@ -98,7 +98,7 @@ class anova(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 10) self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 10) self.assertEqual(get_cell_by_position(document, 0, 6, 8).getString(), "SS") -self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),11), 1876.56832844573) +self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),11), 1876.56832844575) self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),10), 6025.1090909091) #bug 80583 self.assertEqual(round(get_cell_by_position(document, 0, 6, 11).getValue(),11), 7901.67741935484) @@ -128,7 +128,7 @@ class anova(UITestCase): self.assertEqual(round(get_cell_by_position(document, 0, 9, 9).getValue(),13), 4.3604117704492) self.assertEqual(get_cell_by_position(document, 0, 10, 8).getString(), "P-value") -self.assertEqual(round(get_cell_by_position(document, 0, 10, 9).getValue(),14), 0.02246149518799) +self.assertEqual(round(get_cell_by_position(document, 0, 10, 9).getValue(),14), 0.02246149518798) self.assertEqual(get_cell_by_position(document, 0, 11, 8).getString(), "F critical") self.assertEqual(round(get_cell_by_position(document, 0, 11, 9).getValue(),13), 3.3403855582378) diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 0fe64d647bfe..4f10bb8961d2 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -1715,37 +1715,6 @@ void ScInterpreter::ScPow() } } -namespace { - -class SumValues -{ -double mfSum; -bool mbError; -public: -SumValues() : mfSum(0.0), mbError(false) {} - -void operator() (double f) -{ -if (mbError) -return; - -FormulaError nErr = GetDoubleErrorValue(f); -if (nErr == FormulaError::NONE) -mfSum += f; -else if (nErr != FormulaError::ElementNaN) -{ -// Propagate the first error encountered, ignore "this is not a -// number" elements. -mfSum = f; -mbError = true; -} -} - -double getValue() const { return mfSum; } -}; - -} - void ScInterpreter::ScSumProduct() { short nParamCount = GetByte(); @@ -1790,8 +1759,21 @@ void ScInterpreter::ScSumProduct() pMat->MergeDoubleArrayMultiply(aResArray); } -double fSum = std::for_each(aResArray.begin(), aResArray.end(), SumValues()).getValue(); -PushDouble(fSum); +KahanSum fSum = 0.0; +for( double fPosArray : aResArray ) +{ +FormulaError nErr = GetDoubleErrorValue(fPosArray); +if (nErr == FormulaError::NONE) +fSum += fPosArray; +else if (nErr != FormulaError::ElementNaN) +{ +// Propagate the first error encountered, ignore "this is not a number" elements. +PushDouble(fPosArray); +return; +} +} + +PushDouble(fSum.get()); } void ScInterpreter::ScSumX2MY2() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/autofilter/tdf141946.py | 75 +++ sc/source/core/tool/dbdata.cxx | 10 ++-- 2 files changed, 80 insertions(+), 5 deletions(-) New commits: commit 4b8459e86c7a411d8f02fc5480033cb031a941f2 Author: Tünde Tóth AuthorDate: Thu Apr 29 14:46:25 2021 +0200 Commit: Balazs Varga CommitDate: Fri Apr 30 15:08:34 2021 +0200 tdf#141946 sc: fix broken filter criteria when inserting column The autofilter criteria weren't remain with the filtered column when we inserted a column left of the filtered column. Change-Id: If366d9de9518da3d13ec2ba6b1b36e4f98c76019 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114881 Tested-by: Jenkins Reviewed-by: Balazs Varga diff --git a/sc/qa/uitest/autofilter/tdf141946.py b/sc/qa/uitest/autofilter/tdf141946.py new file mode 100644 index ..4e45ecfb7d5a --- /dev/null +++ b/sc/qa/uitest/autofilter/tdf141946.py @@ -0,0 +1,75 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 141946 - EDITING Inserting column before autofiltered column empties autofilter + +class tdf141946(UITestCase): +def test_tdf141946_inserted_column(self): +self.ui_test.create_doc_in_start_center("calc") +document = self.ui_test.get_component() +calcDoc = self.xUITest.getTopFocusWindow() +gridwin = calcDoc.getChild("grid_window") +document = self.ui_test.get_component() + +enter_text_to_cell(gridwin, "A1", "A") +enter_text_to_cell(gridwin, "A2", "1") +enter_text_to_cell(gridwin, "A3", "2") +enter_text_to_cell(gridwin, "A4", "3") + +enter_text_to_cell(gridwin, "B1", "B") +enter_text_to_cell(gridwin, "B2", "4") +enter_text_to_cell(gridwin, "B3", "5") +enter_text_to_cell(gridwin, "B4", "6") + +gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"})) + +self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + +gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xList = xCheckListMenu.getChild("check_list_box") +xEntry = xList.getChild("1") +xEntry.executeAction("CLICK", tuple()) + +xOkButton = xFloatWindow.getChild("ok") +xOkButton.executeAction("CLICK", tuple()) + +gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + +self.xUITest.executeCommand(".uno:InsertColumnsBefore") + +gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(2, len(xList.getChildren())) +xCloseBtn = xFloatWindow.getChild("cancel") +xCloseBtn.executeAction("CLICK", tuple()) + +gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(1, len(xList.getChildren())) +xCloseBtn = xFloatWindow.getChild("cancel") +xCloseBtn.executeAction("CLICK", tuple()) + +gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(3, len(xList.getChildren())) +xCloseBtn = xFloatWindow.getChild("cancel") +xCloseBtn.executeAction("CLICK", tuple()) + +self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index d7a8f4dd5297..ba68d1aa0d8a 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -366,8 +366,8 @@ void ScDBData::MoveTo(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW n ScQueryEntry& rEntry = mpQueryParam->GetEntry(i); rEntry.nField += nDifX; -// tdf#48025 update the column index of the filter criteria, -// when the deleted columns are inside the data range +// tdf#48025, tdf#141946: update the column index of
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/functions/array/fods/growth.fods | 120 +-- sc/qa/unit/data/functions/array/fods/linest.fods | 870 +++ sc/qa/unit/data/functions/array/fods/logest.fods | 28 sc/source/core/tool/interpr5.cxx | 48 - 4 files changed, 533 insertions(+), 533 deletions(-) New commits: commit d9341748401969b01fa89f66ade174fddb3fe6bd Author: dante AuthorDate: Sat Apr 24 19:13:43 2021 +0200 Commit: Mike Kaganski CommitDate: Mon Apr 26 17:48:08 2021 +0200 Use kahan sum for lcl_ named methods in abstract namespace Change-Id: Ib2df6c1cbe3bc36df085f310db24810b33ec85e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114612 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/qa/unit/data/functions/array/fods/growth.fods b/sc/qa/unit/data/functions/array/fods/growth.fods index adb0047021f3..35b9ff7bd93a 100644 --- a/sc/qa/unit/data/functions/array/fods/growth.fods +++ b/sc/qa/unit/data/functions/array/fods/growth.fods @@ -1938,11 +1938,11 @@ - - 32618.2037735397 + + 32618.2037735398 - - 32618.2037735397 + + 32618.2037735398 TRUE @@ -1986,11 +1986,11 @@ - - 47729.4226147478 + + 47729.4226147479 - - 47729.4226147478 + + 47729.4226147479 TRUE @@ -2029,11 +2029,11 @@ - - 69841.3008562174 + + 69841.3008562177 - - 69841.3008562174 + + 69841.3008562177 TRUE @@ -2074,11 +2074,11 @@ - - 102197.073378832 + + 102197.073378833 - - 102197.073378832 + + 102197.073378833 TRUE @@ -2197,11 +2197,11 @@ - - 320196.718363473 + + 320196.718363474 - - 320196.718363473 + + 320196.718363474 TRUE @@ -2232,11 +2232,11 @@ - - 468536.054184048 + + 468536.05418405 - - 468536.054184048 + + 468536.05418405 TRUE @@ -2264,11 +2264,11 @@ - - 32618.2037735398 + + 32618.2037735399 - - 32618.2037735398 + + 32618.2037735399 TRUE @@ -2297,11 +2297,11 @@ - - 47729.4226147478 + + 47729.422614748 - - 47729.4226147478 + + 47729.422614748 TRUE @@ -2325,11 +2325,11 @@ - - 69841.3008562174 + + 69841.3008562177 - - 69841.3008562174 + + 69841.3008562177 TRUE @@ -2350,11 +2350,11 @@ - - 102197.073378832 + + 102197.073378833 - - 102197.073378832 + + 102197.073378833 TRUE @@ -2413,11 +2413,11 @@ - - 32618.2037735397 + + 32618.2037735398 - - 32618.2037735397 + + 32618.2037735398 TRUE @@ -2432,11 +2432,11 @@ - - 47729.4226147478 + + 47729.4226147479 - - 47729.4226147478 + + 47729.4226147479 TRUE @@ -2451,11 +2451,11 @@ - - 69841.3008562174 + + 69841.3008562177 - - 69841.3008562174 + + 69841.3008562177 TRUE @@ -2470,11 +2470,11 @@ - - 102197.073378832 + + 102197.073378833 - - 102197.073378832 + + 102197.073378833 TRUE @@ -2546,11 +2546,11 @@ - - 3254137.27894144 + + 3254137.27894143 - - 3254137.27894144 + + 3254137.27894143 TRUE diff --git a/sc/qa/unit/data/functions/array/fods/linest.fods b/sc/qa/unit/data/functions/array/fods/linest.fods index a5cd274f30c3..130a4a1c0dcd 100644 --- a/sc/qa/unit/data/functions/array/fods/linest.fods +++ b/sc/qa/unit/data/functions/array/fods/linest.fods @@ -2916,11 +2916,11 @@ - - 459.753674225393 + + 459.753674225392 - - 459.753674225393 + + 459.753674225392 TRUE @@ -2994,11 +2994,11 @@ - - 530.669151930378 + + 530.669151930379 - - 530.669151930378 + + 530.669151930379 TRUE @@ -3037,11 +3037,11 @@ - - 970.578462928506 + + 970.578462928507 - - 970.578462928506 + + 970.578462928507 TRUE @@ -3130,11 +3130,11 @@ - - 5652135.31620397 + + 5652135.31620398 - -
[Libreoffice-commits] core.git: sc/qa sc/source vcl/source
sc/qa/unit/ucalc.cxx |2 +- sc/qa/unit/uicalc/uicalc.cxx |2 +- sc/source/core/data/document.cxx |4 ++-- vcl/source/control/button.cxx|2 +- vcl/source/outdev/map.cxx|2 +- 5 files changed, 6 insertions(+), 6 deletions(-) New commits: commit 5d172408dffd3e6f4b76254f0980b0fd1210bb2f Author: Andrea Gelmini AuthorDate: Fri Apr 23 22:33:48 2021 +0200 Commit: Andrea Gelmini CommitDate: Sat Apr 24 07:59:03 2021 +0200 Fix typos Change-Id: I0a8279429c9e0d884a5e8fbb8f22617832385a53 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114574 Reviewed-by: Julien Nabet Tested-by: Jenkins diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 02988bdd5ff4..f03c8fe073d8 100755 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4170,7 +4170,7 @@ void Test::testCopyPasteSpecialMultiRangeRowAsLinkFilteredTranspose() rEntry.bDoQuery = true; rEntry.nField = 0; rEntry.eOp = SC_GREATER_EQUAL; -rEntry.GetQueryItem().mfVal = 0; // filtering neative values -> filtering row 1 and 2 +rEntry.GetQueryItem().mfVal = 0; // filtering negative values -> filtering row 1 and 2 // add queryParam to database range. pDBData->SetQueryParam(aParam); diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index c756a75065a5..29417a3c4778 100755 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -465,7 +465,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117706) CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 2, 0))); } -// Inspired from testTdf117706, test columns instad of rows +// Inspired from testTdf117706, test columns instead of rows CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testMultiRangeCol) { mxComponent = loadFromDesktop("private:factory/scalc"); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 108c07e03705..89322ceb2cdf 100755 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2354,8 +2354,8 @@ void ScDocument::TransposeClip(ScDocument* pTransClip, InsertDeleteFlags nFlags, // and selection are in the same dimension (i.e. row). // The filtered row status and the selection ranges are not available at the same time, // handle this case specially, do not use GetClipParam().getWholeRange(), -// instead loop through the ranges, calculate the row offest and handle filtered rows and -// create in ScClipParam::transpose() an unified range. +// instead loop through the ranges, calculate the row offset and handle filtered rows and +// create in ScClipParam::transpose() a unified range. bool bIsMultiRangeRowFilteredTranspose = !bIncludeFiltered && GetClipParam().isMultiRange() && HasFilteredRows(aCombinedClipRange.aStart.Row(), aCombinedClipRange.aEnd.Row(), diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index bda053a97787..b08cc9772d62 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -2020,7 +2020,7 @@ void Button::ImplDrawRadioCheck(OutputDevice* pDev, WinBits nWinStyle, DrawFlags // is pixel-oriented (all Paints of Controls are, historically), so // the minimum width should be '1' Pixel. // Hint: nImageSep is based on Zoom (using Window::CalcZoom) and -// MapModes (using Window::GetDrawPixel) - so potenially a wide range +// MapModes (using Window::GetDrawPixel) - so potentially a wide range // of unpredictable values is possible const tools::Long nWidthAdjust(rImageSize.Width() + nImageSep); aSize.setWidth(std::max(static_cast(1), aSize.getWidth() - nWidthAdjust)); diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index e8f9d0dd7df2..4761062c820c 100644 --- a/vcl/source/outdev/map.cxx +++ b/vcl/source/outdev/map.cxx @@ -389,7 +389,7 @@ tools::Rectangle OutputDevice::ImplLogicToDevicePixel( const tools::Rectangle& r //tools::Long(1) == aRect.GetWidth() //tools::Long(0) == aRect.getWidth() // (remember: this means Left == Right == 1 -> GetWidth => 1, getWidth == 0) -// so indeed tthe 1's have to go uncommened/unchecked into the data body +// so indeed the 1's have to go uncommented/unchecked into the data body // of rectangle. Switching to (2) *is* needed, doing so tools::Rectangle aRetval; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/calc_tests/columns.py | 20 ++-- sc/qa/uitest/calc_tests/rows.py| 12 ++-- sc/source/ui/view/cellsh3.cxx |8 3 files changed, 20 insertions(+), 20 deletions(-) New commits: commit ad8edac43e73555bc2055514300c5b81a1bb04ea Author: Winston Min Tjong AuthorDate: Thu Apr 8 14:55:00 2021 -0700 Commit: Ilmari Lauhakangas CommitDate: Thu Apr 22 18:23:32 2021 +0200 tdf#101217 Change row height and col width decimal places to 4 Bug 101217 - Setting the column width and height should not round the values causing compounding errors This patch fixes the problem caused by rounding errors by increasing the number of decimal places for row height, optimal row height, column width, and optimal column width to 4. Change-Id: Iefb5ef09af3bd81d429cf17386c8b1a54e111957 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113824 Tested-by: Jenkins Reviewed-by: Heiko Tietze diff --git a/sc/qa/uitest/calc_tests/columns.py b/sc/qa/uitest/calc_tests/columns.py index a03ebda37ae2..28649d07f3c2 100644 --- a/sc/qa/uitest/calc_tests/columns.py +++ b/sc/qa/uitest/calc_tests/columns.py @@ -46,7 +46,7 @@ class CalcColumns(UITestCase): self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") xDialog = self.xUITest.getTopFocusWindow() xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") xCancel = xDialog.getChild("cancel") self.ui_test.close_dialog_through_button(xCancel) @@ -79,7 +79,7 @@ class CalcColumns(UITestCase): self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") xDialog = self.xUITest.getTopFocusWindow() xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") xOK = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOK) @@ -87,7 +87,7 @@ class CalcColumns(UITestCase): self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") xDialog = self.xUITest.getTopFocusWindow() xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") xOK = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOK) @@ -126,7 +126,7 @@ class CalcColumns(UITestCase): self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") xDialog = self.xUITest.getTopFocusWindow() xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") xOK = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOK) @@ -236,7 +236,7 @@ class CalcColumns(UITestCase): self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") xDialog = self.xUITest.getTopFocusWindow() xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") xOK = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOK) @@ -244,7 +244,7 @@ class CalcColumns(UITestCase): self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") xDialog = self.xUITest.getTopFocusWindow() xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.00 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.0003 cm") xOK = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOK) @@ -252,7 +252,7 @@ class CalcColumns(UITestCase): self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") xDialog = self.xUITest.getTopFocusWindow() xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "3.00 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "3.0004 cm") xOK = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOK) @@ -260,7 +260,7 @@ class CalcColumns(UITestCase): self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") xDialog = self.xUITest.getTopFocusWindow() xvalue = xDialog.getChild("value") -self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") +self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") xOK = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOK) @@ -268,7 +268,7 @@ class CalcColumns(UITestCase):
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/functions/statistical/fods/rsq.fods | 55 sc/source/core/tool/interpr3.cxx|4 + 2 files changed, 48 insertions(+), 11 deletions(-) New commits: commit fc9919bcfcf32f2ecefa4fce18a49545b93d3499 Author: Andreas Heinisch AuthorDate: Mon Apr 19 18:26:48 2021 +0200 Commit: Eike Rathke CommitDate: Wed Apr 21 18:03:41 2021 +0200 tdf#94962 - Limit calculation of pearson coefficient The RSQ/PEARSON functions return values greater than one, if the divisors are below the numerical limits. Change-Id: Ice224315072afafc6206c367f219771adebe23ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114301 Tested-by: Eike Rathke Reviewed-by: Eike Rathke diff --git a/sc/qa/unit/data/functions/statistical/fods/rsq.fods b/sc/qa/unit/data/functions/statistical/fods/rsq.fods index 0028bda9d834..b37fbd7b6f94 100644 --- a/sc/qa/unit/data/functions/statistical/fods/rsq.fods +++ b/sc/qa/unit/data/functions/statistical/fods/rsq.fods @@ -4129,9 +4129,21 @@ - - - + + #DIV/0! + + + #DIV/0! + + + WAHR + + + =RSQ(L12:L15;M12:M15) + + + tdf#94962 + 9 @@ -4228,8 +4240,13 @@ 89989 - - + + 7.149E-166 + + + 4.998E-163 + + @@ -4249,7 +4266,13 @@ 89988 - + + 3.963E-165 + + + 6.232E-163 + + @@ -4267,8 +4290,14 @@ 89987 - - + + + 6.609E-165 + + + 7.724E-163 + + @@ -4286,8 +4315,14 @@ 89986 - - + + + 3.056E-165 + + + 4.955E-163 + + diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index ebf77f67a353..7adee328c37a 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -4603,7 +4603,9 @@ void ScInterpreter::CalculatePearsonCovar( bool _bPearson, bool _bStexy, bool _b } if ( _bPearson ) { -if (fSumSqrDeltaX == 0.0 || ( !_bStexy && fSumSqrDeltaY == 0.0) ) +// tdf#94962 - Values below the numerical limit lead to unexpected results +if (fSumSqrDeltaX < ::std::numeric_limits::min() +|| (!_bStexy && fSumSqrDeltaY < ::std::numeric_limits::min())) PushError( FormulaError::DivisionByZero); else if ( _bStexy ) PushDouble( sqrt( (fSumSqrDeltaY - fSumDeltaXDeltaY * ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/functions/financial/fods/irr.fods | 45 ++--- sc/source/core/tool/interpr2.cxx | 73 +- 2 files changed, 77 insertions(+), 41 deletions(-) New commits: commit a8216c210dbe83a7fe0c8b1a767c2ddf8b611e96 Author: Andreas Heinisch AuthorDate: Mon Apr 12 10:51:57 2021 +0200 Commit: Eike Rathke CommitDate: Wed Apr 21 16:59:13 2021 +0200 tdf#58585 - IRR function: support array argument for values Text and empty cells in the value range are ignored. Change-Id: I0790a83c79d3861afa855bf89a1c4eb39eb6d638 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113971 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/sc/qa/unit/data/functions/financial/fods/irr.fods b/sc/qa/unit/data/functions/financial/fods/irr.fods index ced44ffd0c49..4ecc9cb32581 100644 --- a/sc/qa/unit/data/functions/financial/fods/irr.fods +++ b/sc/qa/unit/data/functions/financial/fods/irr.fods @@ -1913,20 +1913,29 @@ - - - - - - + + + 23,38% + + + 0.233751928528259 + + + TRUE + + + =IRR({-1|5000|5000|5000}) + + + Tdf#58585 enhancement + + - 20 + 10 - - - - + + @@ -2014,20 +2023,6 @@ - - - Err:504 - - - - - =IRR( {-1;5000;5000;5000}) - - - Tdf#58585 enhancement - - - diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index a14c84b69f92..7e0d3733538d 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -1410,17 +1410,43 @@ void ScInterpreter::ScIRR() fEstimated = GetDouble(); else fEstimated = 0.1; -sal_uInt16 sPos = sp; // memorize the position of the stack double fEps = 1.0; double x, fValue; if (fEstimated == -1.0) x = 0.1; // default result for division by zero else x = fEstimated;// startvalue + +ScRange aRange; +ScMatrixRef pMat; +SCSIZE nC = 0; +SCSIZE nR = 0; +bool bIsMatrix = false; switch (GetStackType()) { -case svDoubleRef : +case svDoubleRef: +PopDoubleRef(aRange); break; +case svMatrix: +case svExternalSingleRef: +case svExternalDoubleRef: +pMat = GetMatrix(); +if (pMat) +{ +pMat->GetDimensions(nC, nR); +if (nC == 0 || nR == 0) +{ +PushIllegalParameter(); +return; +} +bIsMatrix = true; +} +else +{ +PushIllegalParameter(); +return; +} +break; default: { PushIllegalParameter(); @@ -1429,28 +1455,43 @@ void ScInterpreter::ScIRR() } const sal_uInt16 nIterationsMax = 20; sal_uInt16 nItCount = 0; -ScRange aRange; -while (fEps > SCdEpsilon && nItCount < nIterationsMax) +FormulaError nIterError = FormulaError::NONE; +while (fEps > SCdEpsilon && nItCount < nIterationsMax && nGlobalError == FormulaError::NONE) { // Newtons method: -sp = sPos; // reset stack double fNom = 0.0; double fDenom = 0.0; -FormulaError nErr = FormulaError::NONE; -PopDoubleRef( aRange ); -ScValueIterator aValIter(mrDoc, aRange, mnSubTotalFlags); -if (aValIter.GetFirst(fValue, nErr)) -{ -double fCount = 0.0; -fNom+= fValue / pow(1.0+x,fCount); -fDenom += -fCount * fValue / pow(1.0+x,fCount+1.0); -fCount++; -while ((nErr == FormulaError::NONE) && aValIter.GetNext(fValue, nErr)) +double fCount = 0.0; +if (bIsMatrix) +{ +for (SCSIZE j = 0; j < nC && nGlobalError == FormulaError::NONE; j++) +{ +for (SCSIZE k = 0; k < nR; k++) +{ +if (!pMat->IsValue(j, k)) +continue; +fValue = pMat->GetDouble(j, k); +if (nGlobalError != FormulaError::NONE) +break; + +fNom += fValue / pow(1.0+x,fCount); +fDenom += -fCount * fValue / pow(1.0+x,fCount+1.0); +fCount++; +} +} +} +else +{ +ScValueIterator aValIter(mrDoc, aRange, mnSubTotalFlags); +bool bLoop = aValIter.GetFirst(fValue, nIterError); +while (bLoop && nIterError
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx | 39 +++ sc/source/ui/view/tabvwshc.cxx |9 +++--- 2 files changed, 44 insertions(+), 4 deletions(-) New commits: commit 9dda49734b65875d7b916a1867d86f8c161b32e8 Author: Marco Cecchetti AuthorDate: Wed Jul 15 13:01:33 2020 +0200 Commit: Marco Cecchetti CommitDate: Wed Apr 14 11:44:27 2021 +0200 lok: sc: Desktop: Function wizard isn't properly async Open another view of the same spreadsheet when the function dialog is open. Note how the document in the new view can't be edited. This patch avoids to have a view locked after creation when in an other view the formula dialog is open. See also commit 009d275. Change-Id: Ie51f414c4ad83ef20526d10be3251e174158096c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98823 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114060 Tested-by: Jenkins Reviewed-by: Marco Cecchetti diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 9a9a5119c4a0..5e3f1494059d 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -108,6 +108,7 @@ public: void testSheetGeometryDataInvariance(); void testSheetGeometryDataCorrectness(); void testDeleteCellMultilineContent(); +void testFunctionDlg(); void testSpellOnlineParameter(); void testSpellOnlineRenderParameter(); void testPasteIntoWrapTextCell(); @@ -156,6 +157,7 @@ public: CPPUNIT_TEST(testSheetGeometryDataInvariance); CPPUNIT_TEST(testSheetGeometryDataCorrectness); CPPUNIT_TEST(testDeleteCellMultilineContent); +CPPUNIT_TEST(testFunctionDlg); CPPUNIT_TEST(testSpellOnlineParameter); CPPUNIT_TEST(testSpellOnlineRenderParameter); CPPUNIT_TEST(testPasteIntoWrapTextCell); @@ -1622,6 +1624,43 @@ void ScTiledRenderingTest::testFilterDlg() SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr); } +void ScTiledRenderingTest::testFunctionDlg() +{ +comphelper::LibreOfficeKit::setActive(); + +createDoc("empty.ods"); + +// view #1 +SfxViewShell* pView1 = SfxViewShell::Current(); +int nView1 = SfxLokHelper::getView(); +{ +pView1->GetViewFrame()->GetDispatcher()->Execute(SID_OPENDLG_FUNCTION, +SfxCallMode::SLOT|SfxCallMode::RECORD); +} +Scheduler::ProcessEventsToIdle(); +SfxChildWindow* pRefWindow = pView1->GetViewFrame()->GetChildWindow(SID_OPENDLG_FUNCTION); +CPPUNIT_ASSERT(pRefWindow); + +// view #2 +int nView2 = SfxLokHelper::createView(); +SfxViewShell* pView2 = SfxViewShell::Current(); +CPPUNIT_ASSERT(pView1 != pView2); + +// check loking +CPPUNIT_ASSERT_EQUAL(true, pView1->GetViewFrame()->GetDispatcher()->IsLocked()); +CPPUNIT_ASSERT_EQUAL(false, pView2->GetViewFrame()->GetDispatcher()->IsLocked()); + +SfxLokHelper::setView(nView1); +pRefWindow->GetController()->response(RET_CANCEL); + +CPPUNIT_ASSERT_EQUAL(false, pView1->GetViewFrame()->GetDispatcher()->IsLocked()); +CPPUNIT_ASSERT_EQUAL(false, pView2->GetViewFrame()->GetDispatcher()->IsLocked()); + +SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr); +SfxLokHelper::setView(nView2); +SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr); +} + void ScTiledRenderingTest::testSpellOnlineParameter() { ScModelObj* pModelObj = createDoc("empty.ods"); diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 208623b1c4cb..2249f25decb2 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -121,12 +121,13 @@ std::shared_ptr ScTabViewShell::CreateRefDialogCont if ( nCurRefDlgId != nSlotId ) { -// the dialog has been opened in a different view -// -> lock the dispatcher for this view (modal mode) +if (!(comphelper::LibreOfficeKit::isActive() && nSlotId == SID_OPENDLG_FUNCTION)) +{ +// the dialog has been opened in a different view +// -> lock the dispatcher for this view (modal mode) -if (!comphelper::LibreOfficeKit::isActive()) GetViewData().GetDispatcher().Lock( true );// lock is reset when closing dialog - +} return nullptr; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx |4 ++-- sc/source/ui/view/cliputil.cxx | 16 +--- 2 files changed, 15 insertions(+), 5 deletions(-) New commits: commit b5b12537b784b3af9f2e2ad76536a55e281d6cfb Author: Gökay Şatır AuthorDate: Mon Apr 12 14:36:46 2021 +0300 Commit: Gökay ŞATIR CommitDate: Tue Apr 13 14:48:58 2021 +0200 Calc: Send sheet invalidation for full row/col ops Change-Id: I4da476804d2dfaf11c1cfd6cbe11cc4a651e0f09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113251 Tested-by: Jenkins CollaboraOffice Reviewed-by: Jan Holesovsky Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114038 Tested-by: Jenkins Reviewed-by: Gökay ŞATIR diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 1d883f0e4a95..9a9a5119c4a0 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -2336,8 +2336,8 @@ void ScTiledRenderingTest::testPasteIntoWrapTextCell() pView->GetViewFrame()->GetBindings().Execute(SID_PASTE); Scheduler::ProcessEventsToIdle(); -// SG invalidations for rows -CPPUNIT_ASSERT_EQUAL(OString("rows"), aView.m_sInvalidateSheetGeometry); +// SG invalidations for all +CPPUNIT_ASSERT_EQUAL(OString("all"), aView.m_sInvalidateSheetGeometry); SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr); } diff --git a/sc/source/ui/view/cliputil.cxx b/sc/source/ui/view/cliputil.cxx index d2db10b0a062..494c1b27c366 100644 --- a/sc/source/ui/view/cliputil.cxx +++ b/sc/source/ui/view/cliputil.cxx @@ -98,11 +98,21 @@ void ScClipUtil::PasteFromClipboard( ScViewData& rViewData, ScTabViewShell* pTab } if (comphelper::LibreOfficeKit::isActive()) { -const ScLineBreakCell* pItem = rThisDoc.GetAttr(nThisCol, nThisRow, nThisTab, ATTR_LINEBREAK); -if (pItem && pItem->GetValue()) +bool entireColumnOrRowSelected = false; +if (pOwnClip) +{ +ScClipParam clipParam = pOwnClip->GetDocument()->GetClipParam(); +if (clipParam.maRanges.size() > 0) +{ +if (clipParam.maRanges[0].aEnd.Col() == MAXCOLCOUNT -1 || clipParam.maRanges[0].aEnd.Row() == MAXROWCOUNT - 1) +entireColumnOrRowSelected = true; +} +} +const SfxBoolItem* pItem = rThisDoc.GetAttr(nThisCol, nThisRow, nThisTab, ATTR_LINEBREAK); +if (pItem->GetValue() || entireColumnOrRowSelected) { ScTabViewShell::notifyAllViewsSheetGeomInvalidation( -pTabViewShell, false /* bColumns */, true /* bRows */, true /* bSizes*/, +pTabViewShell, true /* bColumns */, true /* bRows */, true /* bSizes*/, true /* bHidden */, true /* bFiltered */, true /* bGroups */, nThisTab); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source vcl/source
sc/qa/uitest/range_name/tdf86214.py | 10 ++ sc/source/ui/namedlg/namedefdlg.cxx | 34 +++--- vcl/source/uitest/uiobject.cxx |1 + 3 files changed, 22 insertions(+), 23 deletions(-) New commits: commit 58dcf2a88af215df4e912f0cfcb32908c6a298a0 Author: Andreas Heinisch AuthorDate: Fri Apr 2 13:23:46 2021 +0200 Commit: Heiko Tietze CommitDate: Mon Apr 12 08:39:47 2021 +0200 tdf#132869 - Show the error message in a tooltip In the define name dialog, the input itself should show the error message in a tooltip. In addition, the possibility to test the tooltip text in python was added. Change-Id: I9bd7d2b2be8300aa366971f8a1f115e8ae19fb98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113513 Tested-by: Jenkins Reviewed-by: Heiko Tietze diff --git a/sc/qa/uitest/range_name/tdf86214.py b/sc/qa/uitest/range_name/tdf86214.py index d529a47b9dd1..48817e0bcc64 100644 --- a/sc/qa/uitest/range_name/tdf86214.py +++ b/sc/qa/uitest/range_name/tdf86214.py @@ -39,16 +39,18 @@ class InvalidNames(UITestCase): select_all(xEdit) type_text(xEdit, name) -new_text = get_state_as_dict(xLabel)["Text"] -self.assertNotEqual(success_text, new_text) +# tdf#132869 - Without the fix in place, this test would have failed with +# - Expected: "Invalid name. Start with a letter, use only letters, numbers and underscore." +# - Actual : "" +self.assertNotEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"]) self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "false") select_all(xEdit) type_text(xEdit, "valid_name") -new_text = get_state_as_dict(xLabel)["Text"] -self.assertEqual(success_text, new_text) +self.assertEqual(success_text, get_state_as_dict(xLabel)["Text"]) +self.assertEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"]) self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "true") self.ui_test.close_dialog_through_button(xAddBtn) diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx index 25ff6e132a61..658026652c6b 100644 --- a/sc/source/ui/namedlg/namedefdlg.cxx +++ b/sc/source/ui/namedlg/namedefdlg.cxx @@ -120,6 +120,9 @@ bool ScNameDefDlg::IsNameValid() OUString aScope = m_xLbScope->get_active_text(); OUString aName = m_xEdName->get_text(); +bool bIsNameValid = true; +OUString aHelpText = maStrInfoDefault; + ScRangeName* pRangeName = nullptr; if(aScope == maGlobalNameStr) { @@ -131,46 +134,39 @@ bool ScNameDefDlg::IsNameValid() } ScRangeData::IsNameValidType eType; -m_xFtInfo->set_label_type(weld::LabelType::Normal); if ( aName.isEmpty() ) { -m_xBtnAdd->set_sensitive(false); -m_xFtInfo->set_label(maStrInfoDefault); -return false; +bIsNameValid = false; } else if ((eType = ScRangeData::IsNameValid(aName, mrDoc)) != ScRangeData::IsNameValidType::NAME_VALID) { -m_xFtInfo->set_label_type(weld::LabelType::Error); if (eType == ScRangeData::IsNameValidType::NAME_INVALID_BAD_STRING) { -m_xFtInfo->set_label(maErrInvalidNameStr); +aHelpText = maErrInvalidNameStr; } else if (eType == ScRangeData::IsNameValidType::NAME_INVALID_CELL_REF) { -m_xFtInfo->set_label(maErrInvalidNameCellRefStr); +aHelpText = maErrInvalidNameCellRefStr; } -m_xBtnAdd->set_sensitive(false); -return false; +bIsNameValid = false; } else if (pRangeName->findByUpperName(ScGlobal::getCharClassPtr()->uppercase(aName))) { -m_xFtInfo->set_label_type(weld::LabelType::Error); -m_xFtInfo->set_label(maErrNameInUse); -m_xBtnAdd->set_sensitive(false); -return false; +aHelpText = maErrNameInUse; +bIsNameValid = false; } if (!IsFormulaValid()) { -m_xFtInfo->set_label_type(weld::LabelType::Error); -m_xBtnAdd->set_sensitive(false); -return false; +bIsNameValid = false; } -m_xFtInfo->set_label(maStrInfoDefault); -m_xBtnAdd->set_sensitive(true); -return true; +m_xEdName->set_tooltip_text(aHelpText); +m_xEdName->set_message_type(bIsNameValid || aName.isEmpty() ? weld::EntryMessageType::Normal +: weld::EntryMessageType::Error); +m_xBtnAdd->set_sensitive(bIsNameValid); +return bIsNameValid; } void ScNameDefDlg::AddPushed() diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index fc72053074c6..4d8390e212a2 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -785,6 +785,7 @@
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/extras/macros-test.cxx | 49 +++ sc/qa/extras/testdocuments/tdf138646.ods |binary sc/source/core/tool/rangeutl.cxx |4 +- 3 files changed, 52 insertions(+), 1 deletion(-) New commits: commit 1bdef3250fc57ea3f9b69a1f55ceb035329b6fa9 Author: Andreas Heinisch AuthorDate: Wed Mar 17 10:33:05 2021 +0100 Commit: Eike Rathke CommitDate: Mon Mar 29 20:18:24 2021 +0200 tdf#138646 - consider the document's address convention When accessing a named range using getCellRangeByName, consider the document's address convention. Otherwise, an exception is raised, when the formula syntax is EXCEL R1C1 or EXCEL A1. Change-Id: I5df2546f1c3fd00ff30cb057dcf47f6bb01d501d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112602 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index 14cb8c6d8101..06f921ca35e9 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -55,6 +55,7 @@ public: void testTdf43003(); void testTdf133887(); void testTdf133889(); +void testTdf138646(); CPPUNIT_TEST_SUITE(ScMacrosTest); CPPUNIT_TEST(testStarBasic); @@ -77,6 +78,7 @@ public: CPPUNIT_TEST(testTdf43003); CPPUNIT_TEST(testTdf133887); CPPUNIT_TEST(testTdf133889); +CPPUNIT_TEST(testTdf138646); CPPUNIT_TEST_SUITE_END(); }; @@ -976,6 +978,53 @@ void ScMacrosTest::testTdf133889() xCloseable->close(true); } +void ScMacrosTest::testTdf138646() +{ +OUString aFileName; +createFileURL(u"tdf138646.ods", aFileName); +auto xComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument"); +CPPUNIT_ASSERT_MESSAGE("Failed to load the doc", xComponent.is()); + +SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); +CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); + +ScDocShell* pDocSh = dynamic_cast(pFoundShell); +CPPUNIT_ASSERT(pDocSh); + +// Without the fix in place, changing the grammar from GRAM_NATIVE to either GRAM_NATIVE_XL_A1 +// or GRAM_NATIVE_XL_R1C1 would cause a Basic exception/error in the following script. + pDocSh->GetDocument().SetGrammar(formula::FormulaGrammar::Grammar::GRAM_NATIVE_XL_R1C1); + +const std::vector> aTests({ +{ "GlobalNamedCell", "GlobalNamedCell" }, +{ "GlobalNamedCellSheet", "GlobalNamedCell" }, +{ "LocalNamedCell", "LocalNamedCell" }, +{ "LocalNamedCellAccessError", "Exception" } +}); + +{ +Any aRet; +Sequence aOutParamIndex; +Sequence aOutParam; +Sequence aParams; + +for (auto& [sTestName, sExpected] : aTests) +{ +SfxObjectShell::CallXScript(xComponent, + "vnd.sun.Star.script:Standard.Module1." + sTestName ++ "?language=Basic=document", +aParams, aRet, aOutParamIndex, aOutParam); + +OUString aReturnValue; +aRet >>= aReturnValue; +CPPUNIT_ASSERT_EQUAL_MESSAGE(sTestName.toUtf8().getStr(), sExpected, aReturnValue); +} +} + +pDocSh->DoClose(); +} + + ScMacrosTest::ScMacrosTest() : UnoApiTest("/sc/qa/extras/testdocuments") { diff --git a/sc/qa/extras/testdocuments/tdf138646.ods b/sc/qa/extras/testdocuments/tdf138646.ods new file mode 100644 index ..9faa95a54334 Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf138646.ods differ diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx index 401ad6ad5722..1a7467fbb0ec 100644 --- a/sc/source/core/tool/rangeutl.cxx +++ b/sc/source/core/tool/rangeutl.cxx @@ -276,7 +276,9 @@ bool ScRangeUtil::MakeRangeFromName ( ScRefAddress aStartPos; ScRefAddress aEndPos; -pData->GetSymbol( aStrArea ); +// tdf#138646 - consider the current grammar and address convention of the document +pData->GetSymbol(aStrArea, + FormulaGrammar::mergeToGrammar(rDoc.GetGrammar(), rDetails.eConv)); if ( IsAbsArea( aStrArea, rDoc, nTable, nullptr, , , rDetails ) ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/autofilter/tdf36383.py | 68 sc/source/ui/view/viewfunc.cxx | 22 ++- 2 files changed, 88 insertions(+), 2 deletions(-) New commits: commit 3678e0efcb8bedc58dd329a430da0ac3b1572df8 Author: Tünde Tóth AuthorDate: Fri Mar 5 10:20:03 2021 +0100 Commit: László Németh CommitDate: Mon Mar 22 14:16:12 2021 +0100 tdf#36383 sc AutoFilter: fix changing row height Changing row height showed the rows hidden by AutoFilter, removing the result of the filtering. Change-Id: Ie2cba567c1fa4b479bd351693ae6dd3fd604ffc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112006 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/uitest/autofilter/tdf36383.py b/sc/qa/uitest/autofilter/tdf36383.py new file mode 100644 index ..d55db21837b3 --- /dev/null +++ b/sc/qa/uitest/autofilter/tdf36383.py @@ -0,0 +1,68 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_row + +#Bug 36383 - EDITING auto row height or change row height removes AutoFilter result + +class tdf36383(UITestCase): +def test_tdf36383_row_height(self): +self.ui_test.create_doc_in_start_center("calc") +document = self.ui_test.get_component() +calcDoc = self.xUITest.getTopFocusWindow() +gridwin = calcDoc.getChild("grid_window") +document = self.ui_test.get_component() + +enter_text_to_cell(gridwin, "A1", "A") +enter_text_to_cell(gridwin, "A2", "1") +enter_text_to_cell(gridwin, "A3", "2") +enter_text_to_cell(gridwin, "A4", "3") + +gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + +self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + +gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xList = xCheckListMenu.getChild("check_list_box") +xEntry = xList.getChild("1") +xEntry.executeAction("CLICK", tuple()) + +xOkButton = xFloatWindow.getChild("ok") +xOkButton.executeAction("CLICK", tuple()) + +row = get_row(document, 2) +self.assertFalse(row.getPropertyValue("IsVisible")) + +#row height +self.ui_test.execute_dialog_through_command(".uno:RowHeight") +xDialog = self.xUITest.getTopFocusWindow() +xvalue = xDialog.getChild("value") +xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) +xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) +xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + +xOk = xDialog.getChild("ok") +self.ui_test.close_dialog_through_button(xOk) + +self.assertFalse(row.getPropertyValue("IsVisible")) + +#optimal row height +self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight") +xDialog = self.xUITest.getTopFocusWindow() + +xOk = xDialog.getChild("ok") +self.ui_test.close_dialog_through_button(xOk) + +self.assertFalse(row.getPropertyValue("IsVisible")) + +self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 192d90e0b342..8e20a8348678 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -2177,7 +2177,17 @@ void ScViewFunc::SetWidthOrHeight( aCxt.setExtraHeight(nSizeTwips); rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab, true); if (bAll) -rDoc.ShowRows( nStartNo, nEndNo, nTab, true ); +{ +for (SCROW nRow = nStartNo; nRow <= nEndNo; ++nRow) +{ +SCROW nLastRow = nRow; +// tdf#36383 skip consecutive rows hidden by AutoFilter +if (rDoc.RowFiltered(nRow, nTab, nullptr, )) +nRow = nLastRow; +else +rDoc.ShowRow(nRow, nTab, true); +} +} // Manual-Flag already (re)set in SetOptimalHeight in case of bAll=sal_True // (set for Extra-Height, else reset). @@ -2190,7 +2200,15 @@ void ScViewFunc::SetWidthOrHeight(
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/uicalc/uicalc.cxx | 77 +++-- sc/source/ui/inc/viewfunc.hxx |2 - sc/source/ui/view/viewfun3.cxx |4 +- 3 files changed, 24 insertions(+), 59 deletions(-) New commits: commit 8a7b46c0372eb2445c0bd35c1ebe4a7c96115e5c Author: Xisco Fauli AuthorDate: Mon Mar 15 16:19:53 2021 +0100 Commit: Xisco Fauli CommitDate: Mon Mar 15 20:06:22 2021 +0100 sc_uicalc: use UNO commands for copy, cut or paste everywhere It's fine to use them since 043c67e0f7358753a2007b7c2bb6cc68aeea7ecb < dummy clipboard for unit tests > While at it, remove a couple of obsolete FIXME comments Partially revert 9fd193168fe092bf15edbc81b8b1a15ca6d7c032 < tdf#118207: tdf#118189: sc: Move UItest to CppUnitTest > since CutToClip is no longer used Change-Id: I73959fbc810dc5e82b76862338814e720dc97d89 Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112533 Tested-by: Jenkins diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index c6e421569395..6d161ab81c23 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -179,14 +179,11 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf100582) goToCell("C10"); -ScDocument aClipDoc(SCDOCMODE_CLIP); -ScDocShell::GetViewData()->GetView()->CopyToClip(, false, false, false, false); -Scheduler::ProcessEventsToIdle(); +dispatchCommand(mxComponent, ".uno:Copy", {}); goToCell("C10:H14"); - ScDocShell::GetViewData()->GetView()->PasteFromClip(InsertDeleteFlags::ALL, ); -Scheduler::ProcessEventsToIdle(); +dispatchCommand(mxComponent, ".uno:Paste", {}); pModelObj = saveAndReload(mxComponent, "MS Excel 97"); pDoc = pModelObj->GetDocument(); @@ -264,15 +261,11 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf92963) goToCell("A3:C4"); -ScDocument aClipDoc(SCDOCMODE_CLIP); -ScDocShell::GetViewData()->GetView()->CopyToClip(, false, false, false, false); -Scheduler::ProcessEventsToIdle(); +dispatchCommand(mxComponent, ".uno:Copy", {}); goToCell("A1:C1"); -// Without the fix in place, this test would have crashed here - ScDocShell::GetViewData()->GetView()->PasteFromClip(InsertDeleteFlags::ALL, ); -Scheduler::ProcessEventsToIdle(); +dispatchCommand(mxComponent, ".uno:Paste", {}); CPPUNIT_ASSERT_EQUAL(size_t(2), pList->size()); @@ -385,14 +378,11 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf120660) goToCell("A8:E8"); -ScDocument aClipDoc(SCDOCMODE_CLIP); -ScDocShell::GetViewData()->GetView()->CopyToClip(, false, false, false, false); -Scheduler::ProcessEventsToIdle(); +dispatchCommand(mxComponent, ".uno:Copy", {}); goToCell("A4:E4"); - ScDocShell::GetViewData()->GetView()->PasteFromClip(InsertDeleteFlags::ALL, ); -Scheduler::ProcessEventsToIdle(); +dispatchCommand(mxComponent, ".uno:Paste", {}); CPPUNIT_ASSERT_EQUAL(1200.0, pDoc->GetValue(ScAddress(4, 3, 0))); CPPUNIT_ASSERT_EQUAL(-100.0, pDoc->GetValue(ScAddress(4, 7, 0))); @@ -404,13 +394,11 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf120660) goToCell("A8:D8"); -ScDocShell::GetViewData()->GetView()->CopyToClip(, false, false, false, false); -Scheduler::ProcessEventsToIdle(); +dispatchCommand(mxComponent, ".uno:Copy", {}); goToCell("A4:D4"); - ScDocShell::GetViewData()->GetView()->PasteFromClip(InsertDeleteFlags::ALL, ); -Scheduler::ProcessEventsToIdle(); +dispatchCommand(mxComponent, ".uno:Paste", {}); CPPUNIT_ASSERT_EQUAL(1200.0, pDoc->GetValue(ScAddress(4, 3, 0))); @@ -455,7 +443,6 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117706) dispatchCommand(mxComponent, ".uno:SelectRow", {}); Scheduler::ProcessEventsToIdle(); -// FIXME: The rows are not copied/pasted if using CopyToClip/PasteToClip dispatchCommand(mxComponent, ".uno:Copy", {}); mxComponent->dispose(); @@ -598,16 +585,11 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf108654) dispatchCommand(mxComponent, ".uno:SelectAll", {}); -// .uno:Copy without touching shared clipboard -ScDocument aClipDoc(SCDOCMODE_CLIP); -ScDocShell::GetViewData()->GetView()->CopyToClip(, false, false, false, false); -Scheduler::ProcessEventsToIdle(); +dispatchCommand(mxComponent, ".uno:Copy", {}); insertNewSheet(*pDoc); -// .uno:Paste without touching shared clipboard - ScDocShell::GetViewData()->GetView()->PasteFromClip(InsertDeleteFlags::ALL, ); -Scheduler::ProcessEventsToIdle(); +dispatchCommand(mxComponent, ".uno:Paste", {}); OUString aFormula; pDoc->GetFormula(3, 126, 1, aFormula); @@ -634,10 +616,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf133326) dispatchCommand(mxComponent, ".uno:SelectAll", {}); -// .uno:Copy without touching shared clipboard -ScDocument aClipDoc(SCDOCMODE_CLIP); -
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/fods/shapes_foreground_background.fods | 214 + sc/qa/unit/subsequent_export-test.cxx | 35 ++ sc/source/filter/xml/xmlwrap.cxx | 20 + 3 files changed, 269 insertions(+) New commits: commit b4f38c6b8bbc6ea6a5d9354bfd24e411fc5a51fc Author: Michael Stahl AuthorDate: Tue Mar 9 10:47:50 2021 +0100 Commit: Michael Stahl CommitDate: Mon Mar 15 10:16:15 2021 +0100 tdf#133487 sc ODF export: reorder flys' ZOrder/z-index... ... so background shapes have lower z-index than foreground shapes, as is recommended by ODF 1.3. Spreadsheets use a different attribute, table:table-background="true" on the shape itself. Change-Id: I98338972c3a1bd116aa1959f3280d5336aec7bf3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112196 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sc/qa/unit/data/fods/shapes_foreground_background.fods b/sc/qa/unit/data/fods/shapes_foreground_background.fods new file mode 100644 index ..0f203a93dc20 --- /dev/null +++ b/sc/qa/unit/data/fods/shapes_foreground_background.fods @@ -0,0 +1,214 @@ + + +http://www.w3.org/TR/css3-text/; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:oooc="http://openoffice.org/2004/calc; xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:ooow="http://openoffice.org/2004/writer; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:rpt="http://openoffice.org/2005/report; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:config="urn:oasis:nam es:tc:opendocument:xmlns:config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:tableooo="http://openoffice.org/2009/table; xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:fo rm:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:xforms="http://www.w3.org/2002/xforms; office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.spreadsheet"> + 2021-03-04T18:17:27.6250825342021-03-09T10:25:11.233256125PT3M21S2LibreOfficeDev/7.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/4128e96d5f39754695ff9e3cb0989de731dd9698 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +??? + + + +Page 1 + + + + + + + ???(???) + + + 00.00., 00:00:00 + + + + +Page 1/ 99 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index a313ee4c9076..0d14b1046793 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -156,6 +156,8 @@ public: void testTrackChangesSimpleXLSX(); void testSheetTabColorsXLSX(); +void testTdf133487(); + void
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/autofilter/autofilter.py | 15 sc/qa/uitest/data/autofilter/tdf137626.xlsx |binary sc/source/core/data/column3.cxx |8 ++ sc/source/filter/oox/autofilterbuffer.cxx | 33 +--- sc/source/ui/unoobj/datauno.cxx |5 ++-- 5 files changed, 56 insertions(+), 5 deletions(-) New commits: commit 26032e63abd01c3d5941a2728ef024da290d6b0a Author: Balazs Varga AuthorDate: Tue Mar 2 22:46:33 2021 +0100 Commit: László Németh CommitDate: Fri Mar 12 12:20:48 2021 +0100 tdf#137626 XLSX import: fix missing datetime filters by convert string representation of the datetime data to ISO 8601 (with blank instead of T) datetime to eliminate locale dependent behaviour when filtering for datetimes. Follow-up of commit 0e751d0cb816197f15a2448ec36c57df17387e40 (tdf#116818 sc,offapi,XLSX import: fix autofiltered date columns). Change-Id: I3a0f41dbbf28a1a60a54fe7b2c8c338516edb079 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111851 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index ca1871ee933c..2c4f36947929 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -308,5 +308,20 @@ class AutofilterTest(UITestCase): xOkBtn = xFloatWindow.getChild("cancel") xOkBtn.executeAction("CLICK", tuple()) +self.ui_test.close_doc() + +def test_tdf137626(self): +doc = self.ui_test.load_file(get_url_for_data_file("tdf137626.xlsx")) + +xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xTreeList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(3, len(xTreeList.getChildren())) +xOkBtn = xFloatWindow.getChild("cancel") +xOkBtn.executeAction("CLICK", tuple()) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/autofilter/tdf137626.xlsx b/sc/qa/uitest/data/autofilter/tdf137626.xlsx new file mode 100644 index ..eb5ce4da7b98 Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf137626.xlsx differ diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index edf99f02bef5..2285a859d75b 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2472,6 +2472,14 @@ class FilterEntriesHandler sal_uInt32 nIndex = pFormatter->GetFormatIndex( NF_DATE_DIN_MMDD); pFormatter->GetInputLineString( fVal, nIndex, aStr); } +else if (nType == SvNumFormatType::DATETIME) +{ +// special case for datetime values. +// Convert string representation to ISO 8601 (with blank instead of T) datetime +// to eliminate locale dependent behaviour later when filtering for datetimes. +sal_uInt32 nIndex = pFormatter->GetFormatIndex(NF_DATETIME_ISO_MMDD_HHMMSS); +pFormatter->GetInputLineString(fVal, nIndex, aStr); +} // maybe extend ScTypedStrData enum is also an option here mrFilterEntries.push_back(ScTypedStrData(aStr, fVal, ScTypedStrData::Value,bDate)); } diff --git a/sc/source/filter/oox/autofilterbuffer.cxx b/sc/source/filter/oox/autofilterbuffer.cxx index a9ec62c4e655..e09bd084e7f3 100644 --- a/sc/source/filter/oox/autofilterbuffer.cxx +++ b/sc/source/filter/oox/autofilterbuffer.cxx @@ -240,23 +240,50 @@ void DiscreteFilter::importAttribs( sal_Int32 nElement, const AttributeList& rAt // it is just a fallback, we do not need the XML_day as default value, // because if the dateGroupItem exists also XML_dateTimeGrouping exists! sal_uInt16 nToken = rAttribs.getToken(XML_dateTimeGrouping, XML_day); -if( nToken == XML_year || nToken == XML_month || nToken == XML_day ) +if( nToken == XML_year || nToken == XML_month || nToken == XML_day || +nToken == XML_hour || nToken == XML_min || nToken == XML_second ) { aDateValue = rAttribs.getString(XML_year, OUString()); -if( nToken == XML_month || nToken == XML_day ) +if( nToken == XML_month || nToken == XML_day || nToken == XML_hour || +nToken == XML_min || nToken == XML_second ) { OUString aMonthName = rAttribs.getString(XML_month, OUString()); if( aMonthName.getLength() == 1 ) aMonthName = "0" + aMonthName; aDateValue += "-" + aMonthName; -
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/calc_tests3/tdf89754.py | 45 +++ sc/source/core/data/table4.cxx |7 + 2 files changed, 52 insertions(+) New commits: commit 3ba901f050d262cdeccefa5b21b0d32aa7332dc7 Author: Andreas Heinisch AuthorDate: Sat Mar 6 10:38:43 2021 +0100 Commit: Eike Rathke CommitDate: Thu Mar 11 11:07:07 2021 +0100 tdf#89754 - don't increment non different consecutive date cells Change-Id: I6fedc0fe286ebe8b0110360391e8d3325fc2ca25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112054 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/sc/qa/uitest/calc_tests3/tdf89754.py b/sc/qa/uitest/calc_tests3/tdf89754.py new file mode 100644 index ..855688c8f45b --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf89754.py @@ -0,0 +1,45 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +#tdf#89754 - EDITING: 'Autofill - Date' don't increment non different consecutive date cells + +class tdf89754(UITestCase): + +def test_tdf89754_autofill_date(self): +calc_doc = self.ui_test.create_doc_in_start_center("calc") +xCalcDoc = self.xUITest.getTopFocusWindow() +gridwin = xCalcDoc.getChild("grid_window") +document = self.ui_test.get_component() + +#1 - A1: 2012-10-31 and A2: 2012-10-31 +enter_text_to_cell(gridwin, "A1", "2012-10-31") +enter_text_to_cell(gridwin, "A2", "2012-10-31") + +#2 - Select A1:A5 +gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"})) + +#3 - Edit -> fill -> Series -> Down +self.ui_test.execute_dialog_through_command(".uno:FillSeries") +xDialog = self.xUITest.getTopFocusWindow() +xOK = xDialog.getChild("ok") +self.ui_test.close_dialog_through_button(xOK) + +#4 - Expected: All Cells show the initial date +self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 41213) +self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 41213) +self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 41213) +self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 41213) +self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 41213) + +self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 4db88f60bb7c..02e6c1c31d83 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -588,6 +588,13 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, rInc = nCmpInc; } } +else +{ +// tdf#89754 - don't increment non different consecutive date cells +rCmd = FILL_DATE; +rDateCmd = FILL_DAY; +rInc = 0.0; +} } else// single date -> increment by days { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/calc_tests8/navigator.py |7 +-- sc/source/ui/inc/navipi.hxx |3 --- sc/source/ui/inc/uiobject.hxx | 17 - sc/source/ui/navipi/navipi.cxx|5 - sc/source/ui/uitest/uiobject.cxx | 28 5 files changed, 5 insertions(+), 55 deletions(-) New commits: commit 6b0e1986a7c446cb6862f645e45c377c2a309065 Author: Caolán McNamara AuthorDate: Sun Mar 7 20:46:20 2021 + Commit: Caolán McNamara CommitDate: Tue Mar 9 10:07:24 2021 +0100 decompose ScNavigatorDlgUIObject and use sub components directly Change-Id: I817d0e201804dce3e83d204702ff236f5689ebb8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112148 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/sc/qa/uitest/calc_tests8/navigator.py b/sc/qa/uitest/calc_tests8/navigator.py index abbb8ce1cf73..5e8cb99e01e3 100644 --- a/sc/qa/uitest/calc_tests8/navigator.py +++ b/sc/qa/uitest/calc_tests8/navigator.py @@ -91,7 +91,9 @@ class navigator(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() xNavigatorPanel = xCalcDoc.getChild("NavigatorPanelParent") -xNavigatorPanel.executeAction("ROOT", tuple()) +xToolBar = xNavigatorPanel.getChild("toolbox2") +xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'toggle' button + xContentBox = xNavigatorPanel.getChild('contentbox') # tdf#133079, without the fix in place, it would be 8 @@ -123,7 +125,8 @@ class navigator(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() xNavigatorPanel = xCalcDoc.getChild("NavigatorPanelParent") -xNavigatorPanel.executeAction("ROOT", tuple()) +xToolBar = xNavigatorPanel.getChild("toolbox2") +xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'toggle' button xRow = xNavigatorPanel.getChild('row') xColumn = xNavigatorPanel.getChild('column') diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx index 988822a69ee8..fae782112f7c 100644 --- a/sc/source/ui/inc/navipi.hxx +++ b/sc/source/ui/inc/navipi.hxx @@ -88,7 +88,6 @@ class ScNavigatorDlg : public PanelLayout, public SfxListener friend class ScNavigatorControllerItem; friend class ScNavigatorDialogWrapper; friend class ScContentTree; -friend class ScNavigatorDlgUIObject; private: static constexpr int CTRL_ITEMS = 4; @@ -178,8 +177,6 @@ public: virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; virtual void StateChanged(StateChangedType nStateChange) override; - -FactoryFunction GetUITestFactory() const override; }; class ScNavigatorDialogWrapper: public SfxChildWindowContext diff --git a/sc/source/ui/inc/uiobject.hxx b/sc/source/ui/inc/uiobject.hxx index ae3583fff154..01ebdcdc6e89 100644 --- a/sc/source/ui/inc/uiobject.hxx +++ b/sc/source/ui/inc/uiobject.hxx @@ -45,21 +45,4 @@ private: ScViewFunc* getViewFunc(); }; -class ScNavigatorDlg; - -class ScNavigatorDlgUIObject : public WindowUIObject -{ -VclPtr mxScNavigatorDlg; - -public: -ScNavigatorDlgUIObject(const VclPtr& xScNavigatorDlg); - -virtual void execute(const OUString& rAction, const StringMap& rParameters) override; - -static std::unique_ptr create(vcl::Window* pWindow); - -protected: -virtual OUString get_name() const override; -}; - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 6fea222a7938..d8fa920f2385 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -442,11 +442,6 @@ void ScNavigatorDlg::StateChanged(StateChangedType nStateChange) } } -FactoryFunction ScNavigatorDlg::GetUITestFactory() const -{ -return ScNavigatorDlgUIObject::create; -} - ScNavigatorDlg::~ScNavigatorDlg() { disposeOnce(); diff --git a/sc/source/ui/uitest/uiobject.cxx b/sc/source/ui/uitest/uiobject.cxx index 1e17f9301a58..d93da2619a77 100644 --- a/sc/source/ui/uitest/uiobject.cxx +++ b/sc/source/ui/uitest/uiobject.cxx @@ -381,32 +381,4 @@ OUString ScGridWinUIObject::get_name() const return "ScGridWinUIObject"; } -ScNavigatorDlgUIObject::ScNavigatorDlgUIObject(const VclPtr& xScNavigatorDlg): -WindowUIObject(xScNavigatorDlg), -mxScNavigatorDlg(xScNavigatorDlg) -{ -} - -void ScNavigatorDlgUIObject::execute(const OUString& rAction, -const StringMap& rParameters) -{ -if (rAction == "ROOT") -{ -mxScNavigatorDlg->ToolBoxSelectHdl("toggle"); -} -else -WindowUIObject::execute(rAction, rParameters); -} - -std::unique_ptr ScNavigatorDlgUIObject::create(vcl::Window* pWindow) -{ -ScNavigatorDlg* pScNavigatorDlg = dynamic_cast(pWindow); -assert(pScNavigatorDlg); -return std::unique_ptr(new ScNavigatorDlgUIObject(pScNavigatorDlg)); -} - -OUString ScNavigatorDlgUIObject::get_name() const
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/autofilter/autofilter.py | 15 sc/qa/uitest/data/autofilter/tdf140469.xlsx |binary sc/source/filter/inc/autofilterbuffer.hxx | 10 ++--- sc/source/filter/oox/autofilterbuffer.cxx | 51 ++-- 4 files changed, 40 insertions(+), 36 deletions(-) New commits: commit 7ba76115b0e3baefae0ede66848f4340c7c7401b Author: Balazs Varga AuthorDate: Thu Feb 18 18:04:53 2021 +0100 Commit: László Németh CommitDate: Thu Feb 25 14:53:07 2021 +0100 tdf#140469 XLSX import: apply more than 8 filters in OOXML autofilter import by removing the artificial limit (which looked like the limit for conditions handled by the standard filter in LO, but not for the autofilter). Now the autofilter popup menu does not always select all items, if the document contained more than 8 selected items there. Change-Id: Iaa6ce15d4b1162ab78dd001734721ae859283d0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/56 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index ab295fa84dfe..1eedfe4b22a7 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -262,5 +262,20 @@ class AutofilterTest(UITestCase): xOkBtn = xFloatWindow.getChild("cancel") xOkBtn.executeAction("CLICK", tuple()) +self.ui_test.close_doc() + +def test_tdf140469(self): +doc = self.ui_test.load_file(get_url_for_data_file("tdf140469.xlsx")) + +xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xTreeList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(9, len(xTreeList.getChildren())) +xOkBtn = xFloatWindow.getChild("cancel") +xOkBtn.executeAction("CLICK", tuple()) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/autofilter/tdf140469.xlsx b/sc/qa/uitest/data/autofilter/tdf140469.xlsx new file mode 100644 index ..3c90c7cfe1b1 Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf140469.xlsx differ diff --git a/sc/source/filter/inc/autofilterbuffer.hxx b/sc/source/filter/inc/autofilterbuffer.hxx index e0270336a10e..3b512f4f98b9 100644 --- a/sc/source/filter/inc/autofilterbuffer.hxx +++ b/sc/source/filter/inc/autofilterbuffer.hxx @@ -64,7 +64,7 @@ public: virtual voidimportRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ); /** Derived classes return converted UNO API filter settings representing all filter settings. */ -virtual ApiFilterSettings finalizeImport( sal_Int32 nMaxCount ); +virtual ApiFilterSettings finalizeImport(); }; @@ -82,7 +82,7 @@ public: virtual voidimportRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ) override; /** Returns converted UNO API filter settings representing all filter settings. */ -virtual ApiFilterSettings finalizeImport( sal_Int32 nMaxCount ) override; +virtual ApiFilterSettings finalizeImport() override; private: @@ -103,7 +103,7 @@ public: virtual voidimportRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ) override; /** Returns converted UNO API filter settings representing all filter settings. */ -virtual ApiFilterSettings finalizeImport( sal_Int32 nMaxCount ) override; +virtual ApiFilterSettings finalizeImport() override; private: double mfValue;/// Number of items or percentage. @@ -141,7 +141,7 @@ public: virtual voidimportRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ) override; /** Returns converted UNO API filter settings representing all filter settings. */ -virtual ApiFilterSettings finalizeImport( sal_Int32 nMaxCount ) override; +virtual ApiFilterSettings finalizeImport() override; private: /** Appends the passed filter criterion, if it contains valid settings. */ @@ -174,7 +174,7 @@ public: /** Returns converted UNO API filter settings representing all filter settings of this column. */ -ApiFilterSettings finalizeImport( sal_Int32 nMaxCount ); +ApiFilterSettings finalizeImport(); private: std::shared_ptr< FilterSettingsBase > diff --git a/sc/source/filter/oox/autofilterbuffer.cxx b/sc/source/filter/oox/autofilterbuffer.cxx index 757981a66ee3..a9ec62c4e655 100644 --- a/sc/source/filter/oox/autofilterbuffer.cxx +++ b/sc/source/filter/oox/autofilterbuffer.cxx @@ -205,7 +205,7 @@ void FilterSettingsBase::importRecord( sal_Int32 /*nRecId*/, SequenceInputStream { } -ApiFilterSettings FilterSettingsBase::finalizeImport( sal_Int32
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf139763ShapeAnchor.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx | 32 + sc/source/filter/oox/drawingbase.cxx |2 + 3 files changed, 34 insertions(+) New commits: commit b2848591ca529004fcfef9bd0f3650750b3735d7 Author: Regina Henschel AuthorDate: Tue Feb 23 21:39:00 2021 +0100 Commit: Regina Henschel CommitDate: Wed Feb 24 00:40:15 2021 +0100 tdf#139763 set anchor type in meEditAs in all cases OOXML specifies a shape anchor type with xdr:absoluteAnchor and xdr:oneCellAnchor, or with xdr:twoCellAnchor and the attribute editAs with values 'absolute' and 'oneCell'. For our UI the member meEditAs is used. But only in case twoCellAnchor it was set. The patch adds the missing assignments. Change-Id: Iceffd4c5c7640e4d9a614cd52cb491774989595f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111436 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/sc/qa/unit/data/xlsx/tdf139763ShapeAnchor.xlsx b/sc/qa/unit/data/xlsx/tdf139763ShapeAnchor.xlsx new file mode 100644 index ..9c255c3ee836 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf139763ShapeAnchor.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index b70777b1c176..b5f9d0f12fd4 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -306,6 +306,7 @@ public: void testDrawCircleInMergeCells(); void testDeleteCirclesInRowAndCol(); void testTdf129940(); +void testTdf139763ShapeAnchor(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testCondFormatOperatorsSameRangeXLSX); @@ -495,6 +496,7 @@ public: CPPUNIT_TEST(testDrawCircleInMergeCells); CPPUNIT_TEST(testDeleteCirclesInRowAndCol); CPPUNIT_TEST(testTdf129940); +CPPUNIT_TEST(testTdf139763ShapeAnchor); CPPUNIT_TEST_SUITE_END(); @@ -5491,6 +5493,36 @@ void ScFiltersTest::testTdf129940() xDocSh->DoClose(); } +void ScFiltersTest::testTdf139763ShapeAnchor() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf139763ShapeAnchor.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load cell-anchored-shapes.xlsx", xDocSh.is()); + +// There are two objects on the first sheet, anchored to page by element xdr:absoluteAnchor +// and anchored to cell by element xdr:oneCellAnchor. Error was, that they were imported as +// "anchor to cell (resize with cell". +ScDocument& rDoc = xDocSh->GetDocument(); + +CPPUNIT_ASSERT_MESSAGE("There should be at least one sheet.", rDoc.GetTableCount() > 0); + +ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); +SdrPage* pPage = pDrawLayer->GetPage(0); +CPPUNIT_ASSERT_MESSAGE("draw page for sheet 1 should exist.", pPage); +// There should be 2 shapes +CPPUNIT_ASSERT_EQUAL(static_cast(2), pPage->GetObjCount()); + +SdrObject* pObj = pPage->GetObj(0); +CPPUNIT_ASSERT_MESSAGE("Failed to get page anchored object.", pObj); +CPPUNIT_ASSERT_MESSAGE("Shape must be page anchored", !ScDrawLayer::IsCellAnchored(*pObj)); + +pObj = pPage->GetObj(1); +CPPUNIT_ASSERT_MESSAGE("Failed to get cell anchored object.", pObj); +CPPUNIT_ASSERT_MESSAGE("Shape must be anchored to cell.", ScDrawLayer::IsCellAnchored(*pObj)); +CPPUNIT_ASSERT_MESSAGE("Shape must not resize with cell.", !ScDrawLayer::IsResizeWithCell(*pObj)); + +xDocSh->DoClose(); +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "sc/qa/unit/data" ) { diff --git a/sc/source/filter/oox/drawingbase.cxx b/sc/source/filter/oox/drawingbase.cxx index 29ef7d4b53c4..938f3fa67fcc 100644 --- a/sc/source/filter/oox/drawingbase.cxx +++ b/sc/source/filter/oox/drawingbase.cxx @@ -75,9 +75,11 @@ void ShapeAnchor::importAnchor( sal_Int32 nElement, const AttributeList& rAttrib { case XDR_TOKEN( absoluteAnchor ): meAnchorType = ANCHOR_ABSOLUTE; +meEditAs = ANCHOR_ABSOLUTE; break; case XDR_TOKEN( oneCellAnchor ): meAnchorType = ANCHOR_ONECELL; +meEditAs = ANCHOR_ONECELL; break; case XDR_TOKEN( twoCellAnchor ): { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/data/tdf105301.ods |binary sc/qa/uitest/sort/tdf105301.py| 42 ++ sc/source/ui/dbgui/sortkeydlg.cxx |7 ++ 3 files changed, 49 insertions(+) New commits: commit fb1aa71ca3f7bec3fa6a10c4c3dec37987b213a2 Author: Xisco Fauli AuthorDate: Wed Feb 17 21:48:26 2021 +0100 Commit: Xisco Fauli CommitDate: Wed Feb 17 23:43:19 2021 +0100 tdf#105301: sc: Add UItest Also add a way to distinguish the different sort keys. Similar to d4ca173f2babde53c1d20f10e335244b092c5c97 Change-Id: I89499cf73ad9932f401bb9a54c30510082d59601 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111086 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sc/qa/uitest/data/tdf105301.ods b/sc/qa/uitest/data/tdf105301.ods new file mode 100644 index ..58f2fe759e06 Binary files /dev/null and b/sc/qa/uitest/data/tdf105301.ods differ diff --git a/sc/qa/uitest/sort/tdf105301.py b/sc/qa/uitest/sort/tdf105301.py new file mode 100644 index ..71ec6372c762 --- /dev/null +++ b/sc/qa/uitest/sort/tdf105301.py @@ -0,0 +1,42 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf105301(UITestCase): + +def test_tdf105301(self): +calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf105301.ods")) +xCalcDoc = self.xUITest.getTopFocusWindow() +gridwin = xCalcDoc.getChild("grid_window") +document = self.ui_test.get_component() + +gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:R9"})) + +self.ui_test.execute_dialog_through_command(".uno:DataSort") +xDialog = self.xUITest.getTopFocusWindow() +xTabs = xDialog.getChild("tabcontrol") +select_pos(xTabs, "0") +self.assertEqual("Column B", get_state_as_dict(xDialog.getChild("sortlb"))['DisplayText']) +self.assertEqual("Column C", get_state_as_dict(xDialog.getChild("sortlb2"))['DisplayText']) +self.assertEqual("Column D", get_state_as_dict(xDialog.getChild("sortlb3"))['DisplayText']) + +# Without the fix in place, this test would have failed with +# AssertionError: 'Column E' != '- undefined -' +self.assertEqual("Column E", get_state_as_dict(xDialog.getChild("sortlb4"))['DisplayText']) +self.assertEqual("Column F", get_state_as_dict(xDialog.getChild("sortlb5"))['DisplayText']) +self.assertEqual("Column G", get_state_as_dict(xDialog.getChild("sortlb6"))['DisplayText']) +self.assertEqual("- undefined -", get_state_as_dict(xDialog.getChild("sortlb7"))['DisplayText']) + +xOk = xDialog.getChild("ok") +self.ui_test.close_dialog_through_button(xOk) + +self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/source/ui/dbgui/sortkeydlg.cxx b/sc/source/ui/dbgui/sortkeydlg.cxx index a5cf6e8f4e66..cee1f54e0607 100644 --- a/sc/source/ui/dbgui/sortkeydlg.cxx +++ b/sc/source/ui/dbgui/sortkeydlg.cxx @@ -57,6 +57,13 @@ void ScSortKeyWindow::AddSortKey( sal_uInt16 nItemNumber ) OUString::number( nItemNumber ); pSortKeyItem->m_xFrame->set_label(aLine); +// for ui-testing. Distinguish the sort keys +if ( m_aSortKeyItems.size() > 0 ) +{ +pSortKeyItem->m_xLbSort->set_buildable_name( +pSortKeyItem->m_xLbSort->get_buildable_name() + OString::number(m_aSortKeyItems.size() + 1)); +} + m_aSortKeyItems.push_back(std::unique_ptr(pSortKeyItem)); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/scshapetest.cxx| 55 +- sc/source/ui/inc/fuconstr.hxx |4 ++- sc/source/ui/inc/fuconuno.hxx | 10 --- 3 files changed, 63 insertions(+), 6 deletions(-) New commits: commit ae2e7a2a7f9fc56f0388b823a6e35111c4005619 Author: Regina Henschel AuthorDate: Mon Feb 15 22:07:41 2021 +0100 Commit: Regina Henschel CommitDate: Tue Feb 16 21:38:01 2021 +0100 tdf#140252 unit test Controls in Calc are always on layer 'controls' This is the missing unit test for the case of drag-created controls in the fix in commit 1d53f3709de2956f14db31677b6c461f33843bd9. Change-Id: I3afce044588e6b5d850d948dd0cbc4df9185029d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110959 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx index 8d50feb0f02e..a6d591c006fd 100644 --- a/sc/qa/unit/scshapetest.cxx +++ b/sc/qa/unit/scshapetest.cxx @@ -19,15 +19,16 @@ #include #include #include -#include #include #include +#include #include #include #include #include #include +#include #include #include @@ -45,6 +46,7 @@ public: ScShapeTest(); void saveAndReload(css::uno::Reference& xComponent, const OUString& rFilter); +void testTdf140252_DragCreateFormControl(); void testTdf134355_DragCreateCustomShape(); void testTdf140252_LayerOfControl(); void testTdf137082_LTR_to_RTL(); @@ -70,6 +72,7 @@ public: void testCustomShapeCellAnchoredRotatedShape(); CPPUNIT_TEST_SUITE(ScShapeTest); +CPPUNIT_TEST(testTdf140252_DragCreateFormControl); CPPUNIT_TEST(testTdf134355_DragCreateCustomShape); CPPUNIT_TEST(testTdf140252_LayerOfControl); CPPUNIT_TEST(testTdf137082_LTR_to_RTL); @@ -201,6 +204,56 @@ static SdrObject* lcl_getSdrObjectWithAssert(ScDocument& rDoc, sal_uInt16 nObjNu return pObj; } +void ScShapeTest::testTdf140252_DragCreateFormControl() +{ +// Error was, that drag-created form controls were initially not on layer 'controls' and thus +// other shapes could be placed in front of form controls. +// Load an empty document. +OUString aFileURL; +createFileURL(u"ManualColWidthRowHeight.ods", aFileURL); +uno::Reference xComponent = loadFromDesktop(aFileURL); +CPPUNIT_ASSERT(xComponent.is()); + +// Get ScTabViewShell +ScDocShell* pDocSh = lcl_getScDocShellWithAssert(xComponent); +ScTabViewShell* pTabViewShell = lcl_getScTabViewShellWithAssert(pDocSh); + +// drag-create a push button as example of form control +SfxUInt16Item aIdentifierItem(SID_FM_CONTROL_IDENTIFIER, OBJ_FM_BUTTON); +SfxUInt32Item aInventorItem(SID_FM_CONTROL_INVENTOR, sal_uInt32(SdrInventor::FmForm)); +const SfxPoolItem* pArgs[] = { , , nullptr }; +pTabViewShell->GetViewData().GetDispatcher().Execute(SID_FM_CREATE_CONTROL, + SfxCallMode::SYNCHRON, pArgs); +// above includes creation of FuConstUnoControl and call of its Activate() method + +// get FuConstUnoControl +ScTabView* pTabView = pTabViewShell->GetViewData().GetView(); +CPPUNIT_ASSERT(pTabView); +FuConstUnoControl* pFuConstUC = static_cast(pTabView->GetDrawFuncPtr()); +CPPUNIT_ASSERT(pFuConstUC); + +// drag-create shape, points are in pixel +MouseEvent aMouseEvent(Point(50, 100), 1, MouseEventModifiers::NONE, MOUSE_LEFT, 0); +pFuConstUC->MouseButtonDown(aMouseEvent); +aMouseEvent = MouseEvent(Point(200, 250), 1, MouseEventModifiers::DRAGMOVE, MOUSE_LEFT, 0); +pFuConstUC->MouseMove(aMouseEvent); +aMouseEvent = MouseEvent(Point(200, 250), 1, MouseEventModifiers::NONE, MOUSE_LEFT, 0); +pFuConstUC->MouseButtonUp(aMouseEvent); +pFuConstUC->Deactivate(); +pTabViewShell->SetDrawShell(false); + +// Get document and newly created push button. +ScDocument& rDoc = pDocSh->GetDocument(); +SdrUnoObj* pObj = static_cast(lcl_getSdrObjectWithAssert(rDoc, 0)); + +// Without the fix in place, the shape would be on layer SC_LAYER_FRONT (0) +sal_uInt8 nExpectedID = sal_uInt8(SC_LAYER_CONTROLS); +sal_uInt8 nActualID = pObj->GetLayer().get(); +CPPUNIT_ASSERT_EQUAL(nExpectedID, nActualID); + +pDocSh->DoClose(); +} + void ScShapeTest::testTdf134355_DragCreateCustomShape() { // Error was, that drag-created custom shapes were initially on layer "controls", although that diff --git a/sc/source/ui/inc/fuconstr.hxx b/sc/source/ui/inc/fuconstr.hxx index e87a32092b26..7fa20b7c86d0 100644 --- a/sc/source/ui/inc/fuconstr.hxx +++ b/sc/source/ui/inc/fuconstr.hxx @@ -22,6 +22,8 @@ #include "fudraw.hxx" +#include // SC_DLLPUBLIC is needed for unittest + /** Draw rectangle */ class FuConstruct : public FuDraw { @@ -32,7 +34,7 @@ public: virtual ~FuConstruct() override; // Mouse- & Key-Events