diff options
author | Balazs Varga <balazs.varga.extern@allotropia.de> | 2022-11-21 11:12:15 +0100 |
---|---|---|
committer | Balazs Varga <balazs.varga.extern@allotropia.de> | 2022-11-30 09:53:48 +0100 |
commit | d070070003f0cc9d42f3a6bdd37999bdebca39ac (patch) | |
tree | 48eb67fa0bd40201a328b827fd4f6ab451746eb6 | |
parent | f43ac75e8e3d8520aef8a5baeda4543bdae44b10 (diff) |
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.extern@allotropia.de>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143211
Tested-by: Gabor Kelemen <kelemeng@ubuntu.com>
Reviewed-by: Gabor Kelemen <kelemeng@ubuntu.com>
-rw-r--r-- | sc/source/core/data/drwlayer.cxx | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 308ba809f3a9..ed1f9bdf4444 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -997,13 +997,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; } @@ -2335,12 +2339,9 @@ ScDrawLayer::GetObjectsAnchoredToRows(SCTAB nTab, SCROW nStartRow, SCROW nEndRow ScRange aRange( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab); while (pObject) { - if (!dynamic_cast<SdrCaptionObj*>(pObject)) // Caption objects are handled differently - { - ScDrawObjData* pObjData = GetObjData(pObject); - if (pObjData && aRange.In(pObjData->maStart)) - aObjects.push_back(pObject); - } + ScDrawObjData* pObjData = GetObjData(pObject); + if (pObjData && aRange.In(pObjData->maStart)) + aObjects.push_back(pObject); pObject = aIter.Next(); } return aObjects; @@ -2407,12 +2408,9 @@ std::vector<SdrObject*> ScDrawLayer::GetObjectsAnchoredToCols(SCTAB nTab, SCCOL ScRange aRange(nStartCol, 0, nTab, nEndCol, MAXROW, nTab); while (pObject) { - if (!dynamic_cast<SdrCaptionObj*>(pObject)) // Caption objects are handled differently - { - ScDrawObjData* pObjData = GetObjData(pObject); - if (pObjData && aRange.In(pObjData->maStart)) - aObjects.push_back(pObject); - } + ScDrawObjData* pObjData = GetObjData(pObject); + if (pObjData && aRange.In(pObjData->maStart)) + aObjects.push_back(pObject); pObject = aIter.Next(); } return aObjects; |