summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/document.hxx7
-rw-r--r--sc/qa/unit/ucalc.cxx4
-rw-r--r--sc/source/core/data/documen2.cxx11
3 files changed, 18 insertions, 4 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 10ce2e2f750a..1bd7d31ad375 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1477,6 +1477,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 5ad2df33d7d1..a80283514ef7 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -5178,8 +5178,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 7a41f14c01c2..0a69c8c1e109 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -358,6 +358,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" );
@@ -382,8 +390,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();