[Libreoffice-commits] core.git: sc/inc sc/source
Caolán McNamara
caolanm at redhat.com
Thu Apr 5 14:39:43 UTC 2018
sc/inc/tablink.hxx | 7 +++++--
sc/source/ui/docshell/tablink.cxx | 36 ++++++++++++++++++++++++------------
sc/source/ui/miscdlgs/linkarea.cxx | 2 +-
3 files changed, 30 insertions(+), 15 deletions(-)
New commits:
commit 2b56ca4436f01db069c836daa7b7b4298349fc66
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Apr 5 12:46:53 2018 +0100
set external data dialog as parent for password dialogs of loading docs
Change-Id: I364b040d0beaab7c64b779dd664a625b30de22cf
Reviewed-on: https://gerrit.libreoffice.org/52457
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/inc/tablink.hxx b/sc/inc/tablink.hxx
index 043f10c1b708..54b13940db67 100644
--- a/sc/inc/tablink.hxx
+++ b/sc/inc/tablink.hxx
@@ -30,6 +30,8 @@
class ScDocShell;
struct TableLink_Impl;
+namespace weld { class Window; }
+
class ScTableLink : public ::sfx2::SvBaseLink, public ScRefreshTimer
{
private:
@@ -82,7 +84,7 @@ private:
public:
ScDocumentLoader( const OUString& rFileName,
OUString& rFilterName, OUString& rOptions,
- sal_uInt32 nRekCnt = 0, bool bWithInteraction = false );
+ sal_uInt32 nRekCnt = 0, weld::Window* pInteractionParent = nullptr );
~ScDocumentLoader();
ScDocument* GetDocument();
ScDocShell* GetDocShell() { return pDocShell; }
@@ -94,7 +96,8 @@ public:
/** Create SfxMedium for stream read with SfxFilter and filter options set
at the medium's SfxItemSet.
*/
- static SfxMedium* CreateMedium( const OUString& rFileName, std::shared_ptr<const SfxFilter> const & pFilter, const OUString& rOptions );
+ static SfxMedium* CreateMedium(const OUString& rFileName, std::shared_ptr<const SfxFilter> const & pFilter,
+ const OUString& rOptions, weld::Window* pInteractionParent = nullptr);
static OUString GetOptions( const SfxMedium& rMedium );
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 224e88a7f3a3..8c0e3d5c6c1a 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -19,6 +19,8 @@
#include <sal/config.h>
+#include <com/sun/star/task/InteractionHandler.hpp>
+
#include <o3tl/make_unique.hxx>
#include <sfx2/sfxsids.hrc>
#include <sfx2/app.hxx>
@@ -27,7 +29,9 @@
#include <sfx2/docfile.hxx>
#include <sfx2/docfilt.hxx>
#include <sfx2/fcontnr.hxx>
+#include <sfx2/frame.hxx>
#include <sfx2/linkmgr.hxx>
+#include <vcl/weld.hxx>
#include <tools/urlobj.hxx>
#include <unotools/transliterationwrapper.hxx>
#include <unotools/configmgr.hxx>
@@ -488,34 +492,42 @@ void ScDocumentLoader::RemoveAppPrefix( OUString& rFilterName )
}
SfxMedium* ScDocumentLoader::CreateMedium( const OUString& rFileName, std::shared_ptr<const SfxFilter> const & pFilter,
- const OUString& rOptions )
+ const OUString& rOptions, weld::Window* pInteractionParent )
{
// Always create SfxItemSet so ScDocShell can set options.
SfxItemSet* pSet = new SfxAllItemSet( SfxGetpApp()->GetPool() );
if ( !rOptions.isEmpty() )
pSet->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, rOptions ) );
- return new SfxMedium( rFileName, StreamMode::STD_READ, pFilter, pSet );
+ if (pInteractionParent)
+ {
+ css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
+ css::uno::Reference<css::task::XInteractionHandler> xIHdl(css::task::InteractionHandler::createWithParent(xContext,
+ pInteractionParent->GetXWindow()), css::uno::UNO_QUERY_THROW);
+ pSet->Put(SfxUnoAnyItem(SID_INTERACTIONHANDLER, makeAny(xIHdl)));
+ }
+
+ SfxMedium *pRet = new SfxMedium( rFileName, StreamMode::STD_READ, pFilter, pSet );
+ if (pInteractionParent)
+ pRet->UseInteractionHandler(true); // to enable the filter options dialog
+ return pRet;
}
-ScDocumentLoader::ScDocumentLoader( const OUString& rFileName,
- OUString& rFilterName, OUString& rOptions,
- sal_uInt32 nRekCnt, bool bWithInteraction ) :
- pDocShell(nullptr),
- pMedium(nullptr)
+ScDocumentLoader::ScDocumentLoader(const OUString& rFileName,
+ OUString& rFilterName, OUString& rOptions,
+ sal_uInt32 nRekCnt, weld::Window* pInteractionParent)
+ : pDocShell(nullptr)
+ , pMedium(nullptr)
{
if ( rFilterName.isEmpty() )
- GetFilterName( rFileName, rFilterName, rOptions, true, bWithInteraction );
+ GetFilterName(rFileName, rFilterName, rOptions, true, pInteractionParent != nullptr);
std::shared_ptr<const SfxFilter> pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( rFilterName );
- pMedium = CreateMedium( rFileName, pFilter, rOptions);
+ pMedium = CreateMedium(rFileName, pFilter, rOptions, pInteractionParent);
if ( pMedium->GetError() != ERRCODE_NONE )
return ;
- if ( bWithInteraction )
- pMedium->UseInteractionHandler( true ); // to enable the filter options dialog
-
pDocShell = new ScDocShell( SfxModelFlags::EMBEDDED_OBJECT | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS );
aRef = pDocShell;
diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx
index c66534c91839..e984045ab5ed 100644
--- a/sc/source/ui/miscdlgs/linkarea.cxx
+++ b/sc/source/ui/miscdlgs/linkarea.cxx
@@ -136,7 +136,7 @@ void ScLinkedAreaDlg::LoadDocument( const OUString& rFile, const OUString& rFilt
SfxErrorContext aEc( ERRCTX_SFX_OPENDOC, rFile );
- ScDocumentLoader aLoader( rFile, aNewFilter, aNewOptions, 0, true ); // with interaction
+ ScDocumentLoader aLoader( rFile, aNewFilter, aNewOptions, 0, GetFrameWeld() ); // with interaction
pSourceShell = aLoader.GetDocShell();
if ( pSourceShell )
{
More information about the Libreoffice-commits
mailing list