From b0cc179a728603d62fd62595f039d2d856f8c9c3 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 25 Jul 2019 10:30:56 +0100 Subject: add XInitialization to allow setting explicit dialog parent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Icc2626b6b3defeb6c02a43cee14cdb97dc573870 Reviewed-on: https://gerrit.libreoffice.org/76290 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sw/source/uibase/uiview/uivwimp.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'sw/source/uibase') diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx index 01a48a3cba35..7b2130939798 100644 --- a/sw/source/uibase/uiview/uivwimp.cxx +++ b/sw/source/uibase/uiview/uivwimp.cxx @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -128,6 +129,19 @@ void SwView_Impl::ExecuteScan( SfxRequest& rReq ) { Reference< XEventListener > xLstner = &rListener; ScannerContext aContext( aContexts.getConstArray()[ 0 ] ); + + Reference xInit(xScanMgr, UNO_QUERY); + if (xInit.is()) + { + // initialize dialog + weld::Window* pWindow = rReq.GetFrameWeld(); + uno::Sequence aSeq(comphelper::InitAnyPropertySequence( + { + {"ParentWindow", pWindow ? uno::Any(pWindow->GetXWindow()) : uno::Any(Reference())} + })); + xInit->initialize( aSeq ); + } + bDone = xScanMgr->configureScannerAndScan( aContext, xLstner ); } } @@ -170,7 +184,7 @@ void SwView_Impl::ExecuteScan( SfxRequest& rReq ) if( !bDone ) { - std::unique_ptr xBox(Application::CreateMessageDialog(nullptr, + std::unique_ptr xBox(Application::CreateMessageDialog(rReq.GetFrameWeld(), VclMessageType::Info, VclButtonsType::Ok, SwResId(STR_SCAN_NOSOURCE))); xBox->run(); -- cgit