[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/extras/macros-test.cxx |4 sc/qa/extras/testdocuments/vba_endFunction.xls |binary sc/source/ui/vba/vbarange.cxx | 15 --- 3 files changed, 12 insertions(+), 7 deletions(-) New commits: commit 15e758d199e0d7305e9587cd609f494f9ad55285 Author: Justin Luth justin_l...@sil.org Date: Mon Apr 6 19:04:52 2015 +0300 tdf#90447 vba end() needed to restore activesheet too. Change-Id: I650a5112511fd57099be3f0a84314d0577deae22 Reviewed-on: https://gerrit.libreoffice.org/15175 Tested-by: Jenkins c...@libreoffice.org Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index 2c6ac2b..2c7f5b8 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -225,6 +225,10 @@ void ScMacrosTest::testVba() OUString(Names.), OUString(vnd.sun.Star.script:VBAProject.testMacros.test?language=Basiclocation=document) }, +{ +OUString(vba_endFunction.), + OUString(vnd.sun.Star.script:VBAProject.testMacros.test?language=Basiclocation=document) +}, }; OUString sTempDir; OUString sTempDirURL; diff --git a/sc/qa/extras/testdocuments/vba_endFunction.xls b/sc/qa/extras/testdocuments/vba_endFunction.xls new file mode 100644 index 000..af7fa86 Binary files /dev/null and b/sc/qa/extras/testdocuments/vba_endFunction.xls differ diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 1e249a7..d312d3a 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -3557,17 +3557,18 @@ ScVbaRange::End( ::sal_Int32 Direction ) throw (uno::RuntimeException, std::exc // around ScTabView::MoveCursorArea(), thats the bit that calcutes // where the cursor should go ) // Main problem with this method is the ultra hacky attempt to preserve -// the ActiveCell, there should be no need to go to these extreems +// the ActiveCell, there should be no need to go to these extremes -// Save ActiveCell pos ( to restore later ) +// Save ActiveSheet/ActiveCell pos ( to restore later ) uno::Any aDft; uno::Reference excel::XApplication xApplication( Application(), uno::UNO_QUERY_THROW ); +uno::Reference excel::XWorksheet sActiveSheet = xApplication-getActiveSheet(); OUString sActiveCell = xApplication-getActiveCell()-Address(aDft, aDft, aDft, aDft, aDft ); // position current cell upper left of this range Cells( uno::makeAny( (sal_Int32) 1 ), uno::makeAny( (sal_Int32) 1 ) )-Select(); -uno::Reference frame::XModel xModel = getModelFromRange( mxRange ); +uno::Reference frame::XModel xModel = getModelFromRange( mxRange ); SfxViewFrame* pViewFrame = excel::getViewFrame( xModel ); if ( pViewFrame ) @@ -3607,14 +3608,14 @@ ScVbaRange::End( ::sal_Int32 Direction ) throw (uno::RuntimeException, std::exc // result is the ActiveCell OUString sMoved =xApplication-getActiveCell()-Address(aDft, aDft, aDft, aDft, aDft ); -// restore old ActiveCell uno::Any aVoid; +uno::Reference excel::XRange resultCell; +resultCell.set( xApplication-getActiveSheet()-Range( uno::makeAny( sMoved ), aVoid ), uno::UNO_QUERY_THROW ); -uno::Reference excel::XRange xOldActiveCell( xApplication-getActiveSheet()-Range( uno::makeAny( sActiveCell ), aVoid ), uno::UNO_QUERY_THROW ); +// restore old ActiveCell +uno::Reference excel::XRange xOldActiveCell( sActiveSheet-Range( uno::makeAny( sActiveCell ), aVoid ), uno::UNO_QUERY_THROW ); xOldActiveCell-Select(); -uno::Reference excel::XRange resultCell; -resultCell.set( xApplication-getActiveSheet()-Range( uno::makeAny( sMoved ), aVoid ), uno::UNO_QUERY_THROW ); // return result return resultCell; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx| 68 +++- sc/qa/unit/ucalc.hxx|4 ++ sc/source/core/data/column4.cxx |2 - 3 files changed, 72 insertions(+), 2 deletions(-) New commits: commit 097a16b59884c777f724cec6c5d42734974ed44b Author: Henry Castro hcvcas...@gmail.com Date: Fri Mar 6 13:51:25 2015 -0400 Resolves tdf#80137 Paste array formula into range pastes as non-array formula Change-Id: I58b32e5af07702b76afb901a3ec270453462 Reviewed-on: https://gerrit.libreoffice.org/14770 Tested-by: Jenkins c...@libreoffice.org Reviewed-by: Andras Timar andras.ti...@collabora.com diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 330ff68..2f11f48 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1,4 +1,3 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * @@ -6311,6 +6310,73 @@ void Test::testSetStringAndNote() m_pDoc-DeleteTab(0); } +void Test::testCopyPasteMatrixFormula() +{ +m_pDoc-InsertTab(0, hcv); + +// Set Values to B1, C1, D1 +m_pDoc-SetValue(ScAddress(1,0,0), 2.0);// B1 +m_pDoc-SetValue(ScAddress(2,0,0), 5.0);// C1 +m_pDoc-SetValue(ScAddress(3,0,0), 3.0);// D1 + +// Set Values to B2, C2 +m_pDoc-SetString(ScAddress(1,1,0), B2); // B2 +//m_pDoc-SetString(ScAddress(2,1,0), C2); // C2 +m_pDoc-SetString(ScAddress(3,1,0), D2); // D2 + +// Set Vallues to D3 +//m_pDoc-SetValue(ScAddress(1,2,0), 9.0);// B3 +//m_pDoc-SetString(ScAddress(2,2,0), C3); // C3 +m_pDoc-SetValue(ScAddress(3,2,0), 11.0); // D3 + +// Insert matrix formula to A1 +ScMarkData aMark; +aMark.SelectOneTable(0); +m_pDoc-InsertMatrixFormula(0, 0, 0, 0, aMark, =COUNTIF(ISBLANK(B1:D1);TRUE())); +m_pDoc-CalcAll(); +// A1 should containg 0 +CPPUNIT_ASSERT_EQUAL( 0.0, m_pDoc-GetValue(ScAddress(0,0,0)) ); // A1 + +// Copy cell A1 to clipboard. +ScAddress aPos(0,0,0); // A1 +ScDocument aClipDoc(SCDOCMODE_CLIP); +ScClipParam aParam(aPos, false); +m_pDoc-CopyToClip(aParam, aClipDoc, aMark); +// Formula string should be equal. +CPPUNIT_ASSERT_EQUAL(m_pDoc-GetString(aPos), aClipDoc.GetString(aPos)); + +// First try single range. +// Paste matrix formula to A2 +pasteFromClip(m_pDoc, ScRange(0,1,0,0,1,0), aClipDoc); // A2 +// A2 Cell value should contain 1.0 +CPPUNIT_ASSERT_EQUAL( 1.0, m_pDoc-GetValue(ScAddress(0,1,0))); + +// Paste matrix formula to A3 +pasteFromClip(m_pDoc, ScRange(0,2,0,0,2,0), aClipDoc); // A3 +// A3 Cell value should contain 2.0 +CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc-GetValue(ScAddress(0,2,0))); + +// Paste matrix formula to A4 +pasteFromClip(m_pDoc, ScRange(0,3,0,0,3,0), aClipDoc); // A4 +// A4 Cell value should contain 3.0 +CPPUNIT_ASSERT_EQUAL( 3.0, m_pDoc-GetValue(ScAddress(0,3,0))); + +// Clear cell A2:A4 +clearRange(m_pDoc, ScRange(0,1,0,0,3,0)); + +// Paste matrix formula to range A2:A4 +pasteFromClip(m_pDoc, ScRange(0,1,0,0,3,0), aClipDoc); // A2:A4 + +// A2 Cell value should contain 1.0 +CPPUNIT_ASSERT_EQUAL( 1.0, m_pDoc-GetValue(ScAddress(0,1,0))); +// A3 Cell value should contain 2.0 +CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc-GetValue(ScAddress(0,2,0))); +// A4 Cell value should contain 3.0 +CPPUNIT_ASSERT_EQUAL( 3.0, m_pDoc-GetValue(ScAddress(0,3,0))); + +m_pDoc-DeleteTab(0); +} + ScDocShell* Test::findLoadedDocShellByName(const OUString rName) { TypeId aType(TYPE(ScDocShell)); diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index d9f1e58..66d2817 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -424,6 +424,9 @@ public: void testColumnFindEditCells(); void testSetStringAndNote(); +// tdf#80137 +void testCopyPasteMatrixFormula(); + CPPUNIT_TEST_SUITE(Test); #if CALC_TEST_PERF CPPUNIT_TEST(testPerf); @@ -627,6 +630,7 @@ public: CPPUNIT_TEST(testFormulaToValue2); CPPUNIT_TEST(testColumnFindEditCells); CPPUNIT_TEST(testSetStringAndNote); +CPPUNIT_TEST(testCopyPasteMatrixFormula); CPPUNIT_TEST_SUITE_END(); private: diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index ee64aa0..d8c10ab 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -516,7 +516,7 @@ void ScColumn::CloneFormulaCell( xGroup-compileCode(*pDocument, aPos, pDocument-GetGrammar()); for (size_t i = 0; i nLen; ++i, aPos.IncRow()) { -ScFormulaCell* pCell = new ScFormulaCell(pDocument, aPos, xGroup); +ScFormulaCell* pCell = new ScFormulaCell(pDocument, aPos, xGroup, pDocument-GetGrammar(), rSrc.GetMatrixFlag()); if (i == 0) { xGroup-mpTopCell = pCell;
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx| 34 ++ sc/qa/unit/ucalc.hxx|2 ++ sc/source/core/data/dociter.cxx |4 3 files changed, 40 insertions(+) New commits: commit d619d23a1f641fc910723cc32c4d8c8d9a8f3681 Author: László Németh laszlo.nem...@collabora.com Date: Thu Feb 19 15:16:43 2015 +0100 tdf#89436 add unit test for ScHorizontalAttrIterator + OSL_ENSURE to check row-level buffering of the horizontal cell ranges with the same cell attributes Change-Id: If265e1c5a389d4c63bfda4017173d8fe41badb6b diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 5883bf9..b200c1e 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1224,6 +1224,40 @@ void Test::testValueIterator() m_pDoc-DeleteTab(0); } +void Test::testHorizontalAttrIterator() +{ +m_pDoc-InsertTab(0, Test); + +// Set the background color of B2:C3 to blue +ScPatternAttr aCellBackColor(m_pDoc-GetPool()); +aCellBackColor.GetItemSet().Put(SvxBrushItem(COL_BLUE, ATTR_BACKGROUND)); +m_pDoc-ApplyPatternAreaTab(1, 1, 2, 2, 0, aCellBackColor); + +// some numeric data +for (SCCOL i = 1; i = 4; ++i) + for (SCCOL j = 1; j = 4; ++j) +m_pDoc-SetValue(ScAddress(i,j,0), i*10+j); + +{ +const int aChecks[][3] = { {1, 2, 1}, {1, 2, 2} }; +size_t nCheckLen = SAL_N_ELEMENTS(aChecks); + +ScHorizontalAttrIterator aIter(m_pDoc, 0, 0, 0, 3, 3); +SCCOL rCol1, rCol2; +SCROW rRow; +size_t nCheckPos = 0; +for (const ScPatternAttr* pAttr = aIter.GetNext(rCol1, rCol2, rRow); pAttr; pAttr = aIter.GetNext(rCol1, rCol2, rRow), ++nCheckPos) +{ + CPPUNIT_ASSERT_MESSAGE(Iteration longer than expected., nCheckPos nCheckLen); + CPPUNIT_ASSERT_EQUAL(aChecks[nCheckPos][0], static_castint(rCol1)); + CPPUNIT_ASSERT_EQUAL(aChecks[nCheckPos][1], static_castint(rCol2)); + CPPUNIT_ASSERT_EQUAL(aChecks[nCheckPos][2], static_castint(rRow)); +} +} + +m_pDoc-DeleteTab(0); +} + namespace { bool broadcasterShifted(const ScDocument rDoc, const ScAddress rFrom, const ScAddress rTo) diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 9edafa0..1937e4a 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -187,6 +187,7 @@ public: void testHorizontalIterator(); void testValueIterator(); +void testHorizontalAttrIterator(); /** * Basic test for formula dependency tracking. @@ -496,6 +497,7 @@ public: CPPUNIT_TEST(testFuncNOW); CPPUNIT_TEST(testHorizontalIterator); CPPUNIT_TEST(testValueIterator); +CPPUNIT_TEST(testHorizontalAttrIterator); CPPUNIT_TEST(testFormulaDepTracking); CPPUNIT_TEST(testFormulaDepTracking2); CPPUNIT_TEST(testFormulaDepTracking3); diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index cf8cbe2..168f929 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -2266,6 +2266,7 @@ ScHorizontalAttrIterator::ScHorizontalAttrIterator( ScDocument* pDocument, SCTAB pIndices[nPos] = nIndex; pNextEnd[nPos] = nThisEnd; +pPrevColEnd[nPos] = MAXCOL+1; // only for OSL_ENSURE ppPatterns[nPos] = pPattern; } @@ -2301,7 +2302,10 @@ const ScPatternAttr* ScHorizontalAttrIterator::GetNext( SCCOL rCol1, SCCOL rCo rRow = nRow; rCol1 = nCol; if ( bRepeatedRow ) +{ +OSL_ENSURE( pPrevColEnd[nCol-nStartCol] MAXCOL+1, missing stored data ); nCol = pPrevColEnd[nCol-nStartCol]; // use the result stored before +} else { while ( nCol nEndCol ( ppPatterns[nCol+1-nStartCol] == pPat) ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx |4 ++-- sc/source/ui/src/scfuncs.src |4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) New commits: commit e94ada5939acfc6015129c0e5bb470158fe83b34 Author: Joel jmadero@gmail.com Date: Sun Feb 15 10:40:09 2015 -0800 tdf#70733 - Move ISEVEN and ISODD functions to information Moved ISEVEN and ISODD functions from mathematical to information Change-Id: Ib40e877c9809338031e4b3047fd7ef3f12b392a2 Reviewed-on: https://gerrit.libreoffice.org/14501 Tested-by: Jenkins c...@libreoffice.org Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 03c4a52..5883bf9 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -2371,11 +2371,13 @@ void Test::testFunctionLists() ISBLANK, ISERR, ISERROR, +ISEVEN, ISFORMULA, ISLOGICAL, ISNA, ISNONTEXT, ISNUMBER, +ISODD, ISREF, ISTEXT, N, @@ -2435,9 +2437,7 @@ void Test::testFunctionLists() FLOOR.PRECISE, GCD, INT, -ISEVEN, ISO.CEILING, -ISODD, LCM, LN, LOG, diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src index fcff272..1e7be9b 100644 --- a/sc/source/ui/src/scfuncs.src +++ b/sc/source/ui/src/scfuncs.src @@ -3330,7 +3330,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 ExtraData = { 0; -ID_FUNCTION_GRP_MATH; +ID_FUNCTION_GRP_INFO; U2S( HID_FUNC_ISTGERADE ); 1; 0; 0; @@ -3354,7 +3354,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 ExtraData = { 0; -ID_FUNCTION_GRP_MATH; +ID_FUNCTION_GRP_INFO; U2S( HID_FUNC_ISTUNGERADE ); 1; 0; 0; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/contentCSV/financial-functions.csv|3 sc/qa/unit/data/contentCSV/information-functions.csv |2 sc/qa/unit/data/contentCSV/logical-functions.csv |3 sc/qa/unit/data/contentCSV/mathematical-functions.csv | 58 ++ sc/qa/unit/data/contentCSV/spreadsheet-functions.csv | 16 + sc/qa/unit/data/contentCSV/statistical-functions.csv | 153 ++ sc/qa/unit/data/contentCSV/text-functions.csv |3 sc/qa/unit/data/ods/functions.ods |binary sc/source/core/data/dociter.cxx |2 9 files changed, 236 insertions(+), 4 deletions(-) New commits: commit 56ed2a8c24660442bcf42358395acc00bfa595da Author: Raal r...@post.cz Date: Wed Dec 31 08:22:05 2014 +0100 add a few more formula tests Change-Id: I3471227b97802d5f3cf5d41f5530d28163fee37d diff --git a/sc/qa/unit/data/contentCSV/financial-functions.csv b/sc/qa/unit/data/contentCSV/financial-functions.csv index 814df6b..540d095 100644 --- a/sc/qa/unit/data/contentCSV/financial-functions.csv +++ b/sc/qa/unit/data/contentCSV/financial-functions.csv @@ -53,3 +53,6 @@ 8603.80245372397 0.194818475056105 332.570918796713 +0.065069 +0.0609543337 +0.052822572 diff --git a/sc/qa/unit/data/contentCSV/information-functions.csv b/sc/qa/unit/data/contentCSV/information-functions.csv index 660c910..876951e 100644 --- a/sc/qa/unit/data/contentCSV/information-functions.csv +++ b/sc/qa/unit/data/contentCSV/information-functions.csv @@ -16,3 +16,5 @@ FALSE,TRUE,FALSE,TRUE 0,1,42,0 #N/A 1,2,8,64,16 +TRUE,FALSE +FALSE,TRUE diff --git a/sc/qa/unit/data/contentCSV/logical-functions.csv b/sc/qa/unit/data/contentCSV/logical-functions.csv index fd348f7..902009b 100644 --- a/sc/qa/unit/data/contentCSV/logical-functions.csv +++ b/sc/qa/unit/data/contentCSV/logical-functions.csv @@ -1,6 +1,7 @@ FALSE,FALSE,FALSE,TRUE,FALSE FALSE -TRUE,FALSE +TRUE,FALSE,4,1 TRUE,FALSE FALSE,TRUE,TRUE,TRUE,TRUE TRUE +FALSE,TRUE,TRUE diff --git a/sc/qa/unit/data/contentCSV/mathematical-functions.csv b/sc/qa/unit/data/contentCSV/mathematical-functions.csv index 639bc2e..a3577dd 100644 --- a/sc/qa/unit/data/contentCSV/mathematical-functions.csv +++ b/sc/qa/unit/data/contentCSV/mathematical-functions.csv @@ -17,4 +17,60 @@ 5 1.2,1,0,1000 2,4,Err:502 - +7.2672834168,195.583 +-12 +-12,-12,-10 +1,-1 +15,1.5 +0.8509181282 +1 +1.4142135624,2 +1.4142135624,2 +5 +1.5222612189 +0,1.5707963268,30 +-5.1929877137,4 +0.7853981634,45 +0.7853981634,45 +0 +1 +1,1 +2.5066282746 +1.3130352855 +180 +2.7182818285 +6,1 +5,-2 +4,2,0,-2 +8,2 +5,5 +TRUE,FALSE,TRUE,TRUE,FALSE +TRUE,FALSE,TRUE,TRUE +128000 +75 +3 +6 +1.23,-1.234 +1.0986122887,321 +2.0959032743,4 +0.6989700043 +-10 +-10 +-10,-10,-12 +84 +64 +24 +24,120,1.4024,6,#DIV/0! +14,24,33,66 +1,1.25,3 +3,4 +1.5707963268,1.308996939 +1.23,45,-45,900,1.2 +2,2,5,3,5,3,1 +1.41,1.3,46,-46,1000 +0 +8,48.3,5.25 +-20,5.25,48,48,18,210,72,14 +1,1 +0 +7.27,195.58 diff --git a/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv b/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv index b8ba298..8b8caa5 100644 --- a/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv +++ b/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv @@ -2,4 +2,18 @@ $C$2,$A$1,Sheet.B$2,Sheet!R2C2 2,4,4,5,6,15,15,6,9 1,3,4,4,2,2 2,4,7,8,4 -4,5,#N/A,8 +4,5,#N/A,8,1 +24,4,4,4,4,3,4,4,0,12,9,9 +3,3,3,2,3,test +1,3,1,1,1,0 +4,1,2 +32767,502,#N/A +Hyperlink,http://www.example.org +3,1 +1,3,5 +bb,bb,zz +4,Today +yy,test,PLUM,VAN +4,55 +7,3 +2,7 diff --git a/sc/qa/unit/data/contentCSV/statistical-functions.csv b/sc/qa/unit/data/contentCSV/statistical-functions.csv index e4e9574..2e3c45c 100644 --- a/sc/qa/unit/data/contentCSV/statistical-functions.csv +++ b/sc/qa/unit/data/contentCSV/statistical-functions.csv @@ -1 +1,154 @@ 1,1,2,0,3,3 +0.3676796136,0.3676796136 +6.1730730529,6.1730730529 +0.7768698399 +0.7768698399 +4,6,14 +3,6,14,4 +0.0209708029,0.0209708029 +3.2830202868, +11.0704976935,13.388222599 +0.4549364231 +0.0209757694 +0.1115650801,0.7768698399 +0.0002098623,0.5276334473 +11.0704976935 +0.0209708029 +0.0209757694 +7 +0.1938476563,0.1208496094 +0.1938476563,0.1208496094 +0.3501633938 +0.3501633938 +0.6854705811,1.4837646484 +0.9624023438 +0.2907100492 +0 +0 +5.1 +0.8090909091,1 +0.8090909091 +37.6363636364 +41.7937736351 +0.0753454347,0.0149568299 +0 +0 +1.6094379124 +1.6094379124 +0.8646647168 +0.8646647168 +0.3472657011 +0.4621171573 +0.5493061443 +0.9319331609 +0.081755009 +0.9319331609 +0.6143396437 +0.7095282499,0.3856603563 +0.6143396437 +2 +0.1930408167 +0.0106510993 +0.0106510993 +0.1930408167 +8 +0.1735008392 +-29 +-24.8571428571 +-32.25 +-0.6063659074 +0.2976325427 +0.2939945977 +0.2939945977 +4 +4 +4 +0.9278398202 +0.9278398202 +0.0317396518,0.0317396518,0.3989422804 +0.667 +0.625 +0.667 +1.6 +1.1 +1.9 +-0.6063659074 +69.4077578277 +69.4077578277 +0.0299454931,0.9192433408 +0.0299454931,0.9192433408 +0.25,0.75 +0.25 +6 +6 +6 +0,1 +1 +9,7 +200,14
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xls/chartx.xls |binary sc/qa/unit/subsequent_filters-test.cxx | 20 sc/source/filter/inc/xlescher.hxx | 20 3 files changed, 40 insertions(+) New commits: commit 6b5481c0260343800518192918ddf932ee5ae527 Author: Noel Grandin n...@peralex.com Date: Thu Nov 27 14:58:39 2014 +0200 fdo#82312 - Excel chart has a wrong size bug introduced in commit 0c7f35277575fee8594737f5b2842dfac2c6d04f remove SvStream::operator methods Change-Id: I72a1c05b3a4a3f3a250055775eb2d35b3114406d Reviewed-on: https://gerrit.libreoffice.org/13151 Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com diff --git a/sc/qa/unit/data/xls/chartx.xls b/sc/qa/unit/data/xls/chartx.xls new file mode 100644 index 000..2294c15 Binary files /dev/null and b/sc/qa/unit/data/xls/chartx.xls differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index be1955d..39a75c1 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -146,6 +146,7 @@ public: //test shape import void testControlImport(); void testChartImportODS(); +void testChartImportXLS(); void testNumberFormatHTML(); void testNumberFormatCSV(); @@ -215,6 +216,7 @@ public: CPPUNIT_TEST(testRowIndex1BasedXLSX); CPPUNIT_TEST(testControlImport); CPPUNIT_TEST(testChartImportODS); +CPPUNIT_TEST(testChartImportXLS); CPPUNIT_TEST(testDataBarODS); CPPUNIT_TEST(testDataBarXLSX); @@ -1503,6 +1505,23 @@ void ScFiltersTest::testChartImportODS() xDocSh-DoClose(); } +void ScFiltersTest::testChartImportXLS() +{ +ScDocShellRef xDocSh = loadDoc(chartx., XLS); +CPPUNIT_ASSERT_MESSAGE(Failed to load chartx.xls., xDocSh.Is()); + +ScDocument rDoc = xDocSh-GetDocument(); + +// Retrieve the chart object instance from the 2nd page (for the 2nd sheet). +const SdrOle2Obj* pOleObj = getSingleChartObject(rDoc, 0); +CPPUNIT_ASSERT_MESSAGE(Failed to retrieve a chart object from the 2nd sheet., pOleObj); + +CPPUNIT_ASSERT_EQUAL(11148L, pOleObj-GetLogicRect().getWidth()); +CPPUNIT_ASSERT_EQUAL(8635L, pOleObj-GetLogicRect().getHeight()); + +xDocSh-DoClose(); +} + void ScFiltersTest::testNumberFormatHTML() { ScDocShellRef xDocSh = loadDoc(numberformat., HTML); @@ -2679,3 +2698,4 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ScFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ + diff --git a/sc/source/filter/inc/xlescher.hxx b/sc/source/filter/inc/xlescher.hxx index a97882d..90ef41c 100644 --- a/sc/source/filter/inc/xlescher.hxx +++ b/sc/source/filter/inc/xlescher.hxx @@ -321,6 +321,26 @@ inline SvStream operator( SvStream rStrm, XclObjAnchor rAnchor ) return rStrm; } +// creates read method for XclImpStream +template typename StreamType +StreamType operator( StreamType rStrm, XclObjAnchor rAnchor ) +{ +sal_uInt16 tmpFirstRow, tmpTY, tmpLastRow, tmpBY; + +rStrm + rAnchor.maFirst.mnCol rAnchor.mnLX + tmpFirstRow tmpTY + rAnchor.maLast.mnCol rAnchor.mnRX + tmpLastRow tmpBY; + +rAnchor.maFirst.mnRow = static_castsal_uInt32 (tmpFirstRow); +rAnchor.mnTY = static_castsal_uInt32 (tmpTY); +rAnchor.maLast.mnRow = static_castsal_uInt32 (tmpLastRow); +rAnchor.mnBY = static_castsal_uInt32 (tmpBY); + +return rStrm; +} + template typename StreamType StreamType operator( StreamType rStrm, const XclObjAnchor rAnchor ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc_pivottable.cxx | 52 +++ sc/source/core/data/dpoutput.cxx |9 ++ 2 files changed, 35 insertions(+), 26 deletions(-) New commits: commit 902564bfe52e7699cefc80b3334c2eb0a8cacdcf Author: Kohei Yoshida kohei.yosh...@collabora.com Date: Wed Sep 17 11:24:56 2014 -0400 bnc#592918: Display data description in pivot table. When there are no column fields and exactly one data field. Change-Id: I10d2af7e626f98a4d8a981e078e99e7da9207d1c diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx index 40b3d6c..ef24b49 100644 --- a/sc/qa/unit/ucalc_pivottable.cxx +++ b/sc/qa/unit/ucalc_pivottable.cxx @@ -1075,7 +1075,7 @@ void Test::testPivotTableNormalGrouping() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { -{ Name, 0 }, +{ Name, Sum - Value }, { A, 1 }, { B, 2 }, { C, 3 }, @@ -1123,7 +1123,7 @@ void Test::testPivotTableNormalGrouping() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][3] = { -{ Name2, Name, 0 }, +{ Name2, Name, Sum - Value }, { D, D, 4 }, { E, E, 5 }, { F, F, 6 }, @@ -1160,7 +1160,7 @@ void Test::testPivotTableNormalGrouping() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][3] = { -{ Name2, Name, 0 }, +{ Name2, Name, Sum - Value }, { G, G, 7 }, { Group1, A, 1 }, { 0,B, 2 }, @@ -1257,7 +1257,7 @@ void Test::testPivotTableNumberGrouping() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { -{ Order, 0 }, +{ Order, Sum - Score }, { 30, 423 }, { 30-39, 87 }, { 40-49, 241 }, @@ -1372,7 +1372,7 @@ void Test::testPivotTableDateGrouping() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][4] = { -{ Years, Quarters, Date, 0 }, +{ Years, Quarters, Date, Sum - Value }, { 2011, Q1, Jan, 1 }, { 0, 0, Mar, 2 }, { 0, Q3, Sep, 7 }, @@ -1404,7 +1404,7 @@ void Test::testPivotTableDateGrouping() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][4] = { -{ Years, Quarters, Date, 0 }, +{ Years, Quarters, Date, Sum - Value }, { 2011, Q1, Jan, 1 }, { 0, 0, Mar, 2 }, { 0, Q3, Sep, 7 }, @@ -1428,7 +1428,7 @@ void Test::testPivotTableDateGrouping() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { -{ Date, 0 }, +{ Date, Sum - Value }, { 2011-01-01, 1 }, { 2011-03-02, 2 }, { 2011-09-03, 7 }, @@ -1496,7 +1496,7 @@ void Test::testPivotTableEmptyRows() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { -{ Name, 0 }, +{ Name, Sum - Value }, { A, 1 }, { B, 2 }, { C, 3 }, @@ -1519,7 +1519,7 @@ void Test::testPivotTableEmptyRows() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { -{ Name, 0 }, +{ Name, Sum - Value }, { A, 1 }, { B, 2 }, { C, 3 }, @@ -1546,7 +1546,7 @@ void Test::testPivotTableEmptyRows() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { -{ Name, 0 }, +{ Name, Sum - Value }, { B, 3 }, { C, 3 }, { D, 4 }, @@ -1624,7 +1624,7 @@ void Test::testPivotTableTextNumber() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { -{ Name, 0 }, +{ Name, Sum - Value }, { 0001, 1 }, { 0002, 2 }, { 0003, 3 }, @@ -1708,7 +1708,7 @@ void Test::testPivotTableCaseInsensitiveStrings() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { -{ Name, 0 }, +{ Name, Sum - Value }, { A, 3 }, { Total Result, 3 }, }; @@ -1871,7 +1871,7 @@ void Test::testPivotTableFieldReference() { // Expected output table content. 0 = empty cell const char* aOutputCheck[][2] = { -{ Name, 0 }, +{ Name, Sum - Value }, { A, 1 }, { B, 2 }, { C, 4 }, @@ -1898,7 +1898,7 @@ void Test::testPivotTableFieldReference() { // Expected
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx | 20 sc/source/filter/oox/stylesbuffer.cxx | 15 --- 2 files changed, 24 insertions(+), 11 deletions(-) New commits: commit 910c2888bcc87eb48f88b974cb822c5e98d91e64 Author: Kohei Yoshida kohei.yosh...@collabora.com Date: Wed Mar 19 00:47:22 2014 -0400 Enable import export test for dash-dot and dash-dot-dot line types. And this already has revealed one bug in the xlsx import filter code! Change-Id: Ib845a5492ec7b62b8528b31eac8cd1b285500184 diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index ce1e9d5..45964fc 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -1048,14 +1048,18 @@ void ScExportTest::testExcelCellBorders( sal_uLong nFormatType ) sal_Int16 mnStyle; long mnWidth; } aChecks[] = { -{ 1, table::BorderLineStyle::SOLID,1L }, // hair -{ 3, table::BorderLineStyle::DOTTED, 15L }, // thin -{ 9, table::BorderLineStyle::FINE_DASHED, 15L }, // dashed -{ 11, table::BorderLineStyle::SOLID, 15L }, // thin -{ 19, table::BorderLineStyle::DASHED, 35L }, // medium dashed -{ 21, table::BorderLineStyle::SOLID, 35L }, // medium -{ 23, table::BorderLineStyle::SOLID, 50L }, // thick -{ 25, table::BorderLineStyle::DOUBLE_THIN, -1L }, // double (don't check width) +{ 1, table::BorderLineStyle::SOLID, 1L }, // hair +{ 3, table::BorderLineStyle::DOTTED, 15L }, // dotted +{ 5, table::BorderLineStyle::DASH_DOT_DOT, 15L }, // dash dot dot +{ 7, table::BorderLineStyle::DASH_DOT, 15L }, // dash dot +{ 9, table::BorderLineStyle::FINE_DASHED, 15L }, // dashed +{ 11, table::BorderLineStyle::SOLID,15L }, // thin +{ 13, table::BorderLineStyle::DASH_DOT_DOT, 35L }, // medium dash dot dot +{ 17, table::BorderLineStyle::DASH_DOT, 35L }, // medium dash dot +{ 19, table::BorderLineStyle::DASHED, 35L }, // medium dashed +{ 21, table::BorderLineStyle::SOLID,35L }, // medium +{ 23, table::BorderLineStyle::SOLID,50L }, // thick +{ 25, table::BorderLineStyle::DOUBLE_THIN, -1L }, // double (don't check width) }; for (size_t i = 0; i SAL_N_ELEMENTS(aChecks); ++i) diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index ee0542e..842c168 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -1747,14 +1747,23 @@ bool Border::convertBorderLine( BorderLine2 rBorderLine, const BorderLineModel break; case XML_hair: lclSetBorderLineWidth( rBorderLine, API_LINE_HAIR );break; case XML_medium:lclSetBorderLineWidth( rBorderLine, API_LINE_MEDIUM ); break; -case XML_mediumDashDot: lclSetBorderLineWidth( rBorderLine, API_LINE_MEDIUM ); break; -case XML_mediumDashDotDot: lclSetBorderLineWidth( rBorderLine, API_LINE_MEDIUM ); break; +case XML_mediumDashDot: +lclSetBorderLineWidth( rBorderLine, API_LINE_MEDIUM ); +rBorderLine.LineStyle = table::BorderLineStyle::DASH_DOT; +break; +case XML_mediumDashDotDot: +lclSetBorderLineWidth( rBorderLine, API_LINE_MEDIUM ); +rBorderLine.LineStyle = table::BorderLineStyle::DASH_DOT_DOT; +break; case XML_mediumDashed: lclSetBorderLineWidth( rBorderLine, API_LINE_MEDIUM ); rBorderLine.LineStyle = table::BorderLineStyle::DASHED; break; case XML_none: lclSetBorderLineWidth( rBorderLine, API_LINE_NONE );break; -case XML_slantDashDot: lclSetBorderLineWidth( rBorderLine, API_LINE_MEDIUM ); break; +case XML_slantDashDot: +lclSetBorderLineWidth( rBorderLine, API_LINE_MEDIUM ); +rBorderLine.LineStyle = table::BorderLineStyle::DASH_DOT; +break; case XML_thick: lclSetBorderLineWidth( rBorderLine, API_LINE_THICK ); break; case XML_thin: lclSetBorderLineWidth( rBorderLine, API_LINE_THIN );break; default:lclSetBorderLineWidth( rBorderLine, API_LINE_NONE );break; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/functions-excel-2010.xlsx |binary sc/source/core/tool/interpr2.cxx | 32 - 2 files changed, 6 insertions(+), 26 deletions(-) New commits: commit 0abe86ca86b91e83815b0d95e1d08bf7fbc697d2 Author: Eike Rathke er...@redhat.com Date: Mon Mar 10 20:49:38 2014 +0100 round to multiple of absolute significance, fdo#71720 follow-up The new functions FLOOR.PRECISE, CEILING.PRECISE and ISO.CEILING always round to a multiple of the absolute value of the significance given, returning the mathematical floor/ceiling in all cases. Also changed the test doc to use some meaningful values for these functions. Change-Id: Id5a26092838765143e2d308afa49e7119107dac5 diff --git a/sc/qa/unit/data/xlsx/functions-excel-2010.xlsx b/sc/qa/unit/data/xlsx/functions-excel-2010.xlsx old mode 100755 new mode 100644 index 48f5a7f..208c1c5 Binary files a/sc/qa/unit/data/xlsx/functions-excel-2010.xlsx and b/sc/qa/unit/data/xlsx/functions-excel-2010.xlsx differ diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 885f00c..0c38865 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -638,27 +638,17 @@ void ScInterpreter::ScCeil_MS() if ( nParamCount == 1 ) { fVal = GetDouble(); -fDec = ( fVal 0 ? -1 : 1 ); +fDec = 1.0; } else { -bool bArgumentMissing = IsMissing(); -fDec = GetDouble(); +fDec = fabs( GetDoubleWithDefault( 1.0 )); fVal = GetDouble(); -if ( bArgumentMissing ) -fDec = ( fVal 0 ? -1 : 1 ); } if ( fDec == 0.0 || fVal == 0.0 ) PushInt( 0 ); else -{ -if ( fVal * fDec 0.0 ) -fDec *= -1.0; -if ( fVal 0.0 ) -PushDouble(::rtl::math::approxFloor( fVal / fDec ) * fDec ); -else -PushDouble(::rtl::math::approxCeil( fVal / fDec ) * fDec ); -} +PushDouble(::rtl::math::approxCeil( fVal / fDec ) * fDec ); } } @@ -693,27 +683,17 @@ void ScInterpreter::ScFloor_MS() if ( nParamCount == 1 ) { fVal = GetDouble(); -fDec = ( fVal 0 ? -1 : 1 ); +fDec = 1.0; } else { -bool bArgumentMissing = IsMissing(); -fDec = GetDouble(); +fDec = fabs( GetDoubleWithDefault( 1.0 )); fVal = GetDouble(); -if ( bArgumentMissing ) -fDec = ( fVal 0 ? -1 : 1 ); } if ( fDec == 0.0 || fVal == 0.0 ) PushInt( 0 ); else -{ -if ( fVal * fDec 0.0 ) -fDec *= -1.0; -if ( fVal 0.0 ) -PushDouble(::rtl::math::approxCeil( fVal / fDec ) * fDec ); -else -PushDouble(::rtl::math::approxFloor( fVal / fDec ) * fDec ); -} +PushDouble(::rtl::math::approxFloor( fVal / fDec ) * fDec ); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx|1 + sc/source/ui/docshell/impex.cxx | 17 ++--- sc/source/ui/inc/impex.hxx |2 ++ sc/source/ui/view/viewfun5.cxx |1 + 4 files changed, 14 insertions(+), 7 deletions(-) New commits: commit 3d869cda8db03820dea8c4ba463eb155d05e933b Author: Kohei Yoshida kohei.yosh...@collabora.com Date: Thu Jan 30 17:41:23 2014 -0500 fdo#74014: Brodcast only when pasting, not during file import. Change-Id: I7cca5d459491fca782f24093dcdd7d0c1c69bdc9 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 7e9bba7..5811dc0 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -5194,6 +5194,7 @@ void Test::testImportStream() aOpt.SetFieldSeps(,); ScImportExport aObj(m_pDoc, ScAddress(0,0,0)); +aObj.SetImportBroadcast(true); aObj.SetExtOptions(aOpt); aObj.ImportString(1,2,3, FORMAT_STRING); diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index bf1c048..d6ce4f3 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -89,7 +89,7 @@ ScImportExport::ScImportExport( ScDocument* p ) bFormulas( false ), bIncludeFiltered( true ), bAll( true ), bSingle( true ), bUndo( false ), bOverflowRow( false ), bOverflowCol( false ), bOverflowCell( false ), - mbApi( true ), mExportTextOptions() + mbApi( true ), mbImportBroadcast(false), mExportTextOptions() { pUndoDoc = NULL; pExtOptions = NULL; @@ -105,7 +105,7 @@ ScImportExport::ScImportExport( ScDocument* p, const ScAddress rPt ) bFormulas( false ), bIncludeFiltered( true ), bAll( false ), bSingle( true ), bUndo( pDocSh != NULL ), bOverflowRow( false ), bOverflowCol( false ), bOverflowCell( false ), - mbApi( true ), mExportTextOptions() + mbApi( true ), mbImportBroadcast(false), mExportTextOptions() { pUndoDoc = NULL; pExtOptions = NULL; @@ -122,7 +122,7 @@ ScImportExport::ScImportExport( ScDocument* p, const ScRange r ) bFormulas( false ), bIncludeFiltered( true ), bAll( false ), bSingle( false ), bUndo( pDocSh != NULL ), bOverflowRow( false ), bOverflowCol( false ), bOverflowCell( false ), - mbApi( true ), mExportTextOptions() + mbApi( true ), mbImportBroadcast(false), mExportTextOptions() { pUndoDoc = NULL; pExtOptions = NULL; @@ -140,7 +140,7 @@ ScImportExport::ScImportExport( ScDocument* p, const OUString rPos ) bFormulas( false ), bIncludeFiltered( true ), bAll( false ), bSingle( true ), bUndo( pDocSh != NULL ), bOverflowRow( false ), bOverflowCol( false ), bOverflowCell( false ), - mbApi( true ), mExportTextOptions() + mbApi( true ), mbImportBroadcast(false), mExportTextOptions() { pUndoDoc = NULL; pExtOptions = NULL; @@ -947,7 +947,7 @@ bool ScImportExport::Text2Doc( SvStream rStrm ) } EndPaste(); -if (bOk) +if (bOk mbImportBroadcast) { pDoc-BroadcastCells(aRange, SC_HINT_DATACHANGED); pDocSh-PostDataChanged(); @@ -1490,8 +1490,11 @@ bool ScImportExport::ExtText2Doc( SvStream rStrm ) if (bRangeIsDetermined) EndPaste(false); -pDoc-BroadcastCells(aRange, SC_HINT_DATACHANGED); -pDocSh-PostDataChanged(); +if (mbImportBroadcast) +{ +pDoc-BroadcastCells(aRange, SC_HINT_DATACHANGED); +pDocSh-PostDataChanged(); +} return true; } diff --git a/sc/source/ui/inc/impex.hxx b/sc/source/ui/inc/impex.hxx index 4356154..b21511d 100644 --- a/sc/source/ui/inc/impex.hxx +++ b/sc/source/ui/inc/impex.hxx @@ -65,6 +65,7 @@ class ScImportExport boolbOverflowCol; // too many columns boolbOverflowCell; // too much data for a cell boolmbApi; +boolmbImportBroadcast; // whether or not to broadcast after data import. ScExportTextOptions mExportTextOptions; ScAsciiOptions* pExtOptions;// extended options @@ -151,6 +152,7 @@ public: bool IsApi() const { return mbApi; } void SetApi( bool bApi ) { mbApi = bApi; } +void SetImportBroadcast( bool b ) { mbImportBroadcast = b; } const ScExportTextOptions GetExportTextOptions() { return mExportTextOptions; } void SetExportTextOptions( const ScExportTextOptions options ) { mExportTextOptions = options; } }; diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 5045e06..a4d5394 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -288,6 +288,7 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, { ScAddress aCellPos( nPosX, nPosY, GetViewData()-GetTabNo() ); ScImportExport aObj( GetViewData()-GetDocument(), aCellPos ); +aObj.SetImportBroadcast(true); OUString aStr; SotStorageStreamRef xStream; ___ Libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx|2 -- sc/source/core/data/formulacell.cxx | 16 ++-- sc/source/core/tool/formulaopt.cxx |5 ++--- 3 files changed, 8 insertions(+), 15 deletions(-) New commits: commit f3f71d1d64e8d05260a4a49ba3e0191a089324b0 Author: Tor Lillqvist t...@collabora.com Date: Tue Jan 7 14:08:09 2014 +0200 Drop the check of the SC_BACKGROUND_COMPILATION env var Change-Id: Ia33002819023c79160d921fbc1cca7a5c12d143a diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 5196c98..7c1d72d 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -137,8 +137,6 @@ ScDocShell Test::getDocShell() void Test::setUp() { -osl_clearEnvironment(OUString(SC_BACKGROUND_COMPILATION).pData); - BootstrapFixture::setUp(); ScDLL::Init(); diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 531c7e5..721f268 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -415,18 +415,14 @@ ScFormulaCellGroup::ScFormulaCellGroup() : mbSubTotal(false), meCalcState(sc::GroupCalcEnabled) { -static bool bBackgroundCompilation = getenv(SC_BACKGROUND_COMPILATION) != NULL; -if (bBackgroundCompilation) +if (ScInterpreter::GetGlobalConfig().mbOpenCLEnabled) { -if (ScInterpreter::GetGlobalConfig().mbOpenCLEnabled) +osl::MutexGuard aGuard(getOpenCLCompilationThreadMutex()); +if (snCount++ == 0) { -osl::MutexGuard aGuard(getOpenCLCompilationThreadMutex()); -if (snCount++ == 0) -{ -assert(!sxCompilationThread.is()); -sxCompilationThread.set(new sc::CLBuildKernelThread); -sxCompilationThread-launch(); -} +assert(!sxCompilationThread.is()); +sxCompilationThread.set(new sc::CLBuildKernelThread); +sxCompilationThread-launch(); } } } diff --git a/sc/source/core/tool/formulaopt.cxx b/sc/source/core/tool/formulaopt.cxx index ebeece1..e954423 100644 --- a/sc/source/core/tool/formulaopt.cxx +++ b/sc/source/core/tool/formulaopt.cxx @@ -412,10 +412,9 @@ void ScFormulaCfg::UpdateFromProperties( const SequenceOUString aNames ) { sal_Bool bVal = GetCalcConfig().mbOpenCLEnabled; pValues[nProp] = bVal; -#if 0 // Don't remove please unless the SC_BACKGROUND_COMPILATION env var thing goes away. +#if 0 // Don't remove please. // The intent here is that tml when running CppunitTest_sc_opencl_test turns this on. -if (getenv(SC_BACKGROUND_COMPILATION) != NULL) -bVal = sal_True; +bVal = sal_True; #endif GetCalcConfig().mbOpenCLEnabled = bVal; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx | 41 + sc/qa/unit/ucalc.hxx |2 ++ sc/source/core/data/column.cxx | 11 +++ 3 files changed, 50 insertions(+), 4 deletions(-) New commits: commit 21f053e2dd2867489a4d5823d9210c4368f4d115 Author: Kohei Yoshida kohei.yosh...@collabora.com Date: Fri Dec 27 17:33:52 2013 -0500 fdo#72874: Strip const-ness from pointer value when setting it to storage. Else the pointer type would get demoted to a boolean type which would cause the boolean version of overloaded function to get picked. Change-Id: Ided7e8c67ef84b4323c8ad1123e0a2c30ce37e01 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 2f7e52c..17c4123 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4106,6 +4106,47 @@ void Test::testSortWithFormulaRefs() pDoc-DeleteTab(1); } +void Test::testSortWithStrings() +{ +m_pDoc-InsertTab(0, Test); + +ScFieldEditEngine rEE = m_pDoc-GetEditEngine(); +rEE.SetText(Val1); +m_pDoc-SetString(ScAddress(1,1,0), Header); +m_pDoc-SetString(ScAddress(1,2,0), Val2); +m_pDoc-SetEditText(ScAddress(1,3,0), rEE.CreateTextObject()); + +CPPUNIT_ASSERT_EQUAL(OUString(Header), m_pDoc-GetString(ScAddress(1,1,0))); +CPPUNIT_ASSERT_EQUAL(OUString(Val2), m_pDoc-GetString(ScAddress(1,2,0))); +CPPUNIT_ASSERT_EQUAL(OUString(Val1), m_pDoc-GetString(ScAddress(1,3,0))); + +ScSortParam aParam; +aParam.nCol1 = 1; +aParam.nCol2 = 1; +aParam.nRow1 = 1; +aParam.nRow2 = 3; +aParam.bHasHeader = true; +aParam.maKeyState[0].bDoSort = true; +aParam.maKeyState[0].bAscending = true; +aParam.maKeyState[0].nField = 1; + +m_pDoc-Sort(0, aParam, false, NULL); + +CPPUNIT_ASSERT_EQUAL(OUString(Header), m_pDoc-GetString(ScAddress(1,1,0))); +CPPUNIT_ASSERT_EQUAL(OUString(Val1), m_pDoc-GetString(ScAddress(1,2,0))); +CPPUNIT_ASSERT_EQUAL(OUString(Val2), m_pDoc-GetString(ScAddress(1,3,0))); + +aParam.maKeyState[0].bAscending = false; + +m_pDoc-Sort(0, aParam, false, NULL); + +CPPUNIT_ASSERT_EQUAL(OUString(Header), m_pDoc-GetString(ScAddress(1,1,0))); +CPPUNIT_ASSERT_EQUAL(OUString(Val2), m_pDoc-GetString(ScAddress(1,2,0))); +CPPUNIT_ASSERT_EQUAL(OUString(Val1), m_pDoc-GetString(ScAddress(1,3,0))); + +m_pDoc-DeleteTab(0); +} + void Test::testSort() { OUString aTabName1(test1); diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 2af0e65..771a044 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -275,6 +275,7 @@ public: void testFindAreaPosColRight(); void testSort(); void testSortWithFormulaRefs(); +void testSortWithStrings(); void testShiftCells(); void testNoteDeleteRow(); void testNoteDeleteCol(); @@ -385,6 +386,7 @@ public: CPPUNIT_TEST(testFindAreaPosColRight); CPPUNIT_TEST(testSort); CPPUNIT_TEST(testSortWithFormulaRefs); +CPPUNIT_TEST(testSortWithStrings); CPPUNIT_TEST(testShiftCells); CPPUNIT_TEST(testNoteDeleteRow); CPPUNIT_TEST(testNoteDeleteCol); diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index a8f4d91..921ff25 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -916,7 +916,8 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2) break; case CELLTYPE_EDIT: { -it1 = maCells.set(it1, nRow1, aCell2.mpEditText); +it1 = maCells.set( +it1, nRow1, const_castEditTextObject*(aCell2.mpEditText)); EditTextObject* p; maCells.release(it1, nRow2, p); } @@ -999,7 +1000,8 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2) break; case CELLTYPE_EDIT: { -it1 = maCells.set(it1, nRow1, aCell2.mpEditText); +it1 = maCells.set( +it1, nRow1, const_castEditTextObject*(aCell2.mpEditText)); EditTextObject* p; it1 = maCells.release(it1, nRow2, p); } @@ -1031,7 +1033,8 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2) break; case CELLTYPE_EDIT: { -it1 = maCells.set(it1, nRow1, aCell2.mpEditText); +it1 = maCells.set( +it1, nRow1, const_castEditTextObject*(aCell2.mpEditText)); EditTextObject* p; it1 = maCells.release(it1, nRow2, p); // prevent it being overwritten. } @@ -1079,7 +1082,7 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2) ; } -maCells.set(it1, nRow2, aCell1.mpEditText); +maCells.set(it1, nRow2, const_castEditTextObject*(aCell1.mpEditText)); } break; case
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx| 38 ++ sc/qa/unit/ucalc.hxx|4 +++- sc/source/core/data/column3.cxx |2 +- 3 files changed, 42 insertions(+), 2 deletions(-) New commits: commit 4f94e6c20b2fee11429d7cbaef6b6fd1880317b2 Author: Kohei Yoshida kohei.yosh...@collabora.com Date: Wed Dec 11 18:37:42 2013 -0500 Fix paste as link, and a test case to catch it in the future. Change-Id: I55fd3fabb7594ee2c635cc0b02dbf506bd5ab3df diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index cc235cb..1ba3db1 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -3171,6 +3171,44 @@ void Test::testCopyPaste() m_pDoc-DeleteTab(0); } +void Test::testCopyPasteAsLink() +{ +sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // Turn on auto calc. + +m_pDoc-InsertTab(0, Sheet1); +m_pDoc-InsertTab(1, Sheet2); + +m_pDoc-SetValue(ScAddress(0,0,0), 1); // A1 +m_pDoc-SetValue(ScAddress(0,1,0), 2); // A2 +m_pDoc-SetValue(ScAddress(0,2,0), 3); // A3 + +ScRange aRange(0,0,0,0,2,0); // Copy A1:A3 to clip. +ScDocument aClipDoc(SCDOCMODE_CLIP); +copyToClip(m_pDoc, aRange, aClipDoc); + +aRange = ScRange(1,1,1,1,3,1); // Paste to B2:B4 on Sheet2. +ScMarkData aMark; +aMark.SetMarkArea(aRange); +// Paste range as link. +m_pDoc-CopyFromClip(aRange, aMark, IDF_CONTENTS, NULL, aClipDoc, true, true); + +// Check pasted content to make sure they reference the correct cells. +ScFormulaCell* pFC = m_pDoc-GetFormulaCell(ScAddress(1,1,1)); +CPPUNIT_ASSERT_MESSAGE(This should be a formula cell., pFC); +CPPUNIT_ASSERT_EQUAL(1.0, pFC-GetValue()); + +pFC = m_pDoc-GetFormulaCell(ScAddress(1,2,1)); +CPPUNIT_ASSERT_MESSAGE(This should be a formula cell., pFC); +CPPUNIT_ASSERT_EQUAL(2.0, pFC-GetValue()); + +pFC = m_pDoc-GetFormulaCell(ScAddress(1,3,1)); +CPPUNIT_ASSERT_MESSAGE(This should be a formula cell., pFC); +CPPUNIT_ASSERT_EQUAL(3.0, pFC-GetValue()); + +m_pDoc-DeleteTab(1); +m_pDoc-DeleteTab(0); +} + void Test::testCopyPasteTranspose() { diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index f87047a..2af0e65 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -220,6 +220,7 @@ public: void testDataArea(); void testAutofilter(); void testCopyPaste(); +void testCopyPasteAsLink(); void testCopyPasteTranspose(); void testMoveBlock(); void testCopyPasteRelativeFormula(); @@ -362,8 +363,9 @@ public: CPPUNIT_TEST(testToggleRefFlag); CPPUNIT_TEST(testAutofilter); CPPUNIT_TEST(testCopyPaste); -CPPUNIT_TEST(testMoveBlock); +CPPUNIT_TEST(testCopyPasteAsLink); CPPUNIT_TEST(testCopyPasteTranspose); +CPPUNIT_TEST(testMoveBlock); CPPUNIT_TEST(testCopyPasteRelativeFormula); CPPUNIT_TEST(testMergedCells); CPPUNIT_TEST(testUpdateReference); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 7a7f0a7..921fd43 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -690,7 +690,7 @@ class CopyCellsFromClipHandler void insertRefCell(SCROW nSrcRow, SCROW nDestRow) { -ScAddress aSrcPos(mnCol, nSrcRow, mnTab); +ScAddress aSrcPos(mnSrcCol, nSrcRow, mnSrcTab); ScAddress aDestPos(mnCol, nDestRow, mnTab); ScSingleRefData aRef; aRef.InitAddress(aSrcPos); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx |1 - sc/source/core/opencl/openclwrapper.hxx|1 - sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx |1 - sc/source/ui/drawfunc/drtxtob.cxx |1 - sc/source/ui/miscdlgs/sharedocdlg.cxx |1 - sc/source/ui/vba/vbaapplication.cxx|1 - 6 files changed, 6 deletions(-) New commits: commit 45e331cae69d89ce1c2f7e11b0abb47a764d3801 Author: Takeshi Abe t...@fixedpoint.jp Date: Fri Nov 29 09:49:59 2013 +0900 Drop duplicate #include Change-Id: Iea706d316d731fb57f7021e99a11d1487a2ee5b8 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 84633bc..12b4ac7 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -47,7 +47,6 @@ #include tokenarray.hxx #include scopetools.hxx #include dociter.hxx -#include docsh.hxx #include queryparam.hxx #include edittextiterator.hxx #include editutil.hxx diff --git a/sc/source/core/opencl/openclwrapper.hxx b/sc/source/core/opencl/openclwrapper.hxx index 97b3e91..e72600c 100644 --- a/sc/source/core/opencl/openclwrapper.hxx +++ b/sc/source/core/opencl/openclwrapper.hxx @@ -82,7 +82,6 @@ if( status != CL_SUCCESS )\ #endif #include cstdio -#include vector typedef struct _KernelEnv { diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx index a8792e4..7f78bf1 100644 --- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx @@ -30,7 +30,6 @@ #include boost/random/normal_distribution.hpp #include boost/random/cauchy_distribution.hpp #include boost/random/bernoulli_distribution.hpp -#include boost/random/binomial_distribution.hpp #include boost/random/chi_squared_distribution.hpp #include boost/random/geometric_distribution.hpp #include boost/random/negative_binomial_distribution.hpp diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 96513bc..e4bafb0 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -35,7 +35,6 @@ #include editeng/lspcitem.hxx #include editeng/ulspitem.hxx #include svx/hlnkitem.hxx -#include editeng/lspcitem.hxx #include svx/svdoutl.hxx #include editeng/unolingu.hxx #include editeng/outlobj.hxx diff --git a/sc/source/ui/miscdlgs/sharedocdlg.cxx b/sc/source/ui/miscdlgs/sharedocdlg.cxx index 34ecbd7..d845eba 100644 --- a/sc/source/ui/miscdlgs/sharedocdlg.cxx +++ b/sc/source/ui/miscdlgs/sharedocdlg.cxx @@ -30,7 +30,6 @@ #include sharedocdlg.hxx #include scresid.hxx -#include docsh.hxx #include viewdata.hxx diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index 0bce7ec..9abea92 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -20,7 +20,6 @@ #include stdio.h #include com/sun/star/frame/XLayoutManager.hpp -#include com/sun/star/frame/XLayoutManager.hpp #include com/sun/star/frame/XDesktop.hpp #include com/sun/star/lang/XServiceInfo.hpp #include com/sun/star/sheet/XCalculatable.hpp ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc_formula.cxx| 19 +++ sc/source/core/data/column2.cxx | 10 +- 2 files changed, 24 insertions(+), 5 deletions(-) New commits: commit aa2cc9505b476d2170913e1d4dc41313449fe996 Author: Kohei Yoshida kohei.yosh...@collabora.com Date: Tue Nov 26 20:34:45 2013 -0500 Fix additional bugs in the vector array fetching code. And a test case to catch it. Change-Id: I233269822b383afa9783bdc7318eddee31d1eaa3 diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index ff89dbe..a51308c 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -451,6 +451,25 @@ void Test::testFetchVectorRefArray() CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 2, baz)); CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 3, quack)); +// Column H starts with formula cells. +for (SCROW i = 0; i 10; ++i) +m_pDoc-SetString(ScAddress(7,i,0), =ROW()); + +m_pDoc-CalcAll(); +aArray = m_pDoc-FetchVectorRefArray(ScAddress(7,3,0), 3); // H4:H6 +CPPUNIT_ASSERT_MESSAGE(Failed to fetch vector ref array., aArray.isValid()); +CPPUNIT_ASSERT_MESSAGE(Array should have a numeric array., aArray.mpNumericArray); +CPPUNIT_ASSERT_MESSAGE(Array should NOT have a string array., !aArray.mpStringArray); +CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 0, 4.0)); +CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 1, 5.0)); +CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 2, 6.0)); + +aArray = m_pDoc-FetchVectorRefArray(ScAddress(7,4,0), 10); // H5:H15 +CPPUNIT_ASSERT_MESSAGE(Failed to fetch vector ref array., aArray.isValid()); +CPPUNIT_ASSERT_MESSAGE(Array should have a numeric array., aArray.mpNumericArray); +CPPUNIT_ASSERT_MESSAGE(Array should NOT have a string array., !aArray.mpStringArray); +CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 0, 5.0)); + m_pDoc-DeleteTab(0); } diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 65d6c88..24cd615 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -2752,9 +2752,9 @@ formula::VectorRefArray ScColumn::FetchVectorRefArray( SCROW nRow1, SCROW nRow2 const double* pNum = NULL; rtl_uString** pStr = NULL; if (pColArray-mpNumArray) -pNum = (*pColArray-mpNumArray)[0]; +pNum = (*pColArray-mpNumArray)[nRow1]; if (pColArray-mpStrArray) -pStr = (*pColArray-mpStrArray)[0]; +pStr = (*pColArray-mpStrArray)[nRow1]; return formula::VectorRefArray(pNum, pStr); } @@ -2772,9 +2772,9 @@ formula::VectorRefArray ScColumn::FetchVectorRefArray( SCROW nRow1, SCROW nRow2 const double* pNum = NULL; rtl_uString** pStr = NULL; if (pColArray-mpNumArray) -pNum = (*pColArray-mpNumArray)[0]; +pNum = (*pColArray-mpNumArray)[nRow1]; if (pColArray-mpStrArray) -pStr = (*pColArray-mpStrArray)[0]; +pStr = (*pColArray-mpStrArray)[nRow1]; return formula::VectorRefArray(pNum, pStr); } @@ -2790,7 +2790,7 @@ formula::VectorRefArray ScColumn::FetchVectorRefArray( SCROW nRow1, SCROW nRow2 return formula::VectorRefArray(); if (static_castsize_t(nRow2) itBlk-size) -return formula::VectorRefArray((*pColArray-mpNumArray)[0]); +return formula::VectorRefArray((*pColArray-mpNumArray)[nRow1]); // Fill the remaining array with values from the following blocks. size_t nPos = itBlk-size; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx |4 +-- sc/source/filter/excel/excrecds.cxx| 30 ++--- sc/source/filter/oox/worksheetsettings.cxx | 30 ++--- 3 files changed, 32 insertions(+), 32 deletions(-) New commits: commit 5728a56b20e01d6c9e86a23f20af64a1b68ad604 Author: Noel Power noel.po...@suse.com Date: Thu Nov 21 18:12:50 2013 + fdo#70499 selectn of lock/unlocked cells with worksheet protection reversed The ooxml spec documentation is rather confusing ( for me at least ) and the sense of the of the sheetProtection attributes as described seems reversed to how I read it ( or maybe it is the equivelant option in ScTableProtection that operates with the reverse sense shrug ) In anycase the import ( and export ) have been adjusted to take that into consideration, also the export now actually deals with the defaults correctly. Change-Id: Ia69567b8898b39c9d171486cfa800e1748c5814b diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 0e8ff65..ad2e2ee 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -800,8 +800,8 @@ void ScExportTest::testSheetProtectionXLSX() CPPUNIT_ASSERT( (sal_uInt8)aHash[1] == 61 ); } // we could flesh out this check I guess -CPPUNIT_ASSERT ( pTabProtect-isOptionEnabled( ScTableProtection::OBJECTS ) ); -CPPUNIT_ASSERT ( pTabProtect-isOptionEnabled( ScTableProtection::SCENARIOS ) ); +CPPUNIT_ASSERT ( !pTabProtect-isOptionEnabled( ScTableProtection::OBJECTS ) ); +CPPUNIT_ASSERT ( !pTabProtect-isOptionEnabled( ScTableProtection::SCENARIOS ) ); } xDocSh-DoClose(); } diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 232371b..01b2432a 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -520,21 +520,21 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream rStrm ) rWorksheet-singleElement( XML_sheetProtection, XML_sheet, XclXmlUtils::ToPsz( true ), XML_password, sHash.getStr(), -XML_objects, pTabProtect-isOptionEnabled( ScTableProtection::OBJECTS ) ? XclXmlUtils::ToPsz( true ) : NULL, -XML_scenarios, pTabProtect-isOptionEnabled( ScTableProtection::SCENARIOS ) ? XclXmlUtils::ToPsz( true ) : NULL, -XML_formatCells, pTabProtect-isOptionEnabled( ScTableProtection::FORMAT_CELLS ) ? NULL : XclXmlUtils::ToPsz( true ), -XML_formatColumns, pTabProtect-isOptionEnabled( ScTableProtection::FORMAT_COLUMNS ) ? NULL : XclXmlUtils::ToPsz( true ), -XML_formatRows, pTabProtect-isOptionEnabled( ScTableProtection::FORMAT_ROWS ) ? NULL : XclXmlUtils::ToPsz( true ), -XML_insertColumns, pTabProtect-isOptionEnabled( ScTableProtection::INSERT_COLUMNS ) ? NULL : XclXmlUtils::ToPsz( true ), -XML_insertRows, pTabProtect-isOptionEnabled( ScTableProtection::INSERT_ROWS ) ? NULL : XclXmlUtils::ToPsz( true ), -XML_insertHyperlinks, pTabProtect-isOptionEnabled( ScTableProtection::INSERT_HYPERLINKS ) ? NULL : XclXmlUtils::ToPsz( true ), -XML_deleteColumns, pTabProtect-isOptionEnabled( ScTableProtection::DELETE_COLUMNS ) ? NULL : XclXmlUtils::ToPsz( true ), -XML_deleteRows, pTabProtect-isOptionEnabled( ScTableProtection::DELETE_ROWS ) ? NULL : XclXmlUtils::ToPsz( true ), -XML_selectLockedCells, pTabProtect-isOptionEnabled( ScTableProtection::SELECT_LOCKED_CELLS ) ? XclXmlUtils::ToPsz( true ) : NULL, -XML_sort, pTabProtect-isOptionEnabled( ScTableProtection::SORT ) ? NULL : XclXmlUtils::ToPsz( true ), -XML_autoFilter, pTabProtect-isOptionEnabled( ScTableProtection::AUTOFILTER ) ? NULL : XclXmlUtils::ToPsz( true ), -XML_pivotTables, pTabProtect-isOptionEnabled( ScTableProtection::PIVOT_TABLES ) ? NULL : XclXmlUtils::ToPsz( true ), -XML_selectUnlockedCells, pTabProtect-isOptionEnabled( ScTableProtection::SELECT_UNLOCKED_CELLS ) ? XclXmlUtils::ToPsz( true ) : NULL, +XML_objects, pTabProtect-isOptionEnabled( ScTableProtection::OBJECTS ) ? NULL : XclXmlUtils::ToPsz( true ), +XML_scenarios, pTabProtect-isOptionEnabled( ScTableProtection::SCENARIOS ) ? NULL : XclXmlUtils::ToPsz( true ), +XML_formatCells, pTabProtect-isOptionEnabled( ScTableProtection::FORMAT_CELLS ) ? XclXmlUtils::ToPsz( false ) : NULL, +XML_formatColumns, pTabProtect-isOptionEnabled( ScTableProtection::FORMAT_COLUMNS ) ? XclXmlUtils::ToPsz( false ) : NULL, +XML_formatRows, pTabProtect-isOptionEnabled( ScTableProtection::FORMAT_ROWS ) ? XclXmlUtils::ToPsz( false ) : NULL, +XML_insertColumns, pTabProtect-isOptionEnabled( ScTableProtection::INSERT_COLUMNS ) ? XclXmlUtils::ToPsz( false ) : NULL,
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc_formula.cxx | 33 ++--- sc/source/core/tool/interpr6.cxx |2 +- 2 files changed, 27 insertions(+), 8 deletions(-) New commits: commit 6b160fa3e4a343387048279d0d85355b0a70a770 Author: Kohei Yoshida kohei.yosh...@collabora.com Date: Wed Nov 13 18:11:17 2013 -0500 Fix regression with SUM(), and test case to catch it. Change-Id: I76061ce5d975ac565d49b89f8365e355aa0ad009 diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index ce407e7..d12e45d 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -1514,14 +1514,33 @@ void Test::testFuncSUM() CPPUNIT_ASSERT_MESSAGE (failed to insert sheet, m_pDoc-InsertTab (0, aTabName)); -double val = 1; -double result; -m_pDoc-SetValue (0, 0, 0, val); -m_pDoc-SetValue (0, 1, 0, val); -m_pDoc-SetString (0, 2, 0, OUString(=SUM(A1:A2))); +// Single argument case. +m_pDoc-SetValue(ScAddress(0,0,0), 1); +m_pDoc-SetValue(ScAddress(0,1,0), 1); +m_pDoc-SetString(ScAddress(0,2,0), =SUM(A1:A2)); +m_pDoc-CalcAll(); +CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc-GetValue(ScAddress(0,2,0))); + +// Multiple argument case. +m_pDoc-SetValue(ScAddress(0,0,0), 1); +m_pDoc-SetValue(ScAddress(0,1,0), 22); +m_pDoc-SetValue(ScAddress(0,2,0), 4); +m_pDoc-SetValue(ScAddress(0,3,0), 5); +m_pDoc-SetValue(ScAddress(0,4,0), 6); + +m_pDoc-SetValue(ScAddress(1,0,0), 3); +m_pDoc-SetValue(ScAddress(1,1,0), 4); +m_pDoc-SetValue(ScAddress(1,2,0), 5); +m_pDoc-SetValue(ScAddress(1,3,0), 6); +m_pDoc-SetValue(ScAddress(1,4,0), 7); + +m_pDoc-SetString(ScAddress(3,0,0), =SUM(A1:A2;B1:B2)); +m_pDoc-SetString(ScAddress(3,1,0), =SUM(A2:A3;B2:B3)); +m_pDoc-SetString(ScAddress(3,2,0), =SUM(A3:A4;B3:B4)); m_pDoc-CalcAll(); -m_pDoc-GetValue (0, 2, 0, result); -CPPUNIT_ASSERT_MESSAGE (calculation failed, result == 2.0); +CPPUNIT_ASSERT_EQUAL(30.0, m_pDoc-GetValue(ScAddress(3,0,0))); +CPPUNIT_ASSERT_EQUAL(35.0, m_pDoc-GetValue(ScAddress(3,1,0))); +CPPUNIT_ASSERT_EQUAL(20.0, m_pDoc-GetValue(ScAddress(3,2,0))); m_pDoc-DeleteTab(0); } diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx index c8b417a..8999e04 100644 --- a/sc/source/core/tool/interpr6.cxx +++ b/sc/source/core/tool/interpr6.cxx @@ -806,7 +806,7 @@ void ScInterpreter::ScSum() FuncSum aAction; aSet.executeColumnAction(*pDok, aAction); -fRes = aAction.getSum(); +fRes += aAction.getSum(); // Get the number format of the last iterated cell. nFuncFmtIndex = aAction.getNumberFormat(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/opencl-test.cxx |8 +- sc/source/core/opencl/formulagroupcl.cxx | 90 --- sc/source/core/opencl/op_financial.hxx |2 sc/source/core/opencl/opbase.cxx |2 sc/source/core/opencl/opbase.hxx |4 + 5 files changed, 94 insertions(+), 12 deletions(-) New commits: commit 3a57c1f4d6b430110074cd0b3bfd7ba2bb9fea24 Author: I-Jui (Ray) Sung r...@multicorewareinc.com Date: Wed Oct 30 23:16:41 2013 -0500 Fix an integration regression on GPU Calc compiler string test case. A new DynamicKernelArgument subclass is added to handle mixed string and numeric values in the same VectorRef. Change-Id: I2e394a95644a8fc41efbe15a04feea24140a4c12 diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 38fb153..cf5fa7e 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -135,7 +135,7 @@ public: CPPUNIT_TEST(testStatisticalFormulaHarMean); CPPUNIT_TEST(testFinancialCoupdaybsFormula); CPPUNIT_TEST(testFinacialDollardeFormula); -// CPPUNIT_TEST(testCompilerString); +CPPUNIT_TEST(testCompilerString); CPPUNIT_TEST(testCompilerInEq); CPPUNIT_TEST(testFinacialDollarfrFormula); CPPUNIT_TEST(testFinacialSYDFormula); @@ -237,11 +237,13 @@ void ScOpenclTest::testCompilerString() // Check the results of formula cells in the shared formula range. for (SCROW i = 1; i 5; ++i) { +#if 0 double fLibre = pDoc-GetValue(ScAddress(2, i, 0)); double fExcel = pDocRes-GetValue(ScAddress(2, i, 0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); -fLibre = pDoc-GetValue(ScAddress(3, i, 0)); -fExcel = pDocRes-GetValue(ScAddress(3, i, 0)); +#endif +double fLibre = pDoc-GetValue(ScAddress(3, i, 0)); +double fExcel = pDocRes-GetValue(ScAddress(3, i, 0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); } xDocSh-DoClose(); diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 898b91b..2c15ef5 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -207,6 +207,10 @@ public: { ss __global unsigned int *mSymName; } +virtual void GenSlidingWindowDecl(std::stringstream ss) const +{ +DynamicKernelStringArgument::GenDecl(ss); +} virtual size_t Marshal(cl_kernel, int, int); }; @@ -231,8 +235,6 @@ size_t DynamicKernelStringArgument::Marshal(cl_kernel k, int argno, int) const formula::DoubleVectorRefToken* pDVR = dynamic_cast const formula::DoubleVectorRefToken* (ref); assert(pDVR); -if (pDVR-GetArrays()[0].mpNumericArray != NULL) -throw Unhandled(); nStrings = pDVR-GetArrayLength(); vRef = pDVR-GetArrays()[0]; } @@ -250,8 +252,15 @@ size_t DynamicKernelStringArgument::Marshal(cl_kernel k, int argno, int) throw OpenCLError(err); for (size_t i = 0; i nStrings; i++) { -const OUString tmp = OUString(vRef.mpStringArray[i]); -pHashBuffer[i] = tmp.hashCode(); +if (vRef.mpStringArray[i]) +{ +const OUString tmp = OUString(vRef.mpStringArray[i]); +pHashBuffer[i] = tmp.hashCode(); +} +else +{ +pHashBuffer[i] = 0; +} } err = clEnqueueUnmapMemObject(kEnv.mpkCmdQueue, mpClmem, pHashBuffer, 0, NULL, NULL); @@ -264,6 +273,52 @@ size_t DynamicKernelStringArgument::Marshal(cl_kernel k, int argno, int) return 1; } +/// A mixed string/numberic vector +class DynamicKernelMixedArgument: public DynamicKernelArgument +{ +public: +DynamicKernelMixedArgument(const std::string s, +FormulaTreeNodeRef ft): +DynamicKernelArgument(s, ft), mStringArgument(s+s, ft) {} +virtual void GenSlidingWindowDecl(std::stringstream ss) const +{ +DynamicKernelArgument::GenSlidingWindowDecl(ss); +ss , ; +mStringArgument.GenSlidingWindowDecl(ss); +} +virtual void GenSlidingWindowFunction(std::stringstream ) {} +/// Generate declaration +virtual void GenDecl(std::stringstream ss) const +{ +DynamicKernelArgument::GenDecl(ss); +ss , ; +mStringArgument.GenDecl(ss); +} +virtual void GenDeclRef(std::stringstream ss) const +{ +DynamicKernelArgument::GenDeclRef(ss); +ss ,; +mStringArgument.GenDeclRef(ss); +} +virtual std::string GenSlidingWindowDeclRef(bool) const +{ +std::stringstream ss; +ss (!isNan( DynamicKernelArgument::GenSlidingWindowDeclRef(ss); +ss )? DynamicKernelArgument::GenSlidingWindowDeclRef(ss); +ss : mStringArgument.GenSlidingWindowDeclRef(ss); +ss ); +return ss.str(); +} +virtual size_t Marshal(cl_kernel k, int
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/opencl-test.cxx |7 +++ sc/qa/unit/ucalc_formula.cxx| 36 +++- sc/source/core/data/column2.cxx |2 +- 3 files changed, 39 insertions(+), 6 deletions(-) New commits: commit 94a569c25026ea67f18ace8a075e13ac355ff3d2 Author: Kohei Yoshida kohei.yosh...@collabora.com Date: Thu Oct 31 12:35:30 2013 -0400 Don't hard-code the start row position of string array to 0... Change-Id: I06724e2e8754ac20217f5375a445c85f9a5b31e6 diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index cf5fa7e..862d24c 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -237,13 +237,12 @@ void ScOpenclTest::testCompilerString() // Check the results of formula cells in the shared formula range. for (SCROW i = 1; i 5; ++i) { -#if 0 double fLibre = pDoc-GetValue(ScAddress(2, i, 0)); double fExcel = pDocRes-GetValue(ScAddress(2, i, 0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); -#endif -double fLibre = pDoc-GetValue(ScAddress(3, i, 0)); -double fExcel = pDocRes-GetValue(ScAddress(3, i, 0)); + +fLibre = pDoc-GetValue(ScAddress(3, i, 0)); +fExcel = pDocRes-GetValue(ScAddress(3, i, 0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); } xDocSh-DoClose(); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index ce9ce2e..92eebc2 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -61,7 +61,13 @@ bool equals( const formula::VectorRefArray rArray, size_t nPos, const OUString if (!rArray.mpStringArray) return false; -return OUString(rArray.mpStringArray[nPos]).equalsIgnoreAsciiCase(rVal); +bool bEquals = OUString(rArray.mpStringArray[nPos]).equalsIgnoreAsciiCase(rVal); +if (!bEquals) +{ +cerr Expected: rVal.toAsciiUpperCase() (upcased) endl; +cerr Actual: OUString(rArray.mpStringArray[nPos]) (upcased) endl; +} +return bEquals; } } @@ -235,6 +241,34 @@ void Test::testFetchVectorRefArray() CPPUNIT_ASSERT_MESSAGE(Array should have a numeric array., aArray.mpNumericArray); CPPUNIT_ASSERT_MESSAGE(Array should NOT have a string array., !aArray.mpStringArray); +// Column G consists only of strings. +m_pDoc-SetString(ScAddress(6,0,0), Title); +m_pDoc-SetString(ScAddress(6,1,0), foo); +m_pDoc-SetString(ScAddress(6,2,0), bar); +m_pDoc-SetString(ScAddress(6,3,0), foo); +m_pDoc-SetString(ScAddress(6,4,0), baz); +m_pDoc-SetString(ScAddress(6,5,0), quack); +m_pDoc-SetString(ScAddress(6,6,0), beep); +m_pDoc-SetString(ScAddress(6,7,0), kerker); + +aArray = m_pDoc-FetchVectorRefArray(ScAddress(6,1,0), 4); // G2:G5 +CPPUNIT_ASSERT_MESSAGE(Failed to fetch vector ref array., aArray.isValid()); +CPPUNIT_ASSERT_MESSAGE(Array should NOT have a numeric array., !aArray.mpNumericArray); +CPPUNIT_ASSERT_MESSAGE(Array should have a string array., aArray.mpStringArray); +CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 0, foo)); +CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 1, bar)); +CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 2, foo)); +CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 3, baz)); + +aArray = m_pDoc-FetchVectorRefArray(ScAddress(6,2,0), 4); // G3:G6 +CPPUNIT_ASSERT_MESSAGE(Failed to fetch vector ref array., aArray.isValid()); +CPPUNIT_ASSERT_MESSAGE(Array should NOT have a numeric array., !aArray.mpNumericArray); +CPPUNIT_ASSERT_MESSAGE(Array should have a string array., aArray.mpStringArray); +CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 0, bar)); +CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 1, foo)); +CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 2, baz)); +CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 3, quack)); + m_pDoc-DeleteTab(0); } diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 5176d82..4715b48 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -2722,7 +2722,7 @@ formula::VectorRefArray ScColumn::FetchVectorRefArray( SCROW nRow1, SCROW nRow2 { // Requested range falls within the first block. copyFirstStringBlock(*pDocument, rArray, nRow2+1, itBlk); -return formula::VectorRefArray(rArray[0]); +return formula::VectorRefArray(rArray[nRow1]); } copyFirstStringBlock(*pDocument, rArray, itBlk-size, itBlk); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/opencl-test.cxx | 42 --- sc/source/core/opencl/formulagroupcl.cxx |1 sc/source/core/tool/formulagroup.cxx |1 3 files changed, 44 deletions(-) New commits: commit a6d89e17995987549db36695f3ea490a18f30ba4 Author: Kohei Yoshida kohei.yosh...@collabora.com Date: Wed Oct 30 12:50:41 2013 -0400 Ugh! Change-Id: I95979ed5a303724e944a48b69d3c1cdbc949e53e diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index f3a9576..38fb153 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -38,48 +38,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -#include stdio.h -#include string -#include sys/time.h - -namespace { - -class stack_printer -{ -public: -explicit stack_printer(const char* msg) : -msMsg(msg) -{ -fprintf(stdout, %s: --begin\n, msMsg.c_str()); -mfStartTime = getTime(); -} - -~stack_printer() -{ -double fEndTime = getTime(); -fprintf(stdout, %s: --end (duration: %g sec)\n, msMsg.c_str(), (fEndTime - mfStartTime)); -} - -void printTime(int line) const -{ -double fEndTime = getTime(); -fprintf(stdout, %s: --(%d) (duration: %g sec)\n, msMsg.c_str(), line, (fEndTime - mfStartTime)); -} - -private: -double getTime() const -{ -timeval tv; -gettimeofday(tv, NULL); -return tv.tv_sec + tv.tv_usec / 100.0; -} - -::std::string msMsg; -double mfStartTime; -}; - -} - /* Implementation of Filters test */ class ScOpenclTest diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 4a01cb0..c71d2a0 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1291,7 +1291,6 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument rDoc, const ScAddress rTopPos, const ScFormulaCellGroupRef xGroup, ScTokenArray rCode ) { -fprintf(stdout, FormulaGroupInterpreterOpenCL::interpret: opencl\n); generateRPNCode(rDoc, rTopPos, rCode); // printf(Vector width = %d\n, xGroup-mnLength); // Constructing AST diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx index b4a1801..2573359 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -289,7 +289,6 @@ bool FormulaGroupInterpreterSoftware::interpret(ScDocument rDoc, const ScAddres const ScFormulaCellGroupRef xGroup, ScTokenArray rCode) { -fprintf(stdout, FormulaGroupInterpreterSoftware::interpret: software\n); typedef boost::unordered_mapconst formula::FormulaToken*, formula::FormulaTokenRef CachedTokensType; // Decompose the group into individual cells and calculate them individually. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc_formula.cxx|6 ++ sc/source/core/data/column2.cxx | 34 -- 2 files changed, 38 insertions(+), 2 deletions(-) New commits: commit f518cd28d7ebacf059ca826353c8202c87be957f Author: Kohei Yoshida kohei.yosh...@collabora.com Date: Tue Oct 29 21:52:09 2013 -0400 Restore the old behavior, even when the data comes from a cache. Change-Id: I722a53ee0e8a8f757c1d02fa5f604e6ccedf3b1a diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index e87878a..ce9ce2e 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -229,6 +229,12 @@ void Test::testFetchVectorRefArray() CPPUNIT_ASSERT_MESSAGE(This should be empty., isEmpty(aArray, 8)); CPPUNIT_ASSERT_MESSAGE(This should be empty., isEmpty(aArray, 9)); +// Get the array for F3:F4. This array should only consist of numeric array. +aArray = m_pDoc-FetchVectorRefArray(ScAddress(5,2,0), 3); +CPPUNIT_ASSERT_MESSAGE(Failed to fetch vector ref array., aArray.isValid()); +CPPUNIT_ASSERT_MESSAGE(Array should have a numeric array., aArray.mpNumericArray); +CPPUNIT_ASSERT_MESSAGE(Array should NOT have a string array., !aArray.mpStringArray); + m_pDoc-DeleteTab(0); } diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index aff16d5..c7b8f26 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -2614,6 +2614,36 @@ copyFirstFormulaBlock( return rCxt.setCachedColArray(nTab, nCol, pNumArray, pStrArray); } +struct FiniteValueFinder : std::unary_functiondouble, bool +{ +bool operator() (double f) const { return !rtl::math::isNan(f); } +}; + +struct NonNullStringFinder : std::unary_functionconst rtl_uString*, bool +{ +bool operator() (const rtl_uString* p) const { return p != NULL; } +}; + +bool hasNonEmpty( const sc::FormulaGroupContext::NumArrayType rArray, SCROW nRow1, SCROW nRow2 ) +{ +// The caller has to make sure the array is at least nRow2+1 long. +sc::FormulaGroupContext::NumArrayType::const_iterator it = rArray.begin(); +std::advance(it, nRow1); +sc::FormulaGroupContext::NumArrayType::const_iterator itEnd = it; +std::advance(itEnd, nRow2-nRow1+1); +return std::find_if(it, itEnd, FiniteValueFinder()) != itEnd; +} + +bool hasNonEmpty( const sc::FormulaGroupContext::StrArrayType rArray, SCROW nRow1, SCROW nRow2 ) +{ +// The caller has to make sure the array is at least nRow2+1 long. +sc::FormulaGroupContext::StrArrayType::const_iterator it = rArray.begin(); +std::advance(it, nRow1); +sc::FormulaGroupContext::StrArrayType::const_iterator itEnd = it; +std::advance(itEnd, nRow2-nRow1+1); +return std::find_if(it, itEnd, NonNullStringFinder()) != itEnd; +} + } formula::VectorRefArray ScColumn::FetchVectorRefArray( SCROW nRow1, SCROW nRow2 ) @@ -2627,11 +2657,11 @@ formula::VectorRefArray ScColumn::FetchVectorRefArray( SCROW nRow1, SCROW nRow2 if (pColArray) { const double* pNum = NULL; -if (pColArray-mpNumArray) +if (pColArray-mpNumArray hasNonEmpty(*pColArray-mpNumArray, nRow1, nRow2)) pNum = (*pColArray-mpNumArray)[nRow1]; rtl_uString** pStr = NULL; -if (pColArray-mpStrArray) +if (pColArray-mpStrArray hasNonEmpty(*pColArray-mpStrArray, nRow1, nRow2)) pStr = (*pColArray-mpStrArray)[nRow1]; return formula::VectorRefArray(pNum, pStr); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx |6 +++--- sc/source/ui/src/scfuncs.src |6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) New commits: commit d269c92a74516081f277d427ab44dbe4ece00598 Author: Joel Madero jmadero@gmail.com Date: Mon Sep 23 15:54:58 2013 -0700 fdo#69685 - move count functions Moved Count functions (countif, countifs and countblank to statistical instead of mathematical group) Change-Id: If8faeabb8f43810a96d919b59116157ae107c12c Reviewed-on: https://gerrit.libreoffice.org/6022 Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index ad98b7d..324400b 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -2134,9 +2134,6 @@ void Test::testFunctionLists() COSH, COT, COTH, -COUNTBLANK, -COUNTIF, -COUNTIFS, CSC, CSCH, DEGREES, @@ -2215,6 +2212,9 @@ void Test::testFunctionLists() CORREL, COUNT, COUNTA, +COUNTBLANK, +COUNTIF, +COUNTIFS, COVAR, CRITBINOM, DEVSQ, diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src index 64ef65c..7c3922e 100644 --- a/sc/source/ui/src/scfuncs.src +++ b/sc/source/ui/src/scfuncs.src @@ -2854,7 +2854,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 ExtraData = { 0; -ID_FUNCTION_GRP_MATH; +ID_FUNCTION_GRP_STATISTIC; U2S( HID_FUNC_ANZAHLLEEREZELLEN ); 1; 0; 0; @@ -3129,7 +3129,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 ExtraData = { 0; -ID_FUNCTION_GRP_MATH; +ID_FUNCTION_GRP_STATISTIC; U2S( HID_FUNC_COUNTIFS ); PAIRED_VAR_ARGS;0; 0; 0; @@ -3162,7 +3162,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 ExtraData = { 0; -ID_FUNCTION_GRP_MATH; +ID_FUNCTION_GRP_STATISTIC; U2S( HID_FUNC_ZAEHLENWENN ); 2; 0; 0; 0; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx |4 ++-- sc/source/ui/src/scfuncs.src |4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) New commits: commit 4547d8c42e5b0bb456ac02fbea67059a8a1cadd7 Author: Joel Madero jmadero@gmail.com Date: Thu Sep 19 22:37:39 2013 -0700 fdo#69536 - Moved Averageif(s) Moved averageif and averageifs to statistical category instead of mathematical Change-Id: Ibcf7f5a5e12b528c4877232e4c56d5167b1df40a Reviewed-on: https://gerrit.libreoffice.org/6010 Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 324400b..e5e6198 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -2119,8 +2119,6 @@ void Test::testFunctionLists() ATAN, ATAN2, ATANH, -AVERAGEIF, -AVERAGEIFS, BITAND, BITLSHIFT, BITOR, @@ -2199,6 +2197,8 @@ void Test::testFunctionLists() AVEDEV, AVERAGE, AVERAGEA, +AVERAGEIF, +AVERAGEIFS, B, BETADIST, BETAINV, diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src index 7c3922e..b054a6d 100644 --- a/sc/source/ui/src/scfuncs.src +++ b/sc/source/ui/src/scfuncs.src @@ -3007,7 +3007,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 ExtraData = { 0; -ID_FUNCTION_GRP_MATH; +ID_FUNCTION_GRP_STATISTIC; U2S( HID_FUNC_AVERAGEIF ); 3; 0; 0; 1; 0; @@ -3088,7 +3088,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 ExtraData = { 0; -ID_FUNCTION_GRP_MATH; +ID_FUNCTION_GRP_STATISTIC; U2S( HID_FUNC_AVERAGEIFS ); PAIRED_VAR_ARGS+1; 0; 0; 0; 0; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.hxx|2 + sc/qa/unit/ucalc_sharedformula.cxx | 53 sc/source/core/data/formulacell.cxx |5 ++- 3 files changed, 59 insertions(+), 1 deletion(-) New commits: commit f4710e167ded0e6a378f1bfb01ef842b726b0aac Author: Kohei Yoshida libreoff...@kohei.us Date: Sat Sep 7 16:32:49 2013 -0400 Fix incorrect reference update on shared formulas. The start position of a shared formula group is used to prevent non-top cells of the group from being updated. Updating it at the top cell may cause non-top cells to perform reference update which they never should. Change-Id: I4f067d4d717b756fc89cb823f3ce3e630dac756e diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 9ad69b6..e97bb8d 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -220,6 +220,7 @@ public: void testSearchCells(); void testSharedFormulas(); void testSharedFormulasRefUpdate(); +void testSharedFormulasRefUpdateRange(); void testSharedFormulasCopyPaste(); void testFormulaPosition(); @@ -350,6 +351,7 @@ public: CPPUNIT_TEST(testSearchCells); CPPUNIT_TEST(testSharedFormulas); CPPUNIT_TEST(testSharedFormulasRefUpdate); +CPPUNIT_TEST(testSharedFormulasRefUpdateRange); CPPUNIT_TEST(testSharedFormulasCopyPaste); CPPUNIT_TEST(testFormulaPosition); CPPUNIT_TEST(testJumpToPrecedentsDependents); diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index 1ecff32..00378dd 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -391,6 +391,59 @@ void Test::testSharedFormulasRefUpdate() m_pDoc-DeleteTab(0); } +void Test::testSharedFormulasRefUpdateRange() +{ +m_pDoc-InsertTab(0, Test); + +// Insert values to A3:A5. +m_pDoc-SetValue(ScAddress(0,2,0), 1); +m_pDoc-SetValue(ScAddress(0,3,0), 2); +m_pDoc-SetValue(ScAddress(0,4,0), 3); + +// Insert formulas to B3:B5. +m_pDoc-SetString(ScAddress(1,2,0), =SUM($A$3:$A$5)); +m_pDoc-SetString(ScAddress(1,3,0), =SUM($A$3:$A$5)); +m_pDoc-SetString(ScAddress(1,4,0), =SUM($A$3:$A$5)); + +if (!checkFormula(*m_pDoc, ScAddress(1,2,0), SUM($A$3:$A$5))) +CPPUNIT_FAIL(Wrong formula); +if (!checkFormula(*m_pDoc, ScAddress(1,3,0), SUM($A$3:$A$5))) +CPPUNIT_FAIL(Wrong formula); +if (!checkFormula(*m_pDoc, ScAddress(1,4,0), SUM($A$3:$A$5))) +CPPUNIT_FAIL(Wrong formula); + +// B3:B5 should be shared. +const ScFormulaCell* pFC = m_pDoc-GetFormulaCell(ScAddress(1,2,0)); +CPPUNIT_ASSERT_MESSAGE(B3 should be shared., pFC pFC-IsShared()); +pFC = m_pDoc-GetFormulaCell(ScAddress(1,3,0)); +CPPUNIT_ASSERT_MESSAGE(B4 should be shared., pFC pFC-IsShared()); +pFC = m_pDoc-GetFormulaCell(ScAddress(1,4,0)); +CPPUNIT_ASSERT_MESSAGE(B3 should be shared., pFC pFC-IsShared()); + +// Insert 2 rows at row 1. +m_pDoc-InsertRow(ScRange(0,0,0,MAXCOL,1,0)); + +// B5:B7 should be shared. +pFC = m_pDoc-GetFormulaCell(ScAddress(1,4,0)); +CPPUNIT_ASSERT_MESSAGE(B5 should be shared., pFC pFC-IsShared()); +pFC = m_pDoc-GetFormulaCell(ScAddress(1,5,0)); +CPPUNIT_ASSERT_MESSAGE(B6 should be shared., pFC pFC-IsShared()); +pFC = m_pDoc-GetFormulaCell(ScAddress(1,6,0)); +CPPUNIT_ASSERT_MESSAGE(B7 should be shared., pFC pFC-IsShared()); + +CPPUNIT_ASSERT_EQUAL(static_castSCROW(4), pFC-GetSharedTopRow()); +CPPUNIT_ASSERT_EQUAL(static_castSCROW(3), pFC-GetSharedLength()); + +if (!checkFormula(*m_pDoc, ScAddress(1,4,0), SUM($A$5:$A$7))) +CPPUNIT_FAIL(Wrong formula); +if (!checkFormula(*m_pDoc, ScAddress(1,5,0), SUM($A$5:$A$7))) +CPPUNIT_FAIL(Wrong formula); +if (!checkFormula(*m_pDoc, ScAddress(1,6,0), SUM($A$5:$A$7))) +CPPUNIT_FAIL(Wrong formula); + +m_pDoc-DeleteTab(0); +} + void Test::testSharedFormulasCopyPaste() { m_pDoc-InsertTab(0, Test); diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 143351e8..0f248a2 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2186,7 +2186,10 @@ bool ScFormulaCell::UpdatePosOnShift( const sc::RefUpdateContext rCxt ) // This formula cell itself is being shifted during cell range // insertion or deletion. Update its position. -if (mxGroup mxGroup-mnStart == aPos.Row()) + +if (mxGroup (mxGroup-mnStart+mxGroup-mnLength-1) == aPos.Row()) +// For a shared formula cell, update its group start position only +// when it's the last cell of the group. mxGroup-mnStart += rCxt.mnRowDelta; aPos.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx | 45 ++- sc/source/core/tool/scmatrix.cxx |4 +++ 2 files changed, 48 insertions(+), 1 deletion(-) New commits: commit 3c59183f5bfa22194f0287b449aaa6d882be8827 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Jul 11 13:26:04 2013 -0400 Add test case for matrix's double array handling fix one bug. Change-Id: I6cb2ff8bf536ccb53ae9f146baf6aa582f9fbcfe diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 6d2d0fc..5c3ec7b 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -2145,7 +2145,7 @@ struct PartiallyFilledEmptyMatrix void Test::testMatrix() { -ScMatrixRef pMat; +ScMatrixRef pMat, pMat2; // First, test the zero matrix type. pMat = new ScMatrix(0, 0, 0.0); @@ -2226,6 +2226,49 @@ void Test::testMatrix() pMat-PutDouble(12.5, 1, 1); CPPUNIT_ASSERT_EQUAL(0.0, pMat-GetMinValue(false)); CPPUNIT_ASSERT_EQUAL(12.5, pMat-GetMaxValue(false)); + +// Convert matrix into a linear double array. String elements become NaN +// and empty elements become 0. +pMat = new ScMatrix(3, 3); +pMat-PutDouble(2.5, 0, 0); +pMat-PutDouble(1.2, 0, 1); +pMat-PutString(A, 1, 1); +pMat-PutDouble(2.3, 2, 1); +pMat-PutDouble(-20, 2, 2); + +double fNaN; +rtl::math::setNan(fNaN); + +std::vectordouble aDoubles; +pMat-GetDoubleArray(aDoubles); + +{ +const double pChecks[] = { 2.5, 1.2, 0, 0, fNaN, 0, 0, 2.3, -20 }; +CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(pChecks), aDoubles.size()); +for (size_t i = 0, n = aDoubles.size(); i n; ++i) +{ +if (rtl::math::isNan(pChecks[i])) +CPPUNIT_ASSERT_MESSAGE(NaN is expected, but it's not., rtl::math::isNan(aDoubles[i])); +else +CPPUNIT_ASSERT_EQUAL(pChecks[i], aDoubles[i]); +} +} + +pMat2 = new ScMatrix(3, 3, 10.0); +pMat2-PutString(B, 1, 0); +pMat2-MergeDoubleArray(aDoubles, ScMatrix::Mul); + +{ +const double pChecks[] = { 25, 12, 0, fNaN, fNaN, 0, 0, 23, -200 }; +CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(pChecks), aDoubles.size()); +for (size_t i = 0, n = aDoubles.size(); i n; ++i) +{ +if (rtl::math::isNan(pChecks[i])) +CPPUNIT_ASSERT_MESSAGE(NaN is expected, but it's not., rtl::math::isNan(aDoubles[i])); +else +CPPUNIT_ASSERT_EQUAL(pChecks[i], aDoubles[i]); +} +} } void Test::testEnterMixedMatrix() diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index c692238..73ed2e2 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -1063,6 +1063,8 @@ public: *miPos = mfNaN; } break; +case mdds::mtm::element_empty: +std::advance(miPos, node.size); default: ; } @@ -1133,6 +1135,8 @@ public: *miPos = mfNaN; } break; +case mdds::mtm::element_empty: +std::advance(miPos, node.size); default: ; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc_sharedformula.cxx |2 sc/source/ui/inc/docsh.hxx | 451 --- sc/source/ui/inc/docshell.hxx | 466 + 3 files changed, 470 insertions(+), 449 deletions(-) New commits: commit 572478433647e9d8a657a2271f0ef6bf349de526 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jul 9 16:22:10 2013 -0400 Separate ScDocShell declaration with ScDocShellRef declaration. Change-Id: Ib09ff246da256e0f2147ef6fccdaa92b4fcc214e diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index 59aa7a4..e3995a4 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -11,7 +11,7 @@ #include editutil.hxx #include formulacell.hxx #include cellvalue.hxx -#include docsh.hxx +#include docshell.hxx void Test::testSharedFormulas() { diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index ec2201f..aeeb4b5 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -17,459 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef SC_DOCSHELL_HXX -#define SC_DOCSHELL_HXX - - -#include sfx2/objsh.hxx - -#include sfx2/docfac.hxx -#include sfx2/sfxmodelfactory.hxx -#include sfx2/viewsh.hxx - -#include scdllapi.h -#include scdll.hxx -#include document.hxx -#include appoptio.hxx -#include formulaopt.hxx -#include shellids.hxx -#include refreshtimer.hxx -#include optutil.hxx - -#include boost/unordered_map.hpp -#include cppuhelper/implbase1.hxx - -#include config_telepathy.h - -class ScEditEngineDefaulter; -class SfxStyleSheetBasePool; -class SfxStyleSheetHint; -class INetURLObject; - -class ScViewData; -class ScDocFunc; -class ScDrawLayer; -class ScTabViewShell; -class ScSbxDocHelper; -class ScAutoStyleList; -class ScRange; -class ScMarkData; -class ScPaintLockData; -class ScChangeAction; -class VirtualDevice; -class ScImportOptions; -class ScDocShellModificator; -class ScOptSolverSave; -class ScSheetSaveData; -class ScFlatBoolRowSegments; -struct ScColWidthParam; -#if ENABLE_TELEPATHY -class ScCollaboration; -#endif - -namespace sfx2 { class FileDialogHelper; } -struct DocShell_Impl; - -typedef ::boost::unordered_map sal_uLong, sal_uLong ScChangeActionMergeMap; - -//== - -//enum ScDBFormat { SC_FORMAT_SDF, SC_FORMAT_DBF }; - -// Extra flags for Repaint -#define SC_PF_LINES 1 -#define SC_PF_TESTMERGE 2 -#define SC_PF_WHOLEROWS 4 - -class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener -{ -ScDocument aDocument; - -String aDdeTextFmt; - -double nPrtToScreenFactor; -DocShell_Impl* pImpl; -ScDocFunc* pDocFunc; - -boolbHeaderOn; -boolbFooterOn; -boolbIsInplace:1; // Is set by the View -boolbIsEmpty:1; -boolbIsInUndo:1; -boolbDocumentModifiedPending:1; -boolbUpdateEnabled:1; -sal_uInt16 nDocumentLock; -sal_Int16 nCanUpdate; // stores the UpdateDocMode from loading a document till update links - -ScDBData* pOldAutoDBRange; - -ScSbxDocHelper* pDocHelper; - -ScAutoStyleList*pAutoStyleList; -ScPaintLockData*pPaintLockData; -ScOptSolverSave*pSolverSaveData; -ScSheetSaveData*pSheetSaveData; - -ScDocShellModificator* pModificator; // #109979#; is used to load XML (created in BeforeXMLLoading and destroyed in AfterXMLLoading) -#if ENABLE_TELEPATHY -ScCollaboration* mpCollaboration; -#endif - -SC_DLLPRIVATE void InitItems(); -SC_DLLPRIVATE void DoEnterHandler(); -SC_DLLPRIVATE void InitOptions(bool bForLoading); -SC_DLLPRIVATE void ResetDrawObjectShell(); - -// SUNWS needs a forward declared friend, otherwise types and members -// of the outer class are not accessible. -class PrepareSaveGuard; -friend class ScDocShell::PrepareSaveGuard; -/** Do things that need to be done before saving to our own format and -necessary clean ups in dtor. */ -class PrepareSaveGuard -{ -public: -explicitPrepareSaveGuard( ScDocShell rDocShell ); -~PrepareSaveGuard(); -private: -ScDocShell mrDocShell; -}; - -SC_DLLPRIVATE sal_BoolLoadXML( SfxMedium* pMedium, const ::com::sun::star::uno::Reference ::com::sun::star::embed::XStorage ); -SC_DLLPRIVATE sal_BoolSaveXML( SfxMedium* pMedium, const ::com::sun::star::uno::Reference ::com::sun::star::embed::XStorage ); -SC_DLLPRIVATE SCTAB GetSaveTab(); - -SC_DLLPRIVATE bool SaveCurrentChart( SfxMedium rMedium ); - -
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx| 122 sc/source/core/data/dociter.cxx |6 - 2 files changed, 90 insertions(+), 38 deletions(-) New commits: commit f9704bf73dfba50421132e5379165912a2779906 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Jun 25 11:06:43 2013 -0400 The horizontal cell iterator was *still* broken. Let's fix it again. And add a test for it. Change-Id: If76a67e02ac6ad5199d664850bd8591bd3032f32 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index b29a89e..462087a4 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -404,6 +404,12 @@ void printRange(ScDocument* pDoc, const ScRange rRange, const char* pCaption) templatesize_t _Size ScRange insertRangeData(ScDocument* pDoc, const ScAddress rPos, const char* aData[][_Size], size_t nRowCount) { +ScRange aRange(rPos); +aRange.aEnd.SetCol(rPos.Col()+_Size-1); +aRange.aEnd.SetRow(rPos.Row()+nRowCount-1); + +clearRange(pDoc, aRange); + for (size_t i = 0; i _Size; ++i) { for (size_t j = 0; j nRowCount; ++j) @@ -417,9 +423,6 @@ ScRange insertRangeData(ScDocument* pDoc, const ScAddress rPos, const char* aDa } } -ScRange aRange(rPos); -aRange.aEnd.SetCol(rPos.Col()+_Size-1); -aRange.aEnd.SetRow(rPos.Row()+nRowCount-1); printRange(pDoc, aRange, Range data content); return aRange; } @@ -1785,48 +1788,97 @@ void Test::testVolatileFunc() m_pDoc-DeleteTab(0); } -void Test::testHorizontalIterator() -{ -m_pDoc-InsertTab(0, test); +namespace { -// Raw data -const char* aData[][2] = { -{ A, B }, -{ C, 1 }, -{ D, 2 }, -{ E, 3 } -}; +struct HoriIterCheck +{ +SCCOL nCol; +SCROW nRow; +const char* pVal; +}; +templatesize_t _Size +bool checkHorizontalIterator(ScDocument* pDoc, const char* pData[][_Size], size_t nDataCount, const HoriIterCheck* pChecks, size_t nCheckCount) +{ ScAddress aPos(0,0,0); -insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); -ScHorizontalCellIterator aIter(m_pDoc, 0, 0, 0, 1, SAL_N_ELEMENTS(aData)); - -struct { -SCCOL nCol; -SCROW nRow; -const char* pVal; -} aChecks[] = { -{ 0, 0, A }, -{ 1, 0, B }, -{ 0, 1, C }, -{ 1, 1, 1 }, -{ 0, 2, D }, -{ 1, 2, 2 }, -{ 0, 3, E }, -{ 1, 3, 3 }, -}; +insertRangeData(pDoc, aPos, pData, nDataCount); +ScHorizontalCellIterator aIter(pDoc, 0, 0, 0, 1, nDataCount-1); SCCOL nCol; SCROW nRow; -size_t i = 0, n = SAL_N_ELEMENTS(aChecks); +size_t i = 0; for (ScRefCellValue* pCell = aIter.GetNext(nCol, nRow); pCell; pCell = aIter.GetNext(nCol, nRow), ++i) { -if (i = n) +if (i = nCheckCount) CPPUNIT_FAIL(Iterator claims there is more data than there should be.); -CPPUNIT_ASSERT_EQUAL(aChecks[i].nCol, nCol); -CPPUNIT_ASSERT_EQUAL(aChecks[i].nRow, nRow); -CPPUNIT_ASSERT_EQUAL(OUString::createFromAscii(aChecks[i].pVal), pCell-getString()); +if (pChecks[i].nCol != nCol) +return false; + +if (pChecks[i].nRow != nRow) +return false; + +if (OUString::createFromAscii(pChecks[i].pVal) != pCell-getString()) +return false; +} + +return true; +} + +} + +void Test::testHorizontalIterator() +{ +m_pDoc-InsertTab(0, test); + +{ +// Raw data +const char* aData[][2] = { +{ A, B }, +{ C, 1 }, +{ D, 2 }, +{ E, 3 } +}; + +HoriIterCheck aChecks[] = { +{ 0, 0, A }, +{ 1, 0, B }, +{ 0, 1, C }, +{ 1, 1, 1 }, +{ 0, 2, D }, +{ 1, 2, 2 }, +{ 0, 3, E }, +{ 1, 3, 3 }, +}; + +bool bRes = checkHorizontalIterator( +m_pDoc, aData, SAL_N_ELEMENTS(aData), aChecks, SAL_N_ELEMENTS(aChecks)); + +if (!bRes) +CPPUNIT_FAIL(Failed on test 1.); +} + +{ +// Raw data +const char* aData[][2] = { +{ A, B }, +{ C, 0 }, +{ D, E }, +}; + +HoriIterCheck aChecks[] = { +{ 0, 0, A }, +{ 1, 0, B }, +{ 0, 1, C }, +{ 0, 2, D }, +{ 1, 2, E }, +}; + +bool bRes = checkHorizontalIterator( +m_pDoc, aData, SAL_N_ELEMENTS(aData), aChecks, SAL_N_ELEMENTS(aChecks)); + +if (!bRes) +CPPUNIT_FAIL(Failed on test 2.); } m_pDoc-DeleteTab(0); diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index b5c36b8..5076569 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1787,9 +1787,6 @@ void ScHorizontalCellIterator::Advance() if (r.maPos == r.maEnd)
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx |1 + sc/source/core/data/column.cxx |2 +- 2 files changed, 2 insertions(+), 1 deletion(-) New commits: commit 6958b6a3ce9f28bed2a529939e7740452929a5b3 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed May 22 11:17:52 2013 -0400 Use the block position of the destination, not of the source. And a test to catch this. Change-Id: Ia73be239b4be96cbe029390efbbec5f49e429652 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 36a59fa..90da5f0 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4494,6 +4494,7 @@ void Test::testPivotTableDocFunc() void Test::testSheetCopy() { m_pDoc-InsertTab(0, TestTab); +m_pDoc-SetString(ScAddress(0,0,0), copy me); CPPUNIT_ASSERT_MESSAGE(document should have one sheet to begin with., m_pDoc-GetTableCount() == 1); SCROW nRow1, nRow2; bool bHidden = m_pDoc-RowHidden(0, 0, nRow1, nRow2); diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 10d36b6..dfbc21d 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1444,7 +1444,7 @@ void ScColumn::CopyToColumn( // Special case to allow removing of cell instances. A // string cell with empty content is used to indicate an // empty cell. -sc::ColumnBlockPosition* p = rCxt.getBlockPosition(nTab, nCol); +sc::ColumnBlockPosition* p = rCxt.getBlockPosition(rColumn.nTab, rColumn.nCol); if (pNew-GetCellType() == CELLTYPE_STRING) { OUString aStr = static_castScStringCell*(pNew)-GetString(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits