diff options
Diffstat (limited to 'sc/source/core/data/document.cxx')
-rw-r--r-- | sc/source/core/data/document.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 06a1a532e628..ea10ba0913f3 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -6448,7 +6448,7 @@ ScPostIt* ScDocument::GetNote(const ScAddress& rPos) ScPostIt* ScDocument::GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab) { if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size())) - return maTabs[nTab]->aCol[nCol].GetCellNote(nRow); + return maTabs[nTab]->GetNote(nCol, nRow); else return nullptr; @@ -6461,7 +6461,8 @@ void ScDocument::SetNote(const ScAddress& rPos, ScPostIt* pNote) void ScDocument::SetNote(SCCOL nCol, SCROW nRow, SCTAB nTab, ScPostIt* pNote) { - return maTabs[nTab]->aCol[nCol].SetCellNote(nRow, 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 @@ -6491,6 +6492,9 @@ bool ScDocument::HasColNotes(SCCOL nCol, SCTAB nTab) const if (!pTab) return false; + if (nCol >= MAXCOLCOUNT) + return false; + return pTab->aCol[nCol].HasCellNotes(); } @@ -6534,6 +6538,7 @@ ScPostIt* ScDocument::GetOrCreateNote(const ScAddress& rPos) else return CreateNote(rPos); } + ScPostIt* ScDocument::CreateNote(const ScAddress& rPos) { ScPostIt* pPostIt = new ScPostIt(*this, rPos); |