diff options
author | Muhammet Kara <muhammet.kara@collabora.com> | 2019-07-02 23:25:00 +0300 |
---|---|---|
committer | Muhammet Kara <muhammet.kara@collabora.com> | 2019-07-10 16:48:09 +0200 |
commit | 1fedfa62784a4f61b0cf6cede29634dc863a7b60 (patch) | |
tree | a2c0fb351c07c5ceb050b0e588431d1c604337e9 /sw/source/uibase/shells | |
parent | 74d56d44804efa3424cff3434d2baf00c60b3cd5 (diff) |
Prepare PasteSpecial for Async-ness (sw, basesh.cxx)
This change is needed to make the paste special dialog async exec
because the current design relies on return values of inner
functions/methods while moving on. After this patch, the dialog creation
and execution will not be so deep, so that it will be able to be
converted to async exec in the usual way.
The duplication in SvPasteObjectDialog::PreGetFormat() coming from
SvPasteObjectDialog::GetFormat() will go away when the conversion is
complete for all modules. It is only temporarily needed.
Change-Id: I55e8aee39c41be6035c89f217f90f79720f32196
Reviewed-on: https://gerrit.libreoffice.org/75016
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
Diffstat (limited to 'sw/source/uibase/shells')
-rw-r--r-- | sw/source/uibase/shells/basesh.cxx | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index f5a59dbb9e0a..dc5e0c5be334 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -113,6 +113,8 @@ #include <comphelper/scopeguard.hxx> #include <comphelper/lok.hxx> +#include <svx/svxdlg.hxx> + #include <SwStyleNameMapper.hxx> #include <poolfmt.hxx> #include <shellres.hxx> @@ -384,21 +386,41 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq) SotClipboardFormatId nFormatId = SotClipboardFormatId::NONE; rReq.Ignore(); bIgnore = true; - if(SwTransferable::PasteSpecial( rSh, aDataHelper, nFormatId )) + bool bRet = false; + + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + VclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog( rReq.GetFrameWeld() )); + + // Prepare the dialog + SwTransferable::PrePasteSpecial(rSh, aDataHelper, pDlg); + pDlg->PreGetFormat(aDataHelper); + + + if (pDlg->Execute() == RET_OK) { - SfxViewFrame* pViewFrame = pView->GetViewFrame(); - uno::Reference< frame::XDispatchRecorder > xRecorder = - pViewFrame->GetBindings().GetRecorder(); - if(xRecorder.is()) { - SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS ); - aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, static_cast<sal_uInt32>(nFormatId) ) ); - aReq.Done(); + nFormatId = pDlg->GetFormatOnly(); + + if( nFormatId != SotClipboardFormatId::NONE ) + bRet = SwTransferable::PasteFormat( rSh, aDataHelper, nFormatId ); + + if (bRet) + { + SfxViewFrame* pViewFrame = pView->GetViewFrame(); + uno::Reference< frame::XDispatchRecorder > xRecorder = + pViewFrame->GetBindings().GetRecorder(); + if(xRecorder.is()) { + SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS ); + aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, static_cast<sal_uInt32>(nFormatId) ) ); + aReq.Done(); + } } + + if (rSh.IsFrameSelected() || rSh.IsObjSelected()) + rSh.EnterSelFrameMode(); + pView->AttrChangedNotify( &rSh ); } - if (rSh.IsFrameSelected() || rSh.IsObjSelected()) - rSh.EnterSelFrameMode(); - pView->AttrChangedNotify( &rSh ); + pDlg->disposeOnce(); } else return; |