sc/source/core/data/drwlayer.cxx | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
New commits: commit b71303fe1b06c1711ad80e5a0269d41ccaaad8e1 Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Mon Nov 21 11:12:15 2022 +0100 Commit: Balazs Varga <balazs.varga.ext...@allotropia.de> CommitDate: Tue Nov 22 19:13:29 2022 +0100 tdf#46444 tdf#152081 sc: hide notes in hidden rows or columns Hide notes in hidden rows or columns just like we do in case of other sdrobjects. TODO: unit test Change-Id: Ib136324d5d0dd8777fc0912af6d8b9ac39935ac1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143024 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index c6d10e78830c..9474d5859407 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -1033,13 +1033,17 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati position must not be done, if the cell containing the note has not been moved yet in the document. The calling code now passes an additional boolean stating if the cells are already moved. */ - if( bUpdateNoteCaptionPos ) + /* tdf #152081 Do not change hidden objects. That would produce zero height + or width and loss of caption.*/ + if (pObj->IsVisible() && bUpdateNoteCaptionPos) + { /* When inside an undo action, there may be pending note captions where cell note is already deleted (thus document cannot find the note object anymore). The caption will be deleted later with drawing undo. */ if( ScPostIt* pNote = pDoc->GetNote( rData.maStart ) ) pNote->UpdateCaptionPos( rData.maStart ); + } return; } @@ -2476,12 +2480,9 @@ ScDrawLayer::GetObjectsAnchoredToRows(SCTAB nTab, SCROW nStartRow, SCROW nEndRow ScRange aRange( 0, nStartRow, nTab, pDoc->MaxCol(), nEndRow, nTab); while (pObject) { - if (!dynamic_cast<SdrCaptionObj*>(pObject)) // Caption objects are handled differently - { - ScDrawObjData* pObjData = GetObjData(pObject); - if (pObjData && aRange.Contains(pObjData->maStart)) - aObjects.push_back(pObject); - } + ScDrawObjData* pObjData = GetObjData(pObject); + if (pObjData && aRange.Contains(pObjData->maStart)) + aObjects.push_back(pObject); pObject = aIter.Next(); } return aObjects; @@ -2548,12 +2549,9 @@ std::vector<SdrObject*> ScDrawLayer::GetObjectsAnchoredToCols(SCTAB nTab, SCCOL ScRange aRange(nStartCol, 0, nTab, nEndCol, pDoc->MaxRow(), nTab); while (pObject) { - if (!dynamic_cast<SdrCaptionObj*>(pObject)) // Caption objects are handled differently - { - ScDrawObjData* pObjData = GetObjData(pObject); - if (pObjData && aRange.Contains(pObjData->maStart)) - aObjects.push_back(pObject); - } + ScDrawObjData* pObjData = GetObjData(pObject); + if (pObjData && aRange.Contains(pObjData->maStart)) + aObjects.push_back(pObject); pObject = aIter.Next(); } return aObjects;