summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-02-05 19:21:22 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-02-05 23:06:26 -0500
commitfe5d604ecf6de4935c622e0e95efc085c4a3cbfd (patch)
tree65d2ef4f50308710da4e1e0531ebf6c2b1d5b4a1 /sc
parent771aadfce7d4b0dca678b0722c8f951371816082 (diff)
fdo#74556: Have ReleaseNote() really release note rather than destroying it.
Change-Id: I2d271476ae91354f33f19d074fa717b2a0b47ff7
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/column.hxx1
-rw-r--r--sc/inc/document.hxx1
-rw-r--r--sc/inc/table.hxx2
-rw-r--r--sc/source/core/data/column2.cxx10
-rw-r--r--sc/source/core/data/document.cxx13
-rw-r--r--sc/source/core/data/table2.cxx8
6 files changed, 25 insertions, 10 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index ee73c3f4e3fa..23a2a824f50c 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -515,6 +515,7 @@ public:
void SetCellNote( SCROW nRow, ScPostIt* pNote);
bool IsNotesEmptyBlock(SCROW nStartRow, SCROW nEndRow) const;
+ ScPostIt* ReleaseNote( SCROW nRow );
size_t GetNoteCount() const;
void CreateAllNoteCaptions();
SCROW GetNotePosition( size_t nIndex ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 98b40b028957..e214a321c30a 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -909,7 +909,6 @@ public:
SC_DLLPUBLIC bool HasColNotes(SCCOL nCol, SCTAB nTab);
SC_DLLPUBLIC bool HasTabNotes(SCTAB nTab);
SC_DLLPUBLIC ScPostIt* ReleaseNote(const ScAddress& rPos);
- SC_DLLPUBLIC ScPostIt* ReleaseNote(SCCOL nCol, SCROW nRow, SCTAB nTab);
SC_DLLPUBLIC ScPostIt* GetOrCreateNote(const ScAddress& rPos);
SC_DLLPUBLIC ScPostIt* CreateNote(const ScAddress& rPos);
size_t CountNotes() const;
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 522fde8b0750..0ac441cbf610 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -388,6 +388,8 @@ public:
ScPostIt* GetNote(const SCCOL nCol, const SCROW nRow);
+ ScPostIt* ReleaseNote( SCCOL nCol, SCROW nRow );
+
size_t GetNoteCount( SCCOL nCol ) const;
SCROW GetNotePosition( SCCOL nCol, size_t nIndex ) const;
void CreateAllNoteCaptions();
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 5a1e19d574bc..f6c7cd9fd8fb 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1212,6 +1212,16 @@ bool ScColumn::IsNotesEmptyBlock(SCROW nStartRow, SCROW nEndRow) const
return nEndRow < nNextRow;
}
+ScPostIt* ScColumn::ReleaseNote( SCROW nRow )
+{
+ if (!ValidRow(nRow))
+ return NULL;
+
+ ScPostIt* p = NULL;
+ maCellNotes.release(nRow, p);
+ return p;
+}
+
size_t ScColumn::GetNoteCount() const
{
size_t nCount = 0;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 1fb89cc263bc..3194f78bf5c1 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6192,16 +6192,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)
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index d566e914f1e7..41f5e0d18287 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1521,6 +1521,14 @@ ScPostIt* ScTable::GetNote(const SCCOL nCol, const SCROW nRow)
return pDocument->GetNote(nCol, nRow, nTab);
}
+ScPostIt* ScTable::ReleaseNote( SCCOL nCol, SCROW nRow )
+{
+ if (!ValidCol(nCol))
+ return NULL;
+
+ return aCol[nCol].ReleaseNote(nRow);
+}
+
size_t ScTable::GetNoteCount( SCCOL nCol ) const
{
if (!ValidCol(nCol))