diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-07-28 16:11:04 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-07-28 16:11:04 +0000 |
commit | 29da2639353762a64673d6ae5b32a36045caa7d3 (patch) | |
tree | 566ace5cd576d6890a8ddc2b353e98e9970c71dc /sfx2 | |
parent | 302383a919561946ac02473bdda8c425a7ca685e (diff) |
CWS-TOOLING: integrate CWS filepicker01
2009-07-03 13:21:25 +0200 cd r273690 : #i102319# Use GetSelectedFiles() instead of GetMPath() to retrieve a set of selected files
2009-07-01 14:27:56 +0200 cd r273582 : #i64800# Use ParseDisplayName correctly and don't allocate memory for an output parameter
2009-07-01 10:47:47 +0200 cd r273553 : #i102701# Make P1 fix for CWS filepicker01, too.
2009-06-29 11:58:09 +0200 cd r273463 : i102319# File picker should NOT set multi selection as a default.
2009-06-29 11:49:10 +0200 cd r273461 : #i102319# Use XFilePicker2 interface to retrieve files from multi selection
2009-06-26 15:42:43 +0200 cd r273423 : #i99759# Release solar mutex before blocking on execute() when using system file picker
2009-06-26 15:35:50 +0200 cd r273422 : #i99759# Don't release solar mutex in shutdown(). Must be done before calling execute()
2009-06-23 11:40:02 +0200 cd r273267 : #i95425# Fixed wrong initialization of TimeValue members
2009-06-23 10:35:20 +0200 cd r273262 : #i99759# Fix deadlock on Windows XP/2000 because of removing Picker Thread from sfx2. Now CAsyncEventNotifierThread releases the solar mutex before blocking
2009-06-22 11:59:15 +0200 cd r273209 : #i102948# Remove links from toolbar object when using lazy delete as the toolbar manager is now destroyed before the toolbar
2009-06-22 11:22:14 +0200 cd r273204 : #i99759# Don't use a new thread to call the file picker. As a consequence this thread is also calling Application::Yield() and therefore is fighting with the main thread for messages
2009-06-22 11:13:32 +0200 cd r273203 : #i99759# Solar mutex must be locked before calling Application::Yield()
2009-06-19 15:23:01 +0200 cd r273161 : #i102948# Remove/add decorated window from/into old/new parent decorated window list
2009-06-19 12:49:37 +0200 cd r273156 : #i101843# Use new COM based dialog implementation from Windows Vista on
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/sfx2/filedlghelper.hxx | 8 | ||||
-rw-r--r-- | sfx2/source/dialog/filedlghelper.cxx | 50 | ||||
-rw-r--r-- | sfx2/source/doc/docinsert.cxx | 26 |
3 files changed, 63 insertions, 21 deletions
diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx index c93af303158c..f9377f9908ea 100644 --- a/sfx2/inc/sfx2/filedlghelper.hxx +++ b/sfx2/inc/sfx2/filedlghelper.hxx @@ -229,8 +229,16 @@ public: void SetTitle( const String& rNewTitle ); String GetPath() const; + /** @deprected: Don't use this method to retrieve the selected files + There are file picker which can provide multiple selected file which belong + to different folders. As this method always provides the root folder for all selected + files this cannot work. + */ ::com::sun::star::uno::Sequence< ::rtl::OUString > GetMPath() const; + /** Provides the selected files with full path information */ + ::com::sun::star::uno::Sequence< ::rtl::OUString > GetSelectedFiles() const; + void AddFilter( const String& rFilterName, const String& rExtension ); void SetCurrentFilter( const String& rFilter ); diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index cf2ea488c126..da9bf4a8b04c 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1358,6 +1358,7 @@ sal_Int16 FileDialogHelper_Impl::implDoExecute() //On MacOSX the native file picker has to run in the primordial thread because of drawing issues //On Linux the native gtk file picker, when backed by gnome-vfs2, needs to be run in the same //primordial thread as the ucb gnome-vfs2 provider was initialized in. +/* #ifdef WNT if ( mbSystemPicker ) { @@ -1371,9 +1372,18 @@ sal_Int16 FileDialogHelper_Impl::implDoExecute() } else #endif +*/ { try { +#ifdef WNT + if ( mbSystemPicker ) + { + OReleaseSolarMutex aSolarMutex; + nRet = mxFileDlg->execute(); + } + else +#endif nRet = mxFileDlg->execute(); } catch( const Exception& ) @@ -2582,6 +2592,46 @@ Sequence < OUString > FileDialogHelper::GetMPath() const } // ------------------------------------------------------------------------ +Sequence< ::rtl::OUString > FileDialogHelper::GetSelectedFiles() const +{ + // a) the new way (optional!) + uno::Sequence< ::rtl::OUString > aResultSeq; + uno::Reference< XFilePicker2 > xPickNew(mpImp->mxFileDlg, UNO_QUERY); + if (xPickNew.is()) + { + aResultSeq = xPickNew->getSelectedFiles(); + } + // b) the olde way ... non optional. + else + { + uno::Reference< XFilePicker > xPickOld(mpImp->mxFileDlg, UNO_QUERY_THROW); + Sequence< OUString > lFiles = xPickOld->getFiles(); + ::sal_Int32 nFiles = lFiles.getLength(); + if ( nFiles > 1 ) + { + aResultSeq = Sequence< ::rtl::OUString >( nFiles-1 ); + + INetURLObject aPath( lFiles[0] ); + aPath.setFinalSlash(); + + for (::sal_Int32 i = 1; i < nFiles; i++) + { + if (i == 1) + aPath.Append( lFiles[i] ); + else + aPath.setName( lFiles[i] ); + + aResultSeq[i-1] = ::rtl::OUString(aPath.GetMainURL( INetURLObject::NO_DECODE )); + } + } + else + aResultSeq = lFiles; + } + + return aResultSeq; +} + +// ------------------------------------------------------------------------ String FileDialogHelper::GetDisplayDirectory() const { return mpImp->getPath(); diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx index 8fae29a1847c..ecd9ae7aee42 100644 --- a/sfx2/source/doc/docinsert.cxx +++ b/sfx2/source/doc/docinsert.cxx @@ -177,33 +177,17 @@ void impl_FillURLList( sfx2::FileDialogHelper* _pFileDlg, SvStringsDtor*& _rpURL { DBG_ASSERT( _pFileDlg, "DocumentInserter::fillURLList(): invalid file dialog" ); DBG_ASSERT( !_rpURLList, "DocumentInserter::fillURLList(): URLList already exists" ); - Sequence < ::rtl::OUString > aPathSeq = _pFileDlg->GetMPath(); + Sequence < ::rtl::OUString > aPathSeq = _pFileDlg->GetSelectedFiles(); if ( aPathSeq.getLength() ) { _rpURLList = new SvStringsDtor; - if ( aPathSeq.getLength() == 1 ) + for ( USHORT i = 0; i < aPathSeq.getLength(); ++i ) { - ::rtl::OUString sFileURL( aPathSeq[0] ); - String* pURL = new String( sFileURL ); - _rpURLList->Insert( pURL, 0 ); - } - else - { - INetURLObject aPathObj( aPathSeq[0] ); - aPathObj.setFinalSlash(); - - for ( USHORT i = 1; i < aPathSeq.getLength(); ++i ) - { - if ( i == 1 ) - aPathObj.Append( aPathSeq[i] ); - else - aPathObj.setName( aPathSeq[i] ); - - String* pURL = new String( aPathObj.GetMainURL( INetURLObject::NO_DECODE ) ); - _rpURLList->Insert( pURL, _rpURLList->Count() ); - } + INetURLObject aPathObj( aPathSeq[i] ); + String* pURL = new String( aPathObj.GetMainURL( INetURLObject::NO_DECODE ) ); + _rpURLList->Insert( pURL, _rpURLList->Count() ); } } } |