fdo#78402: Adjust references of validity entries as appropriate.
Change-Id: I7fd62153c7267a3d606b86d74bebecf6b8d75250
This commit is contained in:
@@ -513,13 +513,38 @@ void ScConditionEntry::UpdateReference( sc::RefUpdateContext& rCxt )
|
|||||||
|
|
||||||
if (pFormula1)
|
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)
|
if (aRes.mbReferenceModified || bChangedPos)
|
||||||
DELETEZ(pFCell1); // is created again in IsValid
|
DELETEZ(pFCell1); // is created again in IsValid
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pFormula2)
|
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)
|
if (aRes.mbReferenceModified || bChangedPos)
|
||||||
DELETEZ(pFCell2); // is created again in IsValid
|
DELETEZ(pFCell2); // is created again in IsValid
|
||||||
}
|
}
|
||||||
|
@@ -1867,6 +1867,8 @@ void ScInterpreter::QueryMatrixType(ScMatrixRef& xMat, short& rRetTypeExpr, sal_
|
|||||||
{
|
{
|
||||||
if (xMat)
|
if (xMat)
|
||||||
{
|
{
|
||||||
|
SCSIZE nCols, nRows;
|
||||||
|
xMat->GetDimensions(nCols, nRows);
|
||||||
ScMatrixValue nMatVal = xMat->Get(0, 0);
|
ScMatrixValue nMatVal = xMat->Get(0, 0);
|
||||||
ScMatValType nMatValType = nMatVal.nType;
|
ScMatValType nMatValType = nMatVal.nType;
|
||||||
if (ScMatrix::IsNonValueType( nMatValType))
|
if (ScMatrix::IsNonValueType( nMatValType))
|
||||||
@@ -1874,14 +1876,14 @@ void ScInterpreter::QueryMatrixType(ScMatrixRef& xMat, short& rRetTypeExpr, sal_
|
|||||||
if ( xMat->IsEmptyPath( 0, 0))
|
if ( xMat->IsEmptyPath( 0, 0))
|
||||||
{ // result of empty FALSE jump path
|
{ // result of empty FALSE jump path
|
||||||
FormulaTokenRef xRes = new FormulaDoubleToken( 0.0);
|
FormulaTokenRef xRes = new FormulaDoubleToken( 0.0);
|
||||||
PushTempToken( new ScMatrixCellResultToken( xMat, xRes.get()));
|
PushTempToken( new ScMatrixFormulaCellToken(nCols, nRows, xMat, xRes.get()));
|
||||||
rRetTypeExpr = NUMBERFORMAT_LOGICAL;
|
rRetTypeExpr = NUMBERFORMAT_LOGICAL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
svl::SharedString aStr( nMatVal.GetString());
|
svl::SharedString aStr( nMatVal.GetString());
|
||||||
FormulaTokenRef xRes = new FormulaStringToken( aStr);
|
FormulaTokenRef xRes = new FormulaStringToken( aStr);
|
||||||
PushTempToken( new ScMatrixCellResultToken( xMat, xRes.get()));
|
PushTempToken( new ScMatrixFormulaCellToken(nCols, nRows, xMat, xRes.get()));
|
||||||
rRetTypeExpr = NUMBERFORMAT_TEXT;
|
rRetTypeExpr = NUMBERFORMAT_TEXT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1893,7 +1895,7 @@ void ScInterpreter::QueryMatrixType(ScMatrixRef& xMat, short& rRetTypeExpr, sal_
|
|||||||
xRes = new FormulaErrorToken( nErr);
|
xRes = new FormulaErrorToken( nErr);
|
||||||
else
|
else
|
||||||
xRes = new FormulaDoubleToken( nMatVal.fVal);
|
xRes = new FormulaDoubleToken( nMatVal.fVal);
|
||||||
PushTempToken( new ScMatrixCellResultToken( xMat, xRes.get()));
|
PushTempToken( new ScMatrixFormulaCellToken(nCols, nRows, xMat, xRes.get()));
|
||||||
if ( rRetTypeExpr != NUMBERFORMAT_LOGICAL )
|
if ( rRetTypeExpr != NUMBERFORMAT_LOGICAL )
|
||||||
rRetTypeExpr = NUMBERFORMAT_NUMBER;
|
rRetTypeExpr = NUMBERFORMAT_NUMBER;
|
||||||
}
|
}
|
||||||
|
@@ -49,6 +49,8 @@
|
|||||||
#include "sc.hrc"
|
#include "sc.hrc"
|
||||||
#include <rowheightcontext.hxx>
|
#include <rowheightcontext.hxx>
|
||||||
#include <refhint.hxx>
|
#include <refhint.hxx>
|
||||||
|
#include <refupdatecontext.hxx>
|
||||||
|
#include <validat.hxx>
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
@@ -1264,6 +1266,19 @@ void ScUndoDragDrop::Undo()
|
|||||||
SCTAB nTabDelta = aSrcRange.aStart.Tab() - aDestRange.aStart.Tab();
|
SCTAB nTabDelta = aSrcRange.aStart.Tab() - aDestRange.aStart.Tab();
|
||||||
sc::RefMovedHint aHint(aDestRange, ScAddress(nColDelta, nRowDelta, nTabDelta));
|
sc::RefMovedHint aHint(aDestRange, ScAddress(nColDelta, nRowDelta, nTabDelta));
|
||||||
pDoc->BroadcastRefMoved(aHint);
|
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);
|
DoUndo(aDestRange);
|
||||||
|
Reference in New Issue
Block a user