summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2015-07-15 13:24:07 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-09-15 06:17:47 +0000
commit5bbff06137a87e97260a188f6745cf2a227f15cf (patch)
tree9934fcebcc6daff6c47a4f3b50bcc6398cbe1e6a /fpicker
parent2639eadce4c9ccead9112a6893b5e9e2e0fefd78 (diff)
[API CHANGE] XFilePicker2/3 changes for multiselection
In order to use GetSelectedFiles (in XFilePicker2) instead of GetFiles (in XFilePicker), here are some api changes before: XFilePicker3 inherits from XFilePicker XFilePicker2 is not a published interface after: XFilePicker3 inherits from XFilePicker2 XFilePicker2 is a published interface + adapt Uno Implementations Change-Id: If44afaa7236f08bc2b814f91eda5bfad333dd799 Reviewed-on: https://gerrit.libreoffice.org/17068 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/aqua/SalAquaFilePicker.hxx3
-rw-r--r--fpicker/source/aqua/SalAquaFilePicker.mm24
-rw-r--r--fpicker/source/office/OfficeFilePicker.cxx32
-rw-r--r--fpicker/source/office/OfficeFilePicker.hxx1
-rw-r--r--fpicker/source/win32/filepicker/FilePicker.cxx2
-rw-r--r--fpicker/source/win32/filepicker/FilePicker.hxx4
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePicker.cxx9
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePicker.hxx7
8 files changed, 36 insertions, 46 deletions
diff --git a/fpicker/source/aqua/SalAquaFilePicker.hxx b/fpicker/source/aqua/SalAquaFilePicker.hxx
index 9a32f31f95c4..f018f86df25f 100644
--- a/fpicker/source/aqua/SalAquaFilePicker.hxx
+++ b/fpicker/source/aqua/SalAquaFilePicker.hxx
@@ -83,6 +83,9 @@ public:
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getFiles( )
throw( ::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSelectedFiles( )
+ throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+
// XFilterManager functions
virtual void SAL_CALL appendFilter( const OUString& aTitle, const OUString& aFilter )
diff --git a/fpicker/source/aqua/SalAquaFilePicker.mm b/fpicker/source/aqua/SalAquaFilePicker.mm
index 431381843150..5ee58921e7a6 100644
--- a/fpicker/source/aqua/SalAquaFilePicker.mm
+++ b/fpicker/source/aqua/SalAquaFilePicker.mm
@@ -305,6 +305,20 @@ uno::Sequence<rtl::OUString> SAL_CALL SalAquaFilePicker::getFiles() throw( uno::
{
DBG_PRINT_ENTRY(CLASS_NAME, __func__);
+ uno::Sequence< rtl::OUString > aSelectedFiles = getSelectedFiles();
+ // multiselection doesn't really work with getFiles
+ // so just retrieve the first url
+ if (aSelectedFiles.getLength() > 1)
+ aSelectedFiles.realloc(1);
+
+ DBG_PRINT_EXIT(CLASS_NAME, __func__);
+ return aSelectedFiles;
+}
+
+uno::Sequence<rtl::OUString> SAL_CALL SalAquaFilePicker::getSelectedFiles() throw( uno::RuntimeException, std::exception )
+{
+ DBG_PRINT_ENTRY(CLASS_NAME, __func__);
+
SolarMutexGuard aGuard;
#if HAVE_FEATURE_MACOSX_SANDBOX
@@ -319,11 +333,6 @@ uno::Sequence<rtl::OUString> SAL_CALL SalAquaFilePicker::getFiles() throw( uno::
#endif
// OSL_TRACE("starting work");
- /*
- * If more than one file is selected in an OpenDialog, then the first result
- * is the directory and the remaining results contain just the files' names
- * without the basedir path.
- */
NSArray *files = nil;
if (m_nDialogType == NAVIGATIONSERVICES_OPEN) {
files = [(NSOpenPanel*)m_pDialog URLs];
@@ -335,11 +344,6 @@ uno::Sequence<rtl::OUString> SAL_CALL SalAquaFilePicker::getFiles() throw( uno::
long nFiles = [files count];
SAL_INFO("fpicker.aqua", "# of items: " << nFiles);
- // multiselection doesn't really work
- // so just retrieve the first url
- if (nFiles > 1)
- nFiles = 1;
-
uno::Sequence< rtl::OUString > aSelectedFiles(nFiles);
for(long nIndex = 0; nIndex < nFiles; nIndex += 1)
diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx
index f52cdfe112ac..134b661b78a9 100644
--- a/fpicker/source/office/OfficeFilePicker.cxx
+++ b/fpicker/source/office/OfficeFilePicker.cxx
@@ -591,7 +591,7 @@ OUString SAL_CALL SvtFilePicker::getDisplayDirectory() throw( RuntimeException,
return m_aDisplayDirectory;
}
-Sequence< OUString > SAL_CALL SvtFilePicker::getFiles() throw( RuntimeException, std::exception )
+Sequence< OUString > SAL_CALL SvtFilePicker::getSelectedFiles() throw( RuntimeException, std::exception )
{
checkAlive();
@@ -602,31 +602,25 @@ Sequence< OUString > SAL_CALL SvtFilePicker::getFiles() throw( RuntimeException,
return aEmpty;
}
- // if there is more than one path we have to return the path to the
- // files first and then the list of the selected entries
-
std::vector<OUString> aPathList(getDialog()->GetPathList());
size_t nCount = aPathList.size();
- size_t nTotal = nCount > 1 ? nCount+1: nCount;
- Sequence< OUString > aPath( nTotal );
+ Sequence< OUString > aFiles(nCount);
- if ( nCount == 1 )
- aPath[0] = aPathList[0];
- else if ( nCount > 1 )
+ for(size_t i = 0; i < aPathList.size(); ++i)
{
- INetURLObject aObj(aPathList[0]);
- aObj.removeSegment();
- aPath[0] = aObj.GetMainURL( INetURLObject::NO_DECODE );
-
- for(size_t i = 0; i < aPathList.size(); ++i)
- {
- aObj.SetURL(aPathList[i]);
- aPath[i + 1] = aObj.getName();
- }
+ aFiles[i] = aPathList[i];
}
- return aPath;
+ return aFiles;
+}
+
+Sequence< OUString > SAL_CALL SvtFilePicker::getFiles() throw( RuntimeException, std::exception )
+{
+ Sequence< OUString > aFiles = getSelectedFiles();
+ if (aFiles.getLength() > 1)
+ aFiles.realloc(1);
+ return aFiles;
}
diff --git a/fpicker/source/office/OfficeFilePicker.hxx b/fpicker/source/office/OfficeFilePicker.hxx
index df6ad1c7b195..3fa7c6e62fa4 100644
--- a/fpicker/source/office/OfficeFilePicker.hxx
+++ b/fpicker/source/office/OfficeFilePicker.hxx
@@ -119,6 +119,7 @@ public:
virtual void SAL_CALL setDisplayDirectory( const OUString& aDirectory ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual OUString SAL_CALL getDisplayDirectory() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getFiles() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+ virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSelectedFiles() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
// XFilePickerControlAccess functions
diff --git a/fpicker/source/win32/filepicker/FilePicker.cxx b/fpicker/source/win32/filepicker/FilePicker.cxx
index fda664ac5496..d80c74020e25 100644
--- a/fpicker/source/win32/filepicker/FilePicker.cxx
+++ b/fpicker/source/win32/filepicker/FilePicker.cxx
@@ -372,7 +372,7 @@ uno::Sequence<OUString> SAL_CALL CFilePicker::getFiles() throw(uno::RuntimeExcep
-uno::Sequence< OUString > SAL_CALL CFilePicker::getSelectedFiles() throw (uno::RuntimeException)
+uno::Sequence< OUString > SAL_CALL CFilePicker::getSelectedFiles() throw (uno::RuntimeException, std::exception)
{
OSL_ASSERT(0 != m_pImpl.get());
osl::MutexGuard aGuard(m_aMutex);
diff --git a/fpicker/source/win32/filepicker/FilePicker.hxx b/fpicker/source/win32/filepicker/FilePicker.hxx
index 0ba721420fd8..c6231526195c 100644
--- a/fpicker/source/win32/filepicker/FilePicker.hxx
+++ b/fpicker/source/win32/filepicker/FilePicker.hxx
@@ -25,7 +25,6 @@
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
#include <com/sun/star/ui/dialogs/XFilePreview.hpp>
@@ -46,7 +45,6 @@ protected:
};
typedef ::cppu::WeakComponentImplHelper <
- ::com::sun::star::ui::dialogs::XFilePicker2,
::com::sun::star::ui::dialogs::XFilePicker3,
::com::sun::star::ui::dialogs::XFilePickerControlAccess,
::com::sun::star::ui::dialogs::XFilePreview,
@@ -97,7 +95,7 @@ public:
// XFilePicker2 functions
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSelectedFiles( )
- throw (::com::sun::star::uno::RuntimeException);
+ throw (::com::sun::star::uno::RuntimeException, std::exception);
// XFilterManager functions
diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
index 2411c74d2965..4970b4e3dbca 100644
--- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
@@ -256,12 +256,7 @@ OUString SAL_CALL VistaFilePicker::getDisplayDirectory()
css::uno::Sequence< OUString > SAL_CALL VistaFilePicker::getFiles()
throw(css::uno::RuntimeException)
{
- RequestRef rRequest(new Request());
- rRequest->setRequest (VistaFilePickerImpl::E_GET_SELECTED_FILES);
-
- m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::BLOCKED);
-
- css::uno::Sequence< OUString > lFiles = rRequest->getArgumentOrDefault(PROP_SELECTED_FILES, css::uno::Sequence< OUString >());
+ css::uno::Sequence< OUString > lFiles = getSelectedFiles();
// multiselection doesn't really work
// so just retrieve the first url
if (lFiles.getLength() > 1)
@@ -272,7 +267,7 @@ css::uno::Sequence< OUString > SAL_CALL VistaFilePicker::getFiles()
css::uno::Sequence< OUString > SAL_CALL VistaFilePicker::getSelectedFiles()
- throw(css::uno::RuntimeException)
+ throw(css::uno::RuntimeException, std::exception)
{
RequestRef rRequest(new Request());
rRequest->setRequest (VistaFilePickerImpl::E_GET_SELECTED_FILES);
diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.hxx b/fpicker/source/win32/filepicker/VistaFilePicker.hxx
index f133303609a6..01b6da335893 100644
--- a/fpicker/source/win32/filepicker/VistaFilePicker.hxx
+++ b/fpicker/source/win32/filepicker/VistaFilePicker.hxx
@@ -27,7 +27,6 @@
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
#include <com/sun/star/ui/dialogs/XFilePreview.hpp>
@@ -45,7 +44,6 @@ namespace vista{
typedef ::cppu::WeakComponentImplHelper<
- css::ui::dialogs::XFilePicker2,
css::ui::dialogs::XFilePicker3,
css::ui::dialogs::XFilePickerControlAccess,
css::ui::dialogs::XFilePreview,
@@ -112,12 +110,9 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL getFiles( )
throw( css::uno::RuntimeException );
-
// XFilePicker2 functions
-
-
virtual css::uno::Sequence< OUString > SAL_CALL getSelectedFiles( )
- throw( css::uno::RuntimeException );
+ throw( css::uno::RuntimeException, std::exception );
// XFilterManager functions