diff options
author | Eike Rathke <erack@redhat.com> | 2017-02-22 18:50:34 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-02-22 18:51:21 +0100 |
commit | 65553180cfe80a1b2d551c8063a5bc03b427d138 (patch) | |
tree | b73705459e9676cc1550038b859772247455b1af /sc | |
parent | 0b08eacd79a2133a07410dfb99bcc04bb9dd2199 (diff) |
less ugly ClosingClipboardSource()
Change-Id: Ie53837e4dd5f779255eac25e090b23e49c3786ce
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/document.hxx | 7 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/documen2.cxx | 11 |
3 files changed, 18 insertions, 4 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index e93e88249e7a..a18b2eac1314 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1479,6 +1479,13 @@ public: ScClipParam& GetClipParam(); void SetClipParam(const ScClipParam& rParam); + /** To be called at the clipboard document when closing a document that is + the current clipboard source to decouple things from the originating + document. Done in ScDocument dtor after determining + IsClipboardSource(). + */ + void ClosingClipboardSource(); + void MixDocument( const ScRange& rRange, ScPasteFunc nFunction, bool bSkipEmpty, ScDocument* pSrcDoc ); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index f2a01963d8d0..c715c5e76675 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -5365,8 +5365,8 @@ void Test::testNoteLifeCycle() // There's no ScTransferObject involved in the "fake" clipboard copy // and ScDocument dtor asking IsClipboardSource() gets no, so emulate // the part that normally is reponsible for forgetting the caption - // objects. Ugly. - aClipDoc2.ForgetNoteCaptions( ScRangeList( ScRange( 0,0,0, MAXCOL, MAXROW, aClipDoc2.GetTableCount()-1)), true); + // objects. + aClipDoc2.ClosingClipboardSource(); pDoc2->DeleteTab(0); closeDocShell(xDocSh2); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 525c299538b6..a2365bbb2ebe 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -359,6 +359,14 @@ void ScDocument::StartTrackTimer() aTrackIdle.Start(); } +void ScDocument::ClosingClipboardSource() +{ + if (!bIsClip) + return; + + ForgetNoteCaptions( ScRangeList( ScRange( 0,0,0, MAXCOL, MAXROW, GetTableCount()-1)), true); +} + ScDocument::~ScDocument() { OSL_PRECOND( !bInLinkUpdate, "bInLinkUpdate in dtor" ); @@ -383,8 +391,7 @@ ScDocument::~ScDocument() // attempt to access non-existing data. Preserve the text data though. ScDocument* pClipDoc = ScModule::GetClipDoc(); if (pClipDoc) - pClipDoc->ForgetNoteCaptions( - ScRangeList( ScRange( 0,0,0, MAXCOL, MAXROW, pClipDoc->GetTableCount()-1)), true); + pClipDoc->ClosingClipboardSource(); } mxFormulaParserPool.reset(); |