Kaydet (Commit) 8f9f66e8 authored tarafından Henry Castro's avatar Henry Castro

sc: simplify ScModule::GetClipDoc

Change-Id: I36a79a41b989d37efc35a9f9b4bebca9bdaf9ee9
Reviewed-on: https://gerrit.libreoffice.org/54935Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarHenry Castro <hcastro@collabora.com>
üst 92e6be66
...@@ -662,28 +662,22 @@ void ScModule::SetDragJump( ...@@ -662,28 +662,22 @@ void ScModule::SetDragJump(
ScDocument* ScModule::GetClipDoc() ScDocument* ScModule::GetClipDoc()
{ {
// called from document // called from document
SfxViewFrame* pViewFrame = nullptr;
ScTabViewShell* pViewShell = nullptr; ScTabViewShell* pViewShell = nullptr;
const ScTransferObj* pObj = nullptr; css::uno::Reference<css::datatransfer::XTransferable2> xTransferable;
if ((pViewShell = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current()))) if ((pViewShell = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current())))
pObj = ScTransferObj::GetOwnClipboard(pViewShell->GetClipData()); xTransferable.set(pViewShell->GetClipData());
else if ((pViewShell = dynamic_cast<ScTabViewShell*>(SfxViewShell::GetFirst()))) else if ((pViewShell = dynamic_cast<ScTabViewShell*>(SfxViewShell::GetFirst())))
pObj = ScTransferObj::GetOwnClipboard(pViewShell->GetClipData()); xTransferable.set(pViewShell->GetClipData());
else else if ((pViewFrame = SfxViewFrame::GetFirst()))
{ {
css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipboard; css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipboard =
pViewFrame->GetWindow().GetClipboard();
if (SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst()) xTransferable.set(xClipboard.is() ? xClipboard->getContents() : nullptr, css::uno::UNO_QUERY);
xClipboard = pViewFrame->GetWindow().GetClipboard();
if (xClipboard.is())
{
css::uno::Reference<css::datatransfer::XTransferable2> xTransferable(
xClipboard->getContents(), css::uno::UNO_QUERY);
pObj = ScTransferObj::GetOwnClipboard(xTransferable);
}
} }
const ScTransferObj* pObj = ScTransferObj::GetOwnClipboard(xTransferable);
if (pObj) if (pObj)
{ {
ScDocument* pDoc = pObj->GetDocument(); ScDocument* pDoc = pObj->GetDocument();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment