sc/qa/unit/subsequent_export-test.cxx | 4 +- sc/source/core/data/cell2.cxx | 47 ++-------------------------------- sc/source/core/data/colorscale.cxx | 1 sc/source/core/data/conditio.cxx | 21 ++++++++++----- sc/source/core/tool/address.cxx | 12 ++++---- 5 files changed, 27 insertions(+), 58 deletions(-)
New commits: commit 2c3943f43d29bf9173a5c85710a4d2d06b6885ba Author: Markus Mohrhard <[email protected]> Date: Sun Mar 24 05:10:39 2013 +0100 we can stop the loop as soon as we found something Change-Id: I43e318e5aa112587775c0982d42e7780408a6b83 diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index b4f58bc..754cbdc 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -1084,6 +1084,7 @@ BitmapEx& ScIconSetFormat::getBitmap( ScIconSetType eType, sal_Int32 nIndex ) if(aBitmapMap[i].eType == eType) { nBitmap = *(aBitmapMap[i].nBitmaps + nIndex); + break; } } assert( nBitmap != -1 ); commit 9261c0bf6ecf6633a5577879f003edfcb569f4d7 Author: Markus Mohrhard <[email protected]> Date: Sun Mar 24 05:09:08 2013 +0100 URM_INSDEL we need to update the src position, fdo#62206 See ScFormulaCell::UpdateReference for a similar update Change-Id: I1f98d26adb5085e4bdab63cc23f97a81928d6b13 diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 772a190..ae4a7e2 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -526,12 +526,21 @@ void ScConditionEntry::UpdateReference( UpdateRefMode eUpdateRefMode, { bool bInsertTab = ( eUpdateRefMode == URM_INSDEL && nDz >= 1 ); bool bDeleteTab = ( eUpdateRefMode == URM_INSDEL && nDz <= -1 ); + if(pCondFormat) + aSrcPos = pCondFormat->GetRange().Combine().aStart; + ScAddress aOldSrcPos = aSrcPos; + bool bChangedPos = false; + if(eUpdateRefMode == URM_INSDEL && rRange.In(aSrcPos)) + { + aSrcPos.Move(nDx, nDy, nDz); + bChangedPos = aSrcPos != aOldSrcPos; + } if (pFormula1) { bool bChanged1 = false; if ( bInsertTab ) - lcl_CondUpdateInsertTab( *pFormula1, rRange.aStart.Tab(), aSrcPos.Tab(), bChanged1, nDz ); + lcl_CondUpdateInsertTab( *pFormula1, rRange.aStart.Tab(), aOldSrcPos.Tab(), bChanged1, nDz ); else { ScCompiler aComp( mpDoc, aSrcPos, *pFormula1 ); @@ -541,19 +550,19 @@ void ScConditionEntry::UpdateReference( UpdateRefMode eUpdateRefMode, else { bool bSizeChanged; - aComp.UpdateReference( eUpdateRefMode, aSrcPos, rRange, nDx, + aComp.UpdateReference( eUpdateRefMode, aOldSrcPos, rRange, nDx, nDy, nDz, bChanged1, bSizeChanged ); } } - if (bChanged1) + if (bChanged1 || bChangedPos) DELETEZ(pFCell1); // is created again in IsValid } if (pFormula2) { bool bChanged2 = false; if ( bInsertTab ) - lcl_CondUpdateInsertTab( *pFormula2, rRange.aStart.Tab(), aSrcPos.Tab(), bChanged2, nDz ); + lcl_CondUpdateInsertTab( *pFormula2, rRange.aStart.Tab(), aOldSrcPos.Tab(), bChanged2, nDz ); else { ScCompiler aComp( mpDoc, aSrcPos, *pFormula2); @@ -563,12 +572,12 @@ void ScConditionEntry::UpdateReference( UpdateRefMode eUpdateRefMode, else { bool bSizeChanged; - aComp.UpdateReference( eUpdateRefMode, aSrcPos, rRange, nDx, + aComp.UpdateReference( eUpdateRefMode, aOldSrcPos, rRange, nDx, nDy, nDz, bChanged2, bSizeChanged ); } } - if (bChanged2) + if (bChanged2 || bChangedPos) DELETEZ(pFCell2); // is created again in IsValid } } commit da0a22fbdcfadf0df7bdde7ebacec85bae6344c9 Author: Markus Mohrhard <[email protected]> Date: Sun Mar 24 05:09:53 2013 +0100 simplify the position update code in ScFormulaCell::UpdateReference Change-Id: I2cf0fd0947df8e667f461aaf2c67095d2d42111d diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx index 040890a..b4a78de 100644 --- a/sc/source/core/data/cell2.cxx +++ b/sc/source/core/data/cell2.cxx @@ -861,49 +861,10 @@ bool ScFormulaCell::UpdateReference(UpdateRefMode eUpdateRefMode, ScAddress aOldPos( aPos ); // bool bPosChanged = false; // if this cell was moved bool bIsInsert = false; - if (eUpdateRefMode == URM_INSDEL) + if (eUpdateRefMode == URM_INSDEL && r.In( aPos )) { bIsInsert = (nDx >= 0 && nDy >= 0 && nDz >= 0); - if ( nDx && nRow >= nRow1 && nRow <= nRow2 && - nTab >= nTab1 && nTab <= nTab2 ) - { - if (nCol >= nCol1) - { - nCol = sal::static_int_cast<SCCOL>( nCol + nDx ); - if ((SCsCOL) nCol < 0) - nCol = 0; - else if ( nCol > MAXCOL ) - nCol = MAXCOL; - aPos.SetCol( nCol ); - } - } - if ( nDy && nCol >= nCol1 && nCol <= nCol2 && - nTab >= nTab1 && nTab <= nTab2 ) - { - if (nRow >= nRow1) - { - nRow = sal::static_int_cast<SCROW>( nRow + nDy ); - if ((SCsROW) nRow < 0) - nRow = 0; - else if ( nRow > MAXROW ) - nRow = MAXROW; - aPos.SetRow( nRow ); - } - } - if ( nDz && nCol >= nCol1 && nCol <= nCol2 && - nRow >= nRow1 && nRow <= nRow2 ) - { - if (nTab >= nTab1) - { - SCTAB nMaxTab = pDocument->GetTableCount() - 1; - nTab = sal::static_int_cast<SCTAB>( nTab + nDz ); - if ((SCsTAB) nTab < 0) - nTab = 0; - else if ( nTab > nMaxTab ) - nTab = nMaxTab; - aPos.SetTab( nTab ); - } - } + aPos.Move(nDx, nDy, nDz); bCellStateChanged = aPos != aOldPos; } else if ( r.In( aPos ) ) commit d3d23f889a74ace0e4e71526df7aca18b1acaa03 Author: Markus Mohrhard <[email protected]> Date: Sun Mar 24 04:19:32 2013 +0100 sal_Bool -> bool in address.cxx Change-Id: I77c688cb11438204acd37113cffc223ba0c08f0c diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index abae2c3..9a8fe8f 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -270,7 +270,7 @@ lcl_XL_ParseSheetRef( const sal_Unicode* start, } else { - bool only_digits = sal_True; + bool only_digits = true; /* * Valid: Normal!a1 @@ -1844,7 +1844,7 @@ void ScRange::Format( String& r, sal_uInt16 nFlags, const ScDocument* pDoc, switch( rDetails.eConv ) { default : case formula::FormulaGrammar::CONV_OOO: { - sal_Bool bOneTab = (aStart.Tab() == aEnd.Tab()); + bool bOneTab = (aStart.Tab() == aEnd.Tab()); if ( !bOneTab ) nFlags |= SCA_TAB_3D; aStart.Format( r, nFlags, pDoc, rDetails ); @@ -1948,7 +1948,7 @@ bool ScAddress::Move( SCsCOL dx, SCsROW dy, SCsTAB dz, ScDocument* pDoc ) dx = Col() + dx; dy = Row() + dy; dz = Tab() + dz; - sal_Bool bValid = sal_True; + bool bValid = true; if( dx < 0 ) dx = 0, bValid = false; else if( dx > MAXCOL ) commit bfa20cd32c825cfe8dbdb93399ed99544d8c8647 Author: Markus Mohrhard <[email protected]> Date: Sun Mar 24 04:17:07 2013 +0100 simplify the use of nMaxTab a bit Change-Id: I8b21575f7a9e659e9b00f381c2fd7a1e117d67cb diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index 7b70845..abae2c3 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -1944,7 +1944,7 @@ void ScRange::Format( OUString& r, sal_uInt16 nFlags, const ScDocument* pDoc, bool ScAddress::Move( SCsCOL dx, SCsROW dy, SCsTAB dz, ScDocument* pDoc ) { - SCsTAB nMaxTab = pDoc ? pDoc->GetTableCount() : MAXTAB+1; + SCsTAB nMaxTab = pDoc ? pDoc->GetTableCount() : MAXTAB; dx = Col() + dx; dy = Row() + dy; dz = Tab() + dz; @@ -1959,8 +1959,8 @@ bool ScAddress::Move( SCsCOL dx, SCsROW dy, SCsTAB dz, ScDocument* pDoc ) dy = MAXROW, bValid =false; if( dz < 0 ) dz = 0, bValid = false; - else if( dz >= nMaxTab ) - dz = nMaxTab-1, bValid =false; + else if( dz > nMaxTab ) + dz = nMaxTab, bValid =false; Set( dx, dy, dz ); return bValid; } commit bf535cbfdaa3edde7afaa6167092717ca7b98b9f Author: Markus Mohrhard <[email protected]> Date: Sun Mar 24 04:13:58 2013 +0100 it is enough to check at the end if pos changed Change-Id: Id1e4957ab22eb2ff280271b5a332095df29c9ad6 diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx index 0e217f2..040890a 100644 --- a/sc/source/core/data/cell2.cxx +++ b/sc/source/core/data/cell2.cxx @@ -874,7 +874,6 @@ bool ScFormulaCell::UpdateReference(UpdateRefMode eUpdateRefMode, nCol = 0; else if ( nCol > MAXCOL ) nCol = MAXCOL; - bCellStateChanged = aPos.Col() != nCol; aPos.SetCol( nCol ); } } @@ -888,7 +887,6 @@ bool ScFormulaCell::UpdateReference(UpdateRefMode eUpdateRefMode, nRow = 0; else if ( nRow > MAXROW ) nRow = MAXROW; - bCellStateChanged = aPos.Row() != nRow; aPos.SetRow( nRow ); } } @@ -903,10 +901,10 @@ bool ScFormulaCell::UpdateReference(UpdateRefMode eUpdateRefMode, nTab = 0; else if ( nTab > nMaxTab ) nTab = nMaxTab; - bCellStateChanged = aPos.Tab() != nTab; aPos.SetTab( nTab ); } } + bCellStateChanged = aPos != aOldPos; } else if ( r.In( aPos ) ) { commit ef59aa2e92cb1a1e9b8dfe7a234f06d44df8516c Author: Markus Mohrhard <[email protected]> Date: Sat Mar 23 09:05:15 2013 +0100 use ASSERT_DOUBLES_EQUAL instead of CPPUNIT_ASSERT_DOUBLES_EQUAL in calc Change-Id: I55979aec2ab0140190f58f96ed108e8dd1e3a051 diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index bf0ab4a..db0879d 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -125,7 +125,7 @@ void ScExportTest::test() CPPUNIT_ASSERT(xDocSh.Is()); ScDocument* pLoadedDoc = xDocSh->GetDocument(); double aVal = pLoadedDoc->GetValue(0,0,0); - CPPUNIT_ASSERT_DOUBLES_EQUAL(aVal, 1.0, 1e-8); + ASSERT_DOUBLES_EQUAL(aVal, 1.0); } void ScExportTest::testPasswordExport() @@ -149,7 +149,7 @@ void ScExportTest::testPasswordExport() CPPUNIT_ASSERT(xDocSh.Is()); ScDocument* pLoadedDoc = xDocSh->GetDocument(); double aVal = pLoadedDoc->GetValue(0,0,0); - CPPUNIT_ASSERT_DOUBLES_EQUAL(aVal, 1.0, 1e-8); + ASSERT_DOUBLES_EQUAL(aVal, 1.0); } void ScExportTest::testConditionalFormatExportODS() _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
