summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2017-08-12 19:46:27 -0400
committerHenry Castro <hcastro@collabora.com>2017-12-08 13:06:57 +0100
commit1b7a8277aa3e9f73ccdf15e933a1ee3b42849a44 (patch)
tree64474c3499c36d31f0ea13d348245a6bea6abbe6
parent630be5751029fc8ebf5a8784fb1c07894a0e1600 (diff)
sc lok: 1 view has 1 clipboard to transfer data
In tiled rendering case, each view copy and paste the contents of the clipboard associated with the view Change-Id: Ic7b0d38ce4741af8c2053926ffd5172ab81aaaf5 Reviewed-on: https://gerrit.libreoffice.org/41113 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Henry Castro <hcastro@collabora.com>
-rw-r--r--sc/inc/clipdata.hxx24
-rw-r--r--sc/inc/scmod.hxx7
-rw-r--r--sc/qa/unit/tiledrendering/data/empty.odsbin0 -> 6727 bytes
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx44
-rw-r--r--sc/source/ui/app/drwtrans.cxx28
-rw-r--r--sc/source/ui/app/scmod.cxx17
-rw-r--r--sc/source/ui/app/transobj.cxx37
-rw-r--r--sc/source/ui/inc/drwtrans.hxx4
-rw-r--r--sc/source/ui/inc/transobj.hxx1
-rw-r--r--sc/source/ui/vba/excelvbahelper.cxx4
-rw-r--r--sc/source/ui/vba/vbarange.cxx6
-rw-r--r--sc/source/ui/view/cellsh.cxx33
-rw-r--r--sc/source/ui/view/cellsh1.cxx6
-rw-r--r--sc/source/ui/view/drawvie4.cxx1
-rw-r--r--sc/source/ui/view/viewfun3.cxx6
-rw-r--r--sc/source/ui/view/viewfun7.cxx3
16 files changed, 89 insertions, 132 deletions
diff --git a/sc/inc/clipdata.hxx b/sc/inc/clipdata.hxx
deleted file mode 100644
index 8c8d7dff93a2..000000000000
--- a/sc/inc/clipdata.hxx
+++ /dev/null
@@ -1,24 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#ifndef INCLUDED_SC_INC_CLIPDATA_HXX
-#define INCLUDED_SC_INC_CLIPDATA_HXX
-
-class ScTransferObj;
-class ScDrawTransferObj;
-
-struct ScClipData
-{
- ScTransferObj* pCellClipboard;
- ScDrawTransferObj* pDrawClipboard;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index 9b9ca89be7e8..34cd82b10b6b 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -72,15 +72,12 @@ class ScSelectionTransferObj;
class ScFormEditData;
class ScMarkData;
struct ScDragData;
-struct ScClipData;
class ScModule: public SfxModule, public SfxListener, public utl::ConfigurationListener
{
Timer aIdleTimer;
Idle aSpellIdle;
ScDragData* mpDragData;
- std::unique_ptr<ScClipData>
- mpClipData;
ScSelectionTransferObj* pSelTransfer;
ScMessagePool* pMessagePool;
// there is no global InputHandler anymore, each View has it's own
@@ -144,10 +141,6 @@ public:
void SetDragJump(
ScDocument* pLocalDoc, const OUString& rTarget, const OUString& rText );
- // clipboard:
- const ScClipData& GetClipData() const { return *mpClipData;}
- void SetClipObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj );
-
static ScDocument* GetClipDoc(); // called from document - should be removed later
// X selection:
diff --git a/sc/qa/unit/tiledrendering/data/empty.ods b/sc/qa/unit/tiledrendering/data/empty.ods
new file mode 100644
index 000000000000..3cdfa65704e5
--- /dev/null
+++ b/sc/qa/unit/tiledrendering/data/empty.ods
Binary files differ
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index e2fc936bf269..7d80d8349ded 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -24,6 +24,7 @@
#include <editeng/outliner.hxx>
#include <osl/conditn.hxx>
#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
#include <sfx2/viewfrm.hxx>
#include <svl/srchitem.hxx>
@@ -87,6 +88,7 @@ public:
void testDisableUndoRepair();
void testDocumentRepair();
void testLanguageStatus();
+ void testMultiViewCopyPaste();
CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
CPPUNIT_TEST(testRowColumnSelections);
@@ -116,6 +118,7 @@ public:
CPPUNIT_TEST(testDisableUndoRepair);
CPPUNIT_TEST(testDocumentRepair);
CPPUNIT_TEST(testLanguageStatus);
+ CPPUNIT_TEST(testMultiViewCopyPaste);
CPPUNIT_TEST_SUITE_END();
private:
@@ -1512,6 +1515,47 @@ void ScTiledRenderingTest::testLanguageStatus()
CPPUNIT_ASSERT_EQUAL(aLangBolivia, dynamic_cast< const SfxStringItem* >(pItem1.get())->GetValue());
CPPUNIT_ASSERT_EQUAL(aLangBolivia, dynamic_cast< const SfxStringItem* >(pItem1.get())->GetValue());
}
+}
+
+void ScTiledRenderingTest::testMultiViewCopyPaste()
+{
+ comphelper::LibreOfficeKit::setActive();
+
+ ScModelObj* pModelObj = createDoc("empty.ods");
+ ScDocument* pDoc = pModelObj->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+
+ pDoc->SetString(ScAddress(0, 0, 0), "TestCopy1");
+ pDoc->SetString(ScAddress(1, 0, 0), "TestCopy2");
+
+ // view #1
+ ScTabViewShell* pView1 = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
+ CPPUNIT_ASSERT(pView1);
+
+ // view #2
+ SfxLokHelper::createView();
+ ScTabViewShell* pView2 = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
+ CPPUNIT_ASSERT(pView2);
+ CPPUNIT_ASSERT(pView1 != pView2);
+
+ // copy text view 1
+ pView1->SetCursor(0, 0);
+ pView1->GetViewFrame()->GetBindings().Execute(SID_COPY);
+
+ // copy text view 2
+ pView2->SetCursor(1, 0);
+ pView2->GetViewFrame()->GetBindings().Execute(SID_COPY);
+
+ // paste text view 1
+ pView1->SetCursor(0, 1);
+ pView1->GetViewFrame()->GetBindings().Execute(SID_PASTE);
+
+ // paste text view 2
+ pView2->SetCursor(1, 1);
+ pView2->GetViewFrame()->GetBindings().Execute(SID_PASTE);
+
+ CPPUNIT_ASSERT_EQUAL(OUString("TestCopy1"), pDoc->GetString(ScAddress(0, 1, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("TestCopy2"), pDoc->GetString(ScAddress(1, 1, 0)));
comphelper::LibreOfficeKit::setActive(false);
}
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx
index 3e7cce703222..d661d1711a0d 100644
--- a/sc/source/ui/app/drwtrans.cxx
+++ b/sc/source/ui/app/drwtrans.cxx
@@ -58,7 +58,6 @@
#include <rangeutl.hxx>
#include <formula/grammar.hxx>
#include <dragdata.hxx>
-#include <clipdata.hxx>
#include <scitems.hxx>
@@ -221,11 +220,6 @@ ScDrawTransferObj::~ScDrawTransferObj()
SolarMutexGuard aSolarGuard;
ScModule* pScMod = SC_MOD();
- if ( pScMod->GetClipData().pDrawClipboard == this )
- {
- OSL_FAIL("ScDrawTransferObj wasn't released");
- pScMod->SetClipObject( nullptr, nullptr );
- }
if ( pScMod->GetDragData().pDrawTransfer == this )
{
OSL_FAIL("ScDrawTransferObj wasn't released");
@@ -242,9 +236,18 @@ ScDrawTransferObj::~ScDrawTransferObj()
delete pDragSourceView;
}
-ScDrawTransferObj* ScDrawTransferObj::GetOwnClipboard()
+ScDrawTransferObj* ScDrawTransferObj::GetOwnClipboard( vcl::Window* pWin )
{
- ScDrawTransferObj* pObj = SC_MOD()->GetClipData().pDrawClipboard;
+ ScDrawTransferObj* pObj = nullptr;
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pWin ) );
+ uno::Reference<XUnoTunnel> xTunnel( aDataHelper.GetTransferable(), uno::UNO_QUERY );
+ if ( xTunnel.is() )
+ {
+ sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() );
+ if ( nHandle )
+ pObj = dynamic_cast<ScDrawTransferObj*>(reinterpret_cast<TransferableHelper*>( (sal_IntPtr) nHandle ));
+ }
+
return pObj;
}
@@ -585,15 +588,6 @@ bool ScDrawTransferObj::WriteObject( tools::SvRef<SotStorageStream>& rxOStm, voi
return bRet;
}
-void ScDrawTransferObj::ObjectReleased()
-{
- ScModule* pScMod = SC_MOD();
- if ( pScMod->GetClipData().pDrawClipboard == this )
- pScMod->SetClipObject( nullptr, nullptr );
-
- TransferableHelper::ObjectReleased();
-}
-
void ScDrawTransferObj::DragFinished( sal_Int8 nDropAction )
{
if ( nDropAction == DND_ACTION_MOVE && !bDragWasInternal && !(nDragSourceFlags & ScDragSrc::Navigator) )
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 23cfa22074ab..9812e37ce12f 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -106,7 +106,6 @@
#include <detfunc.hxx>
#include <preview.hxx>
#include <dragdata.hxx>
-#include <clipdata.hxx>
#include <markdata.hxx>
#include <svx/xmlsecctrl.hxx>
@@ -142,7 +141,6 @@ ScModule::ScModule( SfxObjectFactory* pFact ) :
aIdleTimer("sc ScModule IdleTimer"),
aSpellIdle("sc ScModule SpellIdle"),
mpDragData(new ScDragData),
- mpClipData(new ScClipData),
pSelTransfer( nullptr ),
pMessagePool( nullptr ),
pRefInputHandler( nullptr ),
@@ -172,7 +170,6 @@ ScModule::ScModule( SfxObjectFactory* pFact ) :
SetName("StarCalc"); // for Basic
ResetDragObject();
- SetClipObject( nullptr, nullptr );
// InputHandler does not need to be created
@@ -663,18 +660,14 @@ void ScModule::SetDragJump(
mpDragData->aJumpText = rText;
}
-void ScModule::SetClipObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj )
-{
- OSL_ENSURE( !pCellObj || !pDrawObj, "SetClipObject: not allowed to set both objects" );
-
- mpClipData->pCellClipboard = pCellObj;
- mpClipData->pDrawClipboard = pDrawObj;
-}
-
ScDocument* ScModule::GetClipDoc()
{
// called from document
- ScTransferObj* pObj = ScTransferObj::GetOwnClipboard( nullptr );
+ vcl::Window* pWin = nullptr;
+ if( ScTabViewShell* pViewShell = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ))
+ pWin = pViewShell->GetViewData().GetActiveWin();
+
+ ScTransferObj* pObj = ScTransferObj::GetOwnClipboard( pWin );
if (pObj)
{
ScDocument* pDoc = pObj->GetDocument();
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 4d01a67db4d2..b3b17e420cca 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -47,7 +47,6 @@
#include <docfunc.hxx>
#include <scmod.hxx>
#include <dragdata.hxx>
-#include <clipdata.hxx>
#include <clipparam.hxx>
#include <editeng/paperinf.hxx>
@@ -184,11 +183,6 @@ ScTransferObj::~ScTransferObj()
SolarMutexGuard aSolarGuard;
ScModule* pScMod = SC_MOD();
- if ( pScMod->GetClipData().pCellClipboard == this )
- {
- OSL_FAIL("ScTransferObj wasn't released");
- pScMod->SetClipObject( nullptr, nullptr );
- }
if ( pScMod->GetDragData().pCellTransfer == this )
{
OSL_FAIL("ScTransferObj wasn't released");
@@ -205,22 +199,16 @@ ScTransferObj::~ScTransferObj()
ScTransferObj* ScTransferObj::GetOwnClipboard( vcl::Window* pUIWin )
{
- ScTransferObj* pObj = SC_MOD()->GetClipData().pCellClipboard;
- if ( pObj && pUIWin )
+ ScTransferObj* pObj = nullptr;
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pUIWin ) );
+ uno::Reference<XUnoTunnel> xTunnel( aDataHelper.GetTransferable(), uno::UNO_QUERY );
+ if ( xTunnel.is() )
{
- // check formats to see if pObj is really in the system clipboard
-
- // pUIWin is NULL when called from core (IsClipboardSource),
- // in that case don't access the system clipboard, because the call
- // may be from other clipboard operations (like flushing, #86059#)
-
- TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pUIWin ) );
- if ( !aDataHelper.HasFormat( SotClipboardFormatId::DIF ) )
- {
-// OSL_FAIL("ScTransferObj wasn't released");
- pObj = nullptr;
- }
+ sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() );
+ if ( nHandle )
+ pObj = dynamic_cast<ScTransferObj*>(reinterpret_cast<TransferableHelper*>( (sal_IntPtr) nHandle ));
}
+
return pObj;
}
@@ -524,15 +512,6 @@ bool ScTransferObj::WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* p
return bRet;
}
-void ScTransferObj::ObjectReleased()
-{
- ScModule* pScMod = SC_MOD();
- if ( pScMod && pScMod->GetClipData().pCellClipboard == this )
- pScMod->SetClipObject( nullptr, nullptr );
-
- TransferableHelper::ObjectReleased();
-}
-
void ScTransferObj::DragFinished( sal_Int8 nDropAction )
{
if ( nDropAction == DND_ACTION_MOVE && !bDragWasInternal && !(nDragSourceFlags & ScDragSrc::Navigator) )
diff --git a/sc/source/ui/inc/drwtrans.hxx b/sc/source/ui/inc/drwtrans.hxx
index 2567e6d552a8..be1137ed37e8 100644
--- a/sc/source/ui/inc/drwtrans.hxx
+++ b/sc/source/ui/inc/drwtrans.hxx
@@ -77,7 +77,6 @@ public:
virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
virtual bool WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
const css::datatransfer::DataFlavor& rFlavor ) override;
- virtual void ObjectReleased() override;
virtual void DragFinished( sal_Int8 nDropAction ) override;
SdrModel* GetModel() { return pModel; }
@@ -93,7 +92,8 @@ public:
SdrView* GetDragSourceView() { return pDragSourceView; }
ScDragSrc GetDragSourceFlags() const { return nDragSourceFlags; }
- static ScDrawTransferObj* GetOwnClipboard();
+ static ScDrawTransferObj* GetOwnClipboard( vcl::Window* );
+
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override;
static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx
index 62d50ca4f712..8059e228d54a 100644
--- a/sc/source/ui/inc/transobj.hxx
+++ b/sc/source/ui/inc/transobj.hxx
@@ -76,7 +76,6 @@ public:
virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
virtual bool WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
const css::datatransfer::DataFlavor& rFlavor ) override;
- virtual void ObjectReleased() override;
virtual void DragFinished( sal_Int8 nDropAction ) override;
ScDocument* GetDocument() { return pDoc; } // owned by ScTransferObj
diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx
index a854df75914d..8dcb6e9d55f2 100644
--- a/sc/source/ui/vba/excelvbahelper.cxx
+++ b/sc/source/ui/vba/excelvbahelper.cxx
@@ -170,7 +170,7 @@ implnCopy( const uno::Reference< frame::XModel>& xModel )
pViewShell->CopyToClip(nullptr,false,false,true);
// mark the copied transfer object so it is used in ScVbaRange::Insert
- ScTransferObj* pClipObj = ScTransferObj::GetOwnClipboard( nullptr );
+ ScTransferObj* pClipObj = ScTransferObj::GetOwnClipboard( pViewShell->GetViewData().GetActiveWin() );
if (pClipObj)
pClipObj->SetUseInApi( true );
}
@@ -185,7 +185,7 @@ implnCut( const uno::Reference< frame::XModel>& xModel )
pViewShell->CutToClip();
// mark the copied transfer object so it is used in ScVbaRange::Insert
- ScTransferObj* pClipObj = ScTransferObj::GetOwnClipboard( nullptr );
+ ScTransferObj* pClipObj = ScTransferObj::GetOwnClipboard( pViewShell->GetViewData().GetActiveWin() );
if (pClipObj)
pClipObj->SetUseInApi( true );
}
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 510d5ec0da7d..b306cf510537 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -4684,7 +4684,11 @@ ScVbaRange::Insert( const uno::Any& Shift, const uno::Any& /*CopyOrigin*/ )
// Paste from clipboard only if the clipboard content was copied via VBA, and not already pasted via VBA again.
// "Insert" behavior should not depend on random clipboard content previously copied by the user.
- ScTransferObj* pClipObj = ScTransferObj::GetOwnClipboard( nullptr );
+ vcl::Window* pWin = nullptr;
+ if(ScTabViewShell* pViewShell = excel::getBestViewShell( getUnoModel() ))
+ pWin = pViewShell->GetViewData().GetActiveWin();
+
+ ScTransferObj* pClipObj = ScTransferObj::GetOwnClipboard( pWin );
if ( pClipObj && pClipObj->GetUseInApi() )
{
// After the insert ( this range ) actually has moved
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 8167be10088f..92b389504b99 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -450,7 +450,7 @@ static bool lcl_TestFormat( SvxClipboardFormatItem& rFormats, const Transferable
void ScCellShell::GetPossibleClipboardFormats( SvxClipboardFormatItem& rFormats )
{
vcl::Window* pWin = GetViewData()->GetActiveWin();
- bool bDraw = ScDrawTransferObj::GetOwnClipboard() != nullptr;
+ bool bDraw = ScDrawTransferObj::GetOwnClipboard( pWin ) != nullptr;
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pWin ) );
@@ -481,10 +481,10 @@ void ScCellShell::GetPossibleClipboardFormats( SvxClipboardFormatItem& rFormats
// insert, insert contents
-static bool lcl_IsCellPastePossible( const TransferableDataHelper& rData )
+static bool lcl_IsCellPastePossible( const TransferableDataHelper& rData, vcl::Window* pWin )
{
bool bPossible = false;
- if ( ScTransferObj::GetOwnClipboard( nullptr ) || ScDrawTransferObj::GetOwnClipboard() )
+ if ( ScTransferObj::GetOwnClipboard( pWin ) || ScDrawTransferObj::GetOwnClipboard( pWin ) )
bPossible = true;
else
{
@@ -523,7 +523,7 @@ bool ScCellShell::HasClipboardFormat( SotClipboardFormatId nFormatId )
IMPL_LINK( ScCellShell, ClipboardChanged, TransferableDataHelper*, pDataHelper, void )
{
- bPastePossible = lcl_IsCellPastePossible( *pDataHelper );
+ bPastePossible = lcl_IsCellPastePossible( *pDataHelper, GetViewData()->GetActiveWin() );
SfxBindings& rBindings = GetViewData()->GetBindings();
rBindings.Invalidate( SID_PASTE );
@@ -597,7 +597,7 @@ void ScCellShell::GetClipState( SfxItemSet& rSet )
// get initial state
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pWin ) );
- bPastePossible = lcl_IsCellPastePossible( aDataHelper );
+ bPastePossible = lcl_IsCellPastePossible( aDataHelper, pWin );
}
bool bDisable = !bPastePossible;
@@ -617,29 +617,6 @@ void ScCellShell::GetClipState( SfxItemSet& rSet )
bDisable = true;
}
- // This is only a workaround, we don't want that text content copied
- // in one view is pasted in a different view.
- // This part of the patch takes care to disable the "Paste" entry
- // in the context menu.
- // TODO: implement a solution providing one clipboard per view
- if (comphelper::LibreOfficeKit::isActive())
- {
- ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard(nullptr);
- if (pOwnClip)
- {
- ScDocument* pClipDoc = pOwnClip->GetDocument();
- if (pClipDoc)
- {
- ScTabViewShell* pThisView = GetViewData()->GetViewShell();
- ScTabViewShell* pSourceView = dynamic_cast<ScTabViewShell*>(pClipDoc->GetClipParam().getSourceView());
- if (pThisView && pSourceView && pThisView != pSourceView)
- {
- bDisable = true;
- }
- }
- }
- }
-
if (bDisable)
{
rSet.DisableItem( SID_PASTE );
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 2ea794a0bc99..947679591bbf 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1311,7 +1311,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
{
vcl::Window* pWin = GetViewData()->GetActiveWin();
bool bCells = ( ScTransferObj::GetOwnClipboard( pWin ) != nullptr );
- bool bDraw = ( ScDrawTransferObj::GetOwnClipboard() != nullptr );
+ bool bDraw = ( ScDrawTransferObj::GetOwnClipboard( pWin ) != nullptr );
bool bOle = ( nFormat == SotClipboardFormatId::EMBED_SOURCE );
if ( bCells && bOle )
@@ -1562,7 +1562,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
bool bRet=true;
{
WaitObject aWait( GetViewData()->GetDialogParent() );
- bool bDraw = ( ScDrawTransferObj::GetOwnClipboard() != nullptr );
+ bool bDraw = ( ScDrawTransferObj::GetOwnClipboard( pWin ) != nullptr );
if ( bDraw && nFormat == SotClipboardFormatId::EMBED_SOURCE )
pTabViewShell->PasteDraw();
else
@@ -1589,7 +1589,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
}
else // draw objects or external data
{
- bool bDraw = ( ScDrawTransferObj::GetOwnClipboard() != nullptr );
+ bool bDraw = ( ScDrawTransferObj::GetOwnClipboard( pWin ) != nullptr );
SvxClipboardFormatItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS );
GetPossibleClipboardFormats( aFormats );
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index 23a9957ccef4..72f06667ce34 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -376,7 +376,6 @@ void ScDrawView::DoCopy()
}
pTransferObj->CopyToClipboard( pViewData->GetActiveWin() ); // system clipboard
- SC_MOD()->SetClipObject( nullptr, pTransferObj.get() ); // internal clipboard
}
uno::Reference<datatransfer::XTransferable> ScDrawView::CopyToTransferable()
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index ee680c06685d..dd038f35e242 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -288,7 +288,6 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b
}
pTransferObj->CopyToClipboard( GetActiveWin() );
- SC_MOD()->SetClipObject( pTransferObj.get(), nullptr );
}
bDone = true;
@@ -396,7 +395,6 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b
}
pTransferObj->CopyToClipboard( GetActiveWin() ); // system clipboard
- SC_MOD()->SetClipObject( pTransferObj.get(), nullptr ); // internal clipboard
}
bSuccess = true;
@@ -457,7 +455,7 @@ void ScViewFunc::PasteDraw()
vcl::Window* pWin = GetActiveWin();
Point aPos = pWin->PixelToLogic( rViewData.GetScrPos( nPosX, nPosY,
rViewData.GetActivePart() ) );
- ScDrawTransferObj* pDrawClip = ScDrawTransferObj::GetOwnClipboard();
+ ScDrawTransferObj* pDrawClip = ScDrawTransferObj::GetOwnClipboard( pWin );
if (pDrawClip)
{
OUString aSrcShellID = pDrawClip->GetShellID();
@@ -473,7 +471,7 @@ void ScViewFunc::PasteFromSystem()
vcl::Window* pWin = GetActiveWin();
ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
// keep a reference in case the clipboard is changed during PasteFromClip
- rtl::Reference<ScDrawTransferObj> pDrawClip = ScDrawTransferObj::GetOwnClipboard();
+ rtl::Reference<ScDrawTransferObj> pDrawClip = ScDrawTransferObj::GetOwnClipboard( pWin );
if (pOwnClip)
{
PasteFromClip( InsertDeleteFlags::ALL, pOwnClip->GetDocument(),
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index c72cfc2702bd..af02d1adc969 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -249,8 +249,9 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
ScDocument* pDocument = GetViewData().GetDocument();
ScDocShell* pDocShell = GetViewData().GetDocShell();
+ vcl::Window* pWin = GetViewData().GetActiveWin();
ScModelObj* pModelObj = ( pDocShell ? ScModelObj::getImplementation( pDocShell->GetModel() ) : nullptr );
- ScDrawTransferObj* pTransferObj = ScDrawTransferObj::GetOwnClipboard();
+ ScDrawTransferObj* pTransferObj = ScDrawTransferObj::GetOwnClipboard( pWin );
if ( pDocument && pPage && pModelObj && ( pTransferObj || pDrawTrans ) )
{
const ScRangeListVector& rProtectedChartRangesVector(