diff options
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; |