[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Fri May 16 01:35:56 PDT 2014
sc/source/core/data/conditio.cxx | 29 +++++++++++++++++++++++++++--
sc/source/core/tool/interpr4.cxx | 8 +++++---
sc/source/ui/undo/undoblk.cxx | 15 +++++++++++++++
3 files changed, 47 insertions(+), 5 deletions(-)
New commits:
commit 0a47daf3175ec16d48669535a34823be47fbb42a
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue May 13 12:35:24 2014 -0400
fdo#78402: Adjust references of validity entries as appropriate.
Change-Id: I7fd62153c7267a3d606b86d74bebecf6b8d75250
(cherry picked from commit a93bb27aa46c84410c8848a6118d5d63d47be92c)
Reviewed-on: https://gerrit.libreoffice.org/9345
Tested-by: David Tardon <dtardon at redhat.com>
Reviewed-by: David Tardon <dtardon at redhat.com>
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index ae5e098..5e8e549 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -510,13 +510,38 @@ void ScConditionEntry::UpdateReference( sc::RefUpdateContext& rCxt )
if (pFormula1)
{
- sc::RefUpdateResult aRes = pFormula1->AdjustReferenceInName(rCxt, aOldSrcPos);
+ sc::RefUpdateResult aRes;
+ switch (rCxt.meMode)
+ {
+ case URM_INSDEL:
+ aRes = pFormula1->AdjustReferenceOnShift(rCxt, aOldSrcPos);
+ break;
+ case URM_MOVE:
+ aRes = pFormula1->AdjustReferenceOnMove(rCxt, aOldSrcPos, aSrcPos);
+ break;
+ default:
+ ;
+ }
+
if (aRes.mbReferenceModified || bChangedPos)
DELETEZ(pFCell1); // is created again in IsValid
}
+
if (pFormula2)
{
- sc::RefUpdateResult aRes = pFormula2->AdjustReferenceInName(rCxt, aOldSrcPos);
+ sc::RefUpdateResult aRes;
+ switch (rCxt.meMode)
+ {
+ case URM_INSDEL:
+ aRes = pFormula2->AdjustReferenceOnShift(rCxt, aOldSrcPos);
+ break;
+ case URM_MOVE:
+ aRes = pFormula2->AdjustReferenceOnMove(rCxt, aOldSrcPos, aSrcPos);
+ break;
+ default:
+ ;
+ }
+
if (aRes.mbReferenceModified || bChangedPos)
DELETEZ(pFCell2); // is created again in IsValid
}
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index c5ebbd3..4239001 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1843,6 +1843,8 @@ void ScInterpreter::QueryMatrixType(ScMatrixRef& xMat, short& rRetTypeExpr, sal_
{
if (xMat)
{
+ SCSIZE nCols, nRows;
+ xMat->GetDimensions(nCols, nRows);
ScMatrixValue nMatVal = xMat->Get(0, 0);
ScMatValType nMatValType = nMatVal.nType;
if (ScMatrix::IsNonValueType( nMatValType))
@@ -1850,14 +1852,14 @@ void ScInterpreter::QueryMatrixType(ScMatrixRef& xMat, short& rRetTypeExpr, sal_
if ( xMat->IsEmptyPath( 0, 0))
{ // result of empty FALSE jump path
FormulaTokenRef xRes = new FormulaDoubleToken( 0.0);
- PushTempToken( new ScMatrixCellResultToken( xMat, xRes.get()));
+ PushTempToken( new ScMatrixFormulaCellToken(nCols, nRows, xMat, xRes.get()));
rRetTypeExpr = NUMBERFORMAT_LOGICAL;
}
else
{
svl::SharedString aStr( nMatVal.GetString());
FormulaTokenRef xRes = new FormulaStringToken( aStr);
- PushTempToken( new ScMatrixCellResultToken( xMat, xRes.get()));
+ PushTempToken( new ScMatrixFormulaCellToken(nCols, nRows, xMat, xRes.get()));
rRetTypeExpr = NUMBERFORMAT_TEXT;
}
}
@@ -1869,7 +1871,7 @@ void ScInterpreter::QueryMatrixType(ScMatrixRef& xMat, short& rRetTypeExpr, sal_
xRes = new FormulaErrorToken( nErr);
else
xRes = new FormulaDoubleToken( nMatVal.fVal);
- PushTempToken( new ScMatrixCellResultToken( xMat, xRes.get()));
+ PushTempToken( new ScMatrixFormulaCellToken(nCols, nRows, xMat, xRes.get()));
if ( rRetTypeExpr != NUMBERFORMAT_LOGICAL )
rRetTypeExpr = NUMBERFORMAT_NUMBER;
}
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index cb4f25a..634e1f6 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -48,6 +48,8 @@
#include "clipparam.hxx"
#include "sc.hrc"
#include <refhint.hxx>
+#include <refupdatecontext.hxx>
+#include <validat.hxx>
#include <set>
@@ -1265,6 +1267,19 @@ void ScUndoDragDrop::Undo()
SCTAB nTabDelta = aSrcRange.aStart.Tab() - aDestRange.aStart.Tab();
sc::RefMovedHint aHint(aDestRange, ScAddress(nColDelta, nRowDelta, nTabDelta));
pDoc->BroadcastRefMoved(aHint);
+
+ ScValidationDataList* pValidList = pDoc->GetValidationList();
+ if (pValidList)
+ {
+ // Update the references of validation entries.
+ sc::RefUpdateContext aCxt(*pDoc);
+ aCxt.meMode = URM_MOVE;
+ aCxt.maRange = aSrcRange;
+ aCxt.mnColDelta = nColDelta;
+ aCxt.mnRowDelta = nRowDelta;
+ aCxt.mnTabDelta = nTabDelta;
+ pValidList->UpdateReference(aCxt);
+ }
}
DoUndo(aDestRange);
More information about the Libreoffice-commits
mailing list