summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2021-07-30 23:18:39 +0200
committerRegina Henschel <rb.henschel@t-online.de>2021-08-02 19:22:10 +0200
commit0cff1aa48453ee0c05bafcac5360329fb6bf9557 (patch)
tree7f4767c4a5cd9e64d34ae07b43b9bef6f716b812 /sc/source
parentd5a100f59467d94945656b54563e5ecdde2ca724 (diff)
tdf#143619 validation circle anchor is special
For usual drawing objects, maStart in its Calc user data means the cell address of left/top of snapRect/logicRect. For validation circle it means 'address of cell to be validated'. Thus corrections might be needed, if a general method is used for validation circle. Here the method SetLogicRect() calls via broadcast ScDrawLayer::SetCellAnchoredFromPosition(), which calculates maStart from snapRect/logicRect. Because the circle is extended to cover a larger area than the to be validated cell, maStart got the cell address of the cell one left and one above of the to be validated cell. Now the old, correct address is backuped and restored. Change-Id: I9646da3f22fef45a6e47e59ef55a70307e2f9cc6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119715 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/drwlayer.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 1174cb656019..79b52627e015 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1049,6 +1049,7 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati
// Validation circle for detective.
rData.setShapeRect(GetDocument(), pObj->GetLogicRect());
+ // rData.maStart should contain the address of the be validated cell.
tools::Rectangle aRect = GetCellRect(*GetDocument(), rData.maStart, true);
aRect.AdjustLeft( -250 );
aRect.AdjustRight(250 );
@@ -1062,7 +1063,13 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati
if (bRecording)
AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
rData.setShapeRect(GetDocument(), lcl_makeSafeRectangle(aRect));
+ // maStart has the meaning of "to be validated cell" in a validation circle. For usual
+ // drawing objects it has the meaning "left/top of logic/snap rect". Because the rectangle
+ // is expanded above, SetLogicRect() will set maStart to one cell left and one cell above
+ // of the to be validated cell. We need to backup the old value and restore it.
+ ScAddress aBackup(rData.maStart);
pObj->SetLogicRect(rData.getShapeRect());
+ rData.maStart = aBackup;
}
}
else if (rData.meType == ScDrawObjData::DetectiveArrow)