summaryrefslogtreecommitdiff
path: root/sc/source/core/data/table5.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/data/table5.cxx')
-rw-r--r--sc/source/core/data/table5.cxx41
1 files changed, 38 insertions, 3 deletions
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 06465dbc24a1..ff90463ba4c7 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -36,6 +36,7 @@
#include <printopt.hxx>
#include <bcaslot.hxx>
#include <compressedarray.hxx>
+#include <userdat.hxx>
#include <com/sun/star/sheet/TablePageBreakData.hpp>
@@ -583,13 +584,25 @@ bool ScTable::SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden)
else
bChanged = mpHiddenRows->setFalse(nStartRow, nEndRow);
- std::vector<SdrObject*> aRowDrawObjects;
+ // Cell anchored objects might change visibility
ScDrawLayer* pDrawLayer = rDocument.GetDrawLayer();
- if (pDrawLayer) {
+ if (pDrawLayer)
+ {
+ std::vector<SdrObject*> aRowDrawObjects;
aRowDrawObjects = pDrawLayer->GetObjectsAnchoredToRows(GetTab(), nStartRow, nEndRow);
for (auto aObj : aRowDrawObjects)
{
- aObj->SetVisible(!bHidden);
+ ScDrawObjData* pData = ScDrawLayer::GetObjData(aObj);
+ if (pData)
+ {
+ if (bHidden)
+ aObj->SetVisible(false);
+ else if (!GetDoc().ColHidden(pData->maStart.Col(), pData->maStart.Tab()))
+ {
+ // Only change visibility if object is not hidden by a hidden col
+ aObj->SetVisible(true);
+ }
+ }
}
}
@@ -621,6 +634,28 @@ void ScTable::SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden)
else
bChanged = mpHiddenCols->setFalse(nStartCol, nEndCol);
+ // Cell anchored objects might change visibility
+ ScDrawLayer* pDrawLayer = rDocument.GetDrawLayer();
+ if (pDrawLayer)
+ {
+ std::vector<SdrObject*> aColDrawObjects;
+ aColDrawObjects = pDrawLayer->GetObjectsAnchoredToCols(GetTab(), nStartCol, nEndCol);
+ for (auto aObj : aColDrawObjects)
+ {
+ ScDrawObjData* pData = ScDrawLayer::GetObjData(aObj);
+ if (pData)
+ {
+ if (bHidden)
+ aObj->SetVisible(false);
+ else if (!GetDoc().RowHidden(pData->maStart.Row(), pData->maStart.Tab()))
+ {
+ // Only change visibility if object is not hidden by a hidden row
+ aObj->SetVisible(true);
+ }
+ }
+ }
+ }
+
if (bChanged)
SetStreamValid(false);
}