sc/inc/document.hxx | 9 +++++---- sc/source/core/data/document.cxx | 20 +++++++++++++++----- sc/source/ui/app/transobj.cxx | 2 +- 3 files changed, 21 insertions(+), 10 deletions(-)
New commits: commit b26b9606efa30c0a44e20dcf638fbd1e27f05089 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Mon May 5 15:22:15 2014 -0400 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.mohrh...@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 365cffd..339bbb0 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -919,10 +919,11 @@ public: SC_DLLPUBLIC ScPostIt* GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab); void SetNote(const ScAddress& rPos, ScPostIt* pNote); void SetNote(SCCOL nCol, SCROW nRow, SCTAB nTab, ScPostIt* pNote); - bool HasNote(const ScAddress& rPos); - bool HasNote(SCCOL nCol, SCROW nRow, SCTAB nTab); - SC_DLLPUBLIC bool HasColNotes(SCCOL nCol, SCTAB nTab); - SC_DLLPUBLIC bool HasTabNotes(SCTAB nTab); + bool HasNote(const ScAddress& rPos) const; + bool HasNote(SCCOL nCol, SCROW nRow, SCTAB nTab) const; + SC_DLLPUBLIC bool HasColNotes(SCCOL nCol, SCTAB nTab) const; + SC_DLLPUBLIC bool HasTabNotes(SCTAB nTab) const; + bool HasNotes() const; SC_DLLPUBLIC ScPostIt* ReleaseNote(const ScAddress& rPos); SC_DLLPUBLIC ScPostIt* GetOrCreateNote(const ScAddress& rPos); SC_DLLPUBLIC ScPostIt* CreateNote(const ScAddress& rPos); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index bc66735..8c69412 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()); diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index b2187d5..ec6bb4a 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -643,7 +643,7 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize) } } - if ( pDoc->GetDrawLayer() ) + if (pDoc->GetDrawLayer() || pDoc->HasNotes()) pDocSh->MakeDrawLayer(); // cell range is copied to the original position, but on the first sheet _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits