diff options
author | Henry Castro <hcastro@collabora.com> | 2018-06-26 23:32:41 -0400 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-06-27 13:44:07 +0200 |
commit | b9652803096b68a33702601aac52e78c8a4250c6 (patch) | |
tree | 1ed7822221824417039126b7db04a8b37ebeaee8 /sc/source/ui/view/cellsh.cxx | |
parent | b262e6e5da0c2e66e00cd6d68d7c2df11a34ff5c (diff) |
tdf#118308: Incorrect Paste Special dialog when ...
pasting content from another cell
In tiled rendering case (headless) each window has its own clipboard,
otherwise exists a unique clipboard (UNO service).
Change-Id: I7d5d0b085faeaffa3fc0a80914fbe9349f4aa402
Reviewed-on: https://gerrit.libreoffice.org/56508
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/ui/view/cellsh.cxx')
-rw-r--r-- | sc/source/ui/view/cellsh.cxx | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index c247fdbf3332..cda4214c4d36 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -447,7 +447,7 @@ static bool lcl_TestFormat( SvxClipboardFormatItem& rFormats, const Transferable void ScCellShell::GetPossibleClipboardFormats( SvxClipboardFormatItem& rFormats ) { vcl::Window* pWin = GetViewData()->GetActiveWin(); - bool bDraw = ScDrawTransferObj::GetOwnClipboard(GetViewData()->GetViewShell()->GetClipData()) != nullptr; + bool bDraw = ScDrawTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(pWin)) != nullptr; TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pWin ) ); @@ -478,10 +478,11 @@ void ScCellShell::GetPossibleClipboardFormats( SvxClipboardFormatItem& rFormats // insert, insert contents -static bool lcl_IsCellPastePossible( const TransferableDataHelper& rData, ScTabViewShell* pViewShell ) +static bool lcl_IsCellPastePossible( const TransferableDataHelper& rData ) { bool bPossible = false; - if ( ScTransferObj::GetOwnClipboard(pViewShell->GetClipData()) || ScDrawTransferObj::GetOwnClipboard(pViewShell->GetClipData()) ) + css::uno::Reference< css::datatransfer::XTransferable2 > xTransferable(rData.GetXTransferable(), css::uno::UNO_QUERY); + if ( ScTransferObj::GetOwnClipboard(xTransferable) || ScDrawTransferObj::GetOwnClipboard(xTransferable) ) bPossible = true; else { @@ -520,19 +521,7 @@ bool ScCellShell::HasClipboardFormat( SotClipboardFormatId nFormatId ) IMPL_LINK( ScCellShell, ClipboardChanged, TransferableDataHelper*, pDataHelper, void ) { - ScTabViewShell* pViewShell = GetViewData()->GetViewShell(); - css::uno::Reference<css::datatransfer::XTransferable2> xOldTransfer(pViewShell->GetClipData()); - css::uno::Reference<css::datatransfer::XTransferable2> xNewTransfer(pDataHelper->GetXTransferable(), css::uno::UNO_QUERY); - - if ( xNewTransfer.get() != xOldTransfer.get() ) - { - if ( ScTransferObj::GetOwnClipboard(xNewTransfer) || ScDrawTransferObj::GetOwnClipboard(xNewTransfer) ) - pViewShell->SetClipData(xNewTransfer); - else - pViewShell->SetClipData(css::uno::Reference<css::datatransfer::XTransferable2>()); - } - - bPastePossible = lcl_IsCellPastePossible( *pDataHelper, pViewShell ); + bPastePossible = lcl_IsCellPastePossible( *pDataHelper ); SfxBindings& rBindings = GetViewData()->GetBindings(); rBindings.Invalidate( SID_PASTE ); @@ -567,7 +556,7 @@ bool checkDestRanges(ScViewData& rViewData) if (!pWin) return false; - const ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard(rViewData.GetViewShell()->GetClipData()); + const ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(pWin)); if (!pOwnClip) // If it's not a Calc document, we won't be picky. return true; @@ -606,7 +595,7 @@ void ScCellShell::GetClipState( SfxItemSet& rSet ) // get initial state TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pWin ) ); - bPastePossible = lcl_IsCellPastePossible( aDataHelper, GetViewData()->GetViewShell() ); + bPastePossible = lcl_IsCellPastePossible( aDataHelper ); } bool bDisable = !bPastePossible; |