summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2017-08-12 19:46:27 -0400
committerTamás Zolnai <tamas.zolnai@collabora.com>2018-01-08 21:46:32 +0100
commitdc916fdea9819fb7efbf3521efc5dc758f9fd3b3 (patch)
tree189a0a9fe09dffed3daf304d9ad33abec06215ed /sc
parent07d7a3bb24a4c1f4d6289cd8d3a90852f69f9f71 (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> Reviewed-on: https://gerrit.libreoffice.org/46423 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/clipdata.hxx24
-rw-r--r--sc/inc/scmod.hxx6
-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.cxx30
-rw-r--r--sc/source/ui/app/scmod.cxx18
-rw-r--r--sc/source/ui/app/transobj.cxx37
-rw-r--r--sc/source/ui/inc/drwtrans.hxx2
-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/drawvie4.cxx1
-rw-r--r--sc/source/ui/view/viewfun3.cxx2
-rw-r--r--sc/source/ui/view/viewfun7.cxx3
15 files changed, 84 insertions, 127 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 15ddc133fdf0..99b6b66565f7 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -71,14 +71,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;
- ScClipData* mpClipData;
ScSelectionTransferObj* pSelTransfer;
ScMessagePool* pMessagePool;
// there is no global InputHandler anymore, each View has it's own
@@ -142,10 +140,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 6e5fdbe646a9..53d96494ad75 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>
@@ -78,6 +79,7 @@ public:
void testDocumentSizeWithTwoViews();
void testDisableUndoRepair();
void testLanguageStatus();
+ void testMultiViewCopyPaste();
CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
CPPUNIT_TEST(testRowColumnSelections);
@@ -106,6 +108,7 @@ public:
CPPUNIT_TEST(testDocumentSizeWithTwoViews);
CPPUNIT_TEST(testDisableUndoRepair);
CPPUNIT_TEST(testLanguageStatus);
+ CPPUNIT_TEST(testMultiViewCopyPaste);
CPPUNIT_TEST_SUITE_END();
private:
@@ -1460,6 +1463,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 8c8d24b15683..d9a681253a03 100644
--- a/sc/source/ui/app/drwtrans.cxx
+++ b/sc/source/ui/app/drwtrans.cxx
@@ -58,8 +58,7 @@
#include "chartlis.hxx"
#include "rangeutl.hxx"
#include <formula/grammar.hxx>
-#include "dragdata.hxx"
-#include "clipdata.hxx"
+#include <dragdata.hxx>
#include "scitems.hxx"
@@ -224,11 +223,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");
@@ -245,9 +239,18 @@ ScDrawTransferObj::~ScDrawTransferObj()
delete pDragSourceView;
}
-ScDrawTransferObj* ScDrawTransferObj::GetOwnClipboard( vcl::Window* )
+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;
}
@@ -588,15 +591,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 844a2a54407f..bc2dcead5f30 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -101,7 +101,6 @@
#include "detfunc.hxx"
#include "preview.hxx"
#include "dragdata.hxx"
-#include "clipdata.hxx"
#include "markdata.hxx"
#include <svx/xmlsecctrl.hxx>
@@ -137,7 +136,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 ),
@@ -167,7 +165,6 @@ ScModule::ScModule( SfxObjectFactory* pFact ) :
SetName("StarCalc"); // for Basic
ResetDragObject();
- SetClipObject( nullptr, nullptr );
// InputHandler does not need to be created
@@ -207,7 +204,6 @@ ScModule::~ScModule()
DELETEZ( pFormEditData );
delete mpDragData;
- delete mpClipData;
delete pErrorHdl;
ScGlobal::Clear(); // Also calls ScDocumentPool::DeleteVersionMaps();
@@ -668,18 +664,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)
return pObj->GetDocument();
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 21ee669859a8..c17ac0cc7ed1 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -48,7 +48,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;
}
@@ -492,15 +480,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 24e14a732b5d..50537baffabb 100644
--- a/sc/source/ui/inc/drwtrans.hxx
+++ b/sc/source/ui/inc/drwtrans.hxx
@@ -79,7 +79,6 @@ public:
virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
virtual bool WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* pUserObject, SotClipboardFormatId nUserObjectId,
const css::datatransfer::DataFlavor& rFlavor ) override;
- virtual void ObjectReleased() override;
virtual void DragFinished( sal_Int8 nDropAction ) override;
SdrModel* GetModel() { return pModel; }
@@ -97,6 +96,7 @@ public:
static ScDrawTransferObj* GetOwnClipboard( vcl::Window* pUIWin );
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) throw( css::uno::RuntimeException, std::exception ) override;
+
static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
const ScRangeListVector& GetProtectedChartRangesVector() const { return m_aProtectedChartRangesVector; }
diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx
index 593a5e0ee40b..b82cbba27a13 100644
--- a/sc/source/ui/inc/transobj.hxx
+++ b/sc/source/ui/inc/transobj.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, SotClipboardFormatId 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 b6619f2409b7..68ecb1c7a611 100644
--- a/sc/source/ui/vba/excelvbahelper.cxx
+++ b/sc/source/ui/vba/excelvbahelper.cxx
@@ -166,7 +166,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 );
}
@@ -181,7 +181,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 c3cee2c3549c..95d8b4855db3 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*/ ) thro
// 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 309cbf10799a..abaa70b5bc20 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -457,7 +457,7 @@ static bool lcl_TestFormat( SvxClipboardFormatItem& rFormats, const Transferable
void ScCellShell::GetPossibleClipboardFormats( SvxClipboardFormatItem& rFormats )
{
vcl::Window* pWin = GetViewData()->GetActiveWin();
- bool bDraw = ( ScDrawTransferObj::GetOwnClipboard( pWin ) != nullptr );
+ bool bDraw = ScDrawTransferObj::GetOwnClipboard( pWin ) != nullptr;
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pWin ) );
@@ -487,10 +487,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( nullptr ) )
+ if ( ScTransferObj::GetOwnClipboard( pWin ) || ScDrawTransferObj::GetOwnClipboard( pWin ) )
bPossible = true;
else
{
@@ -521,7 +521,7 @@ static bool lcl_IsCellPastePossible( const TransferableDataHelper& rData )
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 );
@@ -594,7 +594,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;
@@ -614,29 +614,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/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index f0851b5b092a..353849be4e10 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -388,7 +388,6 @@ void ScDrawView::DoCopy()
}
pTransferObj->CopyToClipboard( pViewData->GetActiveWin() ); // system clipboard
- SC_MOD()->SetClipObject( nullptr, pTransferObj ); // 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 ba37ef4077e1..712db2c511e7 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -290,7 +290,6 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b
}
pTransferObj->CopyToClipboard( GetActiveWin() );
- SC_MOD()->SetClipObject( pTransferObj, nullptr );
}
bDone = true;
@@ -399,7 +398,6 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b
}
pTransferObj->CopyToClipboard( GetActiveWin() ); // system clipboard
- SC_MOD()->SetClipObject( pTransferObj, nullptr ); // internal clipboard
}
bSuccess = true;
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index 9f9fe22f25e4..6a9c9f8a06c2 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -251,8 +251,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( nullptr );
+ ScDrawTransferObj* pTransferObj = ScDrawTransferObj::GetOwnClipboard( pWin );
if ( pDocument && pPage && pModelObj && ( pTransferObj || pDrawTrans ) )
{
const ScRangeListVector& rProtectedChartRangesVector(