diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/filedlghelper.cxx | 35 | ||||
-rw-r--r-- | sfx2/source/dialog/filedlgimpl.hxx | 3 |
2 files changed, 24 insertions, 14 deletions
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 23c2b097a23c..918b9c1869b7 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -807,6 +807,19 @@ static bool lcl_isSystemFilePicker( const uno::Reference< XExecutableDialog >& _ namespace { +bool lcl_isAsyncFilePicker( const uno::Reference< XExecutableDialog >& _rxFP ) +{ + try + { + uno::Reference<XAsynchronousExecutableDialog> xSI(_rxFP, UNO_QUERY); + return xSI.is(); + } + catch( const Exception& ) + { + } + return false; +} + enum open_or_save_t {OPEN, SAVE, UNDEFINED}; } @@ -917,6 +930,7 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( // create the picker component mxFileDlg.set(xFactory->createInstance( aService ), css::uno::UNO_QUERY); mbSystemPicker = lcl_isSystemFilePicker( mxFileDlg ); + mbAsyncPicker = lcl_isAsyncFilePicker(mxFileDlg); uno::Reference< XInitialization > xInit( mxFileDlg, UNO_QUERY ); @@ -1328,23 +1342,18 @@ void FileDialogHelper_Impl::implStartExecute() { DBG_ASSERT( mxFileDlg.is(), "invalid file dialog" ); + assert(mbAsyncPicker); preExecute(); - if ( mbSystemPicker ) + try { + uno::Reference< XAsynchronousExecutableDialog > xAsyncDlg( mxFileDlg, UNO_QUERY ); + if ( xAsyncDlg.is() ) + xAsyncDlg->startExecuteModal( this ); } - else + catch( const Exception& ) { - try - { - uno::Reference< XAsynchronousExecutableDialog > xAsyncDlg( mxFileDlg, UNO_QUERY ); - if ( xAsyncDlg.is() ) - xAsyncDlg->startExecuteModal( this ); - } - catch( const Exception& ) - { - TOOLS_WARN_EXCEPTION( "sfx.dialog", "FileDialogHelper_Impl::implDoExecute" ); - } + TOOLS_WARN_EXCEPTION( "sfx.dialog", "FileDialogHelper_Impl::implDoExecute" ); } } @@ -2592,7 +2601,7 @@ void FileDialogHelper::StartExecuteModal( const Link<FileDialogHelper*,void>& rE { m_aDialogClosedLink = rEndDialogHdl; m_nError = ERRCODE_NONE; - if ( mpImpl->isSystemFilePicker() ) + if (!mpImpl->isAsyncFilePicker()) Application::PostUserEvent( LINK( this, FileDialogHelper, ExecuteSystemFilePicker ) ); else mpImpl->implStartExecute(); diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx index 15fc3b2decbb..01411f23e9e4 100644 --- a/sfx2/source/dialog/filedlgimpl.hxx +++ b/sfx2/source/dialog/filedlgimpl.hxx @@ -87,6 +87,7 @@ namespace sfx2 bool mbDeleteMatcher : 1; bool mbInsert : 1; bool mbSystemPicker : 1; + bool mbAsyncPicker : 1; bool mbPwdCheckBoxState : 1; bool mbSelection : 1; bool mbSelectionEnabled : 1; @@ -206,7 +207,7 @@ namespace sfx2 void SetContext( FileDialogHelper::Context _eNewContext ); OUString getInitPath( const OUString& _rFallback, const sal_Int32 _nFallbackToken ); - bool isSystemFilePicker() const { return mbSystemPicker; } + bool isAsyncFilePicker() const { return mbAsyncPicker; } bool isPasswordEnabled() const { return mbIsPwdEnabled; } css::uno::Reference<css::awt::XWindow> GetFrameInterface(); |