diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-05 19:21:22 -0500 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2014-02-06 14:39:29 +0000 |
commit | a0fe08c6862f5debaa375cc35c6bcec64f1008dc (patch) | |
tree | 46ed84b72f6702deece1a9e4e8618e475b66a611 /sc/source/core/data/document.cxx | |
parent | 0003e02b1c96e01607924873697a52fb813343ac (diff) |
fdo#74556: Correctly handle note captions life cycles.
When copying notes to clipboard, we don't clone captions but leave them
pointing to the original captions objects. Also, during undo and redo,
we need to clear all caption pointers to prevent them from being deleted
when the ScPostIt objects get deleted. The undo and redo of caption objects
are handled in the drawing layer afterwards.
Also, Have ReleaseNote() really release note rather than destroying it.
(cherry picked from commit fe5d604ecf6de4935c622e0e95efc085c4a3cbfd)
(cherry picked from commit bc504b5adfaeeac0b910b89b0c98ae564f1ff5b8)
Change-Id: Ia1da7784d04a2183f21813b6914e78161aad39d7
Reviewed-on: https://gerrit.libreoffice.org/7887
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'sc/source/core/data/document.cxx')
-rw-r--r-- | sc/source/core/data/document.cxx | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 99192e485181..06ae53021e67 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -6147,16 +6147,11 @@ bool ScDocument::HasTabNotes(SCTAB nTab) ScPostIt* ScDocument::ReleaseNote(const ScAddress& rPos) { - return ReleaseNote(rPos.Col(), rPos.Row(), rPos.Tab()); -} -ScPostIt* ScDocument::ReleaseNote(SCCOL nCol, SCROW nRow, SCTAB nTab) -{ - - ScPostIt* pPostIt = GetNote(nCol, nRow, nTab); - if (pPostIt != NULL) - maTabs[nTab]->aCol[nCol].DeleteCellNote(nRow); + ScTable* pTab = FetchTable(rPos.Tab()); + if (!pTab) + return NULL; - return pPostIt; + return pTab->ReleaseNote(rPos.Col(), rPos.Row()); } ScPostIt* ScDocument::GetOrCreateNote(const ScAddress& rPos) @@ -6205,6 +6200,24 @@ void ScDocument::CreateAllNoteCaptions() } } +void ScDocument::ForgetNoteCaptions( const ScRangeList& rRanges ) +{ + for (size_t i = 0, n = rRanges.size(); i < n; ++i) + { + const ScRange* p = rRanges[i]; + const ScAddress& s = p->aStart; + const ScAddress& e = p->aEnd; + for (SCTAB nTab = s.Tab(); nTab <= e.Tab(); ++nTab) + { + ScTable* pTab = FetchTable(nTab); + if (!pTab) + continue; + + pTab->ForgetNoteCaptions(s.Col(), s.Row(), e.Col(), e.Row()); + } + } +} + ScAddress ScDocument::GetNotePosition( size_t nIndex ) const { for (size_t nTab = 0; nTab < maTabs.size(); ++nTab) |