diff options
Diffstat (limited to 'sc/source/ui/view/viewfun3.cxx')
-rw-r--r-- | sc/source/ui/view/viewfun3.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 0c675ecd6c12..4fab715aafd5 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -37,6 +37,9 @@ #include <sot/exchange.hxx> #include <memory> +#include <comphelper/lok.hxx> +#include <sfx2/lokhelper.hxx> + #include "attrib.hxx" #include "patattr.hxx" #include "dociter.hxx" @@ -224,6 +227,14 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b // and lose the 'if' above aClipParam.setSourceDocID( pDoc->GetDocumentID() ); + // This is only a workaround, which doesn't allow to paste content + // in one view which has been copied in a different view. + // TODO: implement a solution providing one clipboard per view + if (comphelper::LibreOfficeKit::isActive()) + { + aClipParam.setSourceView(GetViewData().GetViewShell()); + } + if (SfxObjectShell* pObjectShell = pDoc->GetDocumentShell()) { // Copy document properties from pObjectShell to pClipDoc (to its clip options, as it has no object shell). @@ -862,6 +873,20 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, if (GetViewData().SelectionForbidsCellFill()) return false; + // This is only a workaround, which doesn't allow to paste content + // in one view which has been copied in a different view. + // TODO: implement a solution providing one clipboard per view + if (comphelper::LibreOfficeKit::isActive()) + { + ScTabViewShell* pThisView = GetViewData().GetViewShell(); + ScTabViewShell* pSourceView = dynamic_cast<ScTabViewShell*>(pClipDoc->GetClipParam().getSourceView()); + + if (pThisView && pSourceView && pThisView != pSourceView) + { + return false; + } + } + // undo: save all or no content InsertDeleteFlags nContFlags = InsertDeleteFlags::NONE; if (nFlags & InsertDeleteFlags::CONTENTS) |