summaryrefslogtreecommitdiff
path: root/sc/source/core/data
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-05-05 15:22:15 -0400
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-05-06 06:26:31 +0000
commitb26b9606efa30c0a44e20dcf638fbd1e27f05089 (patch)
tree0a23ee59bca5cf34a2c8cfd0263cedd3ad3a103e /sc/source/core/data
parent3efb6e5c35bb1129a78726b163f8fbf9bd94734a (diff)
fdo#78054: Initialize drawing layer when the document contains notes.
Don't be fooled even when the document doesn't have a drawing layer initialized. Sometimes a note creates caption on demand later, but if the drawing layer isn't there the caption will not get created, which ultimately causes this crash. (cherry picked from commit fe451fb94a33c914c0a7c1265c013d9704af850a) Conflicts: sc/inc/document.hxx Change-Id: I37f4902fa84de91c9f793dc352127d9345a725e3 Reviewed-on: https://gerrit.libreoffice.org/9254 Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/source/core/data')
-rw-r--r--sc/source/core/data/document.cxx20
1 files changed, 15 insertions, 5 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index bc6673575b09..8c69412d1beb 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6109,21 +6109,21 @@ void ScDocument::SetNote(SCCOL nCol, SCROW nRow, SCTAB nTab, ScPostIt* pNote)
return maTabs[nTab]->aCol[nCol].SetCellNote(nRow, pNote);
}
-bool ScDocument::HasNote(const ScAddress& rPos)
+bool ScDocument::HasNote(const ScAddress& rPos) const
{
return HasNote(rPos.Col(), rPos.Row(), rPos.Tab());
}
-bool ScDocument::HasNote(SCCOL nCol, SCROW nRow, SCTAB nTab)
+bool ScDocument::HasNote(SCCOL nCol, SCROW nRow, SCTAB nTab) const
{
- ScPostIt* pNote = maTabs[nTab]->aCol[nCol].GetCellNote(nRow);
+ const ScPostIt* pNote = maTabs[nTab]->aCol[nCol].GetCellNote(nRow);
return pNote != NULL;
}
-bool ScDocument::HasColNotes(SCCOL nCol, SCTAB nTab)
+bool ScDocument::HasColNotes(SCCOL nCol, SCTAB nTab) const
{
return maTabs[nTab]->aCol[nCol].HasCellNotes();
}
-bool ScDocument::HasTabNotes(SCTAB nTab)
+bool ScDocument::HasTabNotes(SCTAB nTab) const
{
bool hasNotes = false;
for (SCCOL nCol=0; nCol<MAXCOLCOUNT && !hasNotes; ++nCol)
@@ -6132,6 +6132,16 @@ bool ScDocument::HasTabNotes(SCTAB nTab)
return hasNotes;
}
+bool ScDocument::HasNotes() const
+{
+ for (SCTAB i = 0; i <= MAXTAB; ++i)
+ {
+ if (HasTabNotes(i))
+ return true;
+ }
+ return false;
+}
+
ScPostIt* ScDocument::ReleaseNote(const ScAddress& rPos)
{
ScTable* pTab = FetchTable(rPos.Tab());