summaryrefslogtreecommitdiff
path: root/sc/source/core/data/document.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/data/document.cxx')
-rw-r--r--sc/source/core/data/document.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 470ac4909854..252117184a0f 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6494,9 +6494,8 @@ ScPostIt* ScDocument::GetNote(const ScAddress& rPos)
ScPostIt* ScDocument::GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab)
{
- if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) &&
- nCol < maTabs[nTab]->GetAllocatedColumnsCount())
- return maTabs[nTab]->aCol[nCol].GetCellNote(nRow);
+ if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()))
+ return maTabs[nTab]->GetNote(nCol, nRow);
else
return nullptr;
@@ -6509,7 +6508,8 @@ void ScDocument::SetNote(const ScAddress& rPos, std::unique_ptr<ScPostIt> pNote)
void ScDocument::SetNote(SCCOL nCol, SCROW nRow, SCTAB nTab, std::unique_ptr<ScPostIt> pNote)
{
- return maTabs[nTab]->CreateColumnIfNotExists(nCol).SetCellNote(nRow, std::move(pNote));
+ if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()))
+ maTabs[nTab]->SetNote(nCol, nRow, std::move(pNote));
}
bool ScDocument::HasNote(const ScAddress& rPos) const
@@ -6542,6 +6542,9 @@ bool ScDocument::HasColNotes(SCCOL nCol, SCTAB nTab) const
if (!pTab)
return false;
+ if (nCol >= pTab->GetAllocatedColumnsCount())
+ return false;
+
return pTab->aCol[nCol].HasCellNotes();
}
@@ -6585,6 +6588,7 @@ ScPostIt* ScDocument::GetOrCreateNote(const ScAddress& rPos)
else
return CreateNote(rPos);
}
+
ScPostIt* ScDocument::CreateNote(const ScAddress& rPos)
{
ScPostIt* pPostIt = new ScPostIt(*this, rPos);