summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga.extern@allotropia.de>2022-11-21 11:12:15 +0100
committerBalazs Varga <balazs.varga.extern@allotropia.de>2022-11-22 19:13:29 +0100
commitb71303fe1b06c1711ad80e5a0269d41ccaaad8e1 (patch)
tree1c053e91619c418a21fbaa3f395128e91c225412 /sc
parent9571986f72a3b0acb85eade721d09dad11affeab (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>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/drwlayer.cxx24
1 files changed, 11 insertions, 13 deletions
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;