[Libreoffice-commits] core.git: fpicker/source offapi/com offapi/type_reference vcl/unx

Julien Nabet serval2412 at yahoo.fr
Mon Sep 14 23:18:12 PDT 2015


 fpicker/source/aqua/SalAquaFilePicker.hxx           |    3 +
 fpicker/source/aqua/SalAquaFilePicker.mm            |   24 ++++++++-------
 fpicker/source/office/OfficeFilePicker.cxx          |   32 ++++++++------------
 fpicker/source/office/OfficeFilePicker.hxx          |    1 
 fpicker/source/win32/filepicker/FilePicker.cxx      |    2 -
 fpicker/source/win32/filepicker/FilePicker.hxx      |    4 --
 fpicker/source/win32/filepicker/VistaFilePicker.cxx |    9 +----
 fpicker/source/win32/filepicker/VistaFilePicker.hxx |    7 ----
 offapi/com/sun/star/ui/dialogs/XFilePicker2.idl     |    2 -
 offapi/com/sun/star/ui/dialogs/XFilePicker3.idl     |    4 +-
 offapi/type_reference/offapi.idl                    |    6 +++
 vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx            |    1 
 vcl/unx/kde4/KDE4FilePicker.hxx                     |    4 --
 13 files changed, 45 insertions(+), 54 deletions(-)

New commits:
commit 5bbff06137a87e97260a188f6745cf2a227f15cf
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Wed Jul 15 13:24:07 2015 +0200

    [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 at redhat.com>
    Tested-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/fpicker/source/aqua/SalAquaFilePicker.hxx b/fpicker/source/aqua/SalAquaFilePicker.hxx
index 9a32f31..f018f86 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 4313818..5ee5892 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 f52cdfe..134b661 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 df6ad1c..3fa7c6e 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 fda664a..d80c740 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 0ba7214..c623152 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 2411c74..4970b4e 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 f133303..01b6da3 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
diff --git a/offapi/com/sun/star/ui/dialogs/XFilePicker2.idl b/offapi/com/sun/star/ui/dialogs/XFilePicker2.idl
index 91189a6..b04517f 100644
--- a/offapi/com/sun/star/ui/dialogs/XFilePicker2.idl
+++ b/offapi/com/sun/star/ui/dialogs/XFilePicker2.idl
@@ -27,7 +27,7 @@ module com { module sun { module star { module ui { module dialogs {
 
 /** extends file picker interface to workaround some design problems.
 */
-interface XFilePicker2 : ::com::sun::star::ui::dialogs::XFilePicker
+published interface XFilePicker2 : ::com::sun::star::ui::dialogs::XFilePicker
 {
     /** Returns a sequence of the selected files including path information in
         URL format, conforming to <a href="http://www.w3.org/Addressing/rfc1738.txt">Rfc1738</a>.
diff --git a/offapi/com/sun/star/ui/dialogs/XFilePicker3.idl b/offapi/com/sun/star/ui/dialogs/XFilePicker3.idl
index c33e8eb..d2ee0e2 100644
--- a/offapi/com/sun/star/ui/dialogs/XFilePicker3.idl
+++ b/offapi/com/sun/star/ui/dialogs/XFilePicker3.idl
@@ -22,7 +22,7 @@
 
 #include <com/sun/star/lang/XComponent.idl>
 #include <com/sun/star/util/XCancellable.idl>
-#include <com/sun/star/ui/dialogs/XFilePicker.idl>
+#include <com/sun/star/ui/dialogs/XFilePicker2.idl>
 #include <com/sun/star/ui/dialogs/XFilePickerNotifier.idl>
 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.idl>
 #include <com/sun/star/ui/dialogs/XFilterManager.idl>
@@ -40,7 +40,7 @@ module com { module sun { module star { module ui { module dialogs {
 */
 published interface XFilePicker3
 {
-    interface XFilePicker;
+    interface XFilePicker2;
 
     /** Provides the ability to request notifications about changes.
     */
diff --git a/offapi/type_reference/offapi.idl b/offapi/type_reference/offapi.idl
index f95e6b7..c4bd5c4 100644
--- a/offapi/type_reference/offapi.idl
+++ b/offapi/type_reference/offapi.idl
@@ -16956,8 +16956,12 @@ module com {
       void setCurrentFilter([in] string aTitle) raises (::com::sun::star::lang::IllegalArgumentException);
       string getCurrentFilter();
      };
-     published interface XFilePicker3 {
+     published interface XFilePicker2 {
       interface ::com::sun::star::ui::dialogs::XFilePicker;
+      sequence< string > getSelectedFiles();
+     };
+     published interface XFilePicker3 {
+      interface ::com::sun::star::ui::dialogs::XFilePicker2;
       interface ::com::sun::star::ui::dialogs::XFilePickerNotifier;
       interface ::com::sun::star::ui::dialogs::XFilterManager;
       interface ::com::sun::star::ui::dialogs::XFilterGroupManager;
diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx
index 1830f21..e55d2d2 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx
@@ -48,7 +48,6 @@ typedef ::com::sun::star::uno::Sequence< UnoFilterEntry >   UnoFilterList;  // c
 typedef cppu::WeakComponentImplHelper<
         ::com::sun::star::ui::dialogs::XFilePickerControlAccess,
         ::com::sun::star::ui::dialogs::XFilePreview,
-        ::com::sun::star::ui::dialogs::XFilePicker2,
         ::com::sun::star::ui::dialogs::XFilePicker3,
         ::com::sun::star::lang::XInitialization
         > SalGtkFilePicker_Base;
diff --git a/vcl/unx/kde4/KDE4FilePicker.hxx b/vcl/unx/kde4/KDE4FilePicker.hxx
index c29f4d8..186e57a 100644
--- a/vcl/unx/kde4/KDE4FilePicker.hxx
+++ b/vcl/unx/kde4/KDE4FilePicker.hxx
@@ -23,7 +23,6 @@
 
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XInitialization.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/uno/XComponentContext.hpp>
@@ -42,8 +41,7 @@ class QWidget;
 class QLayout;
 
 typedef ::cppu::WeakComponentImplHelper
-<   ::com::sun::star::ui::dialogs::XFilePicker2
-,   ::com::sun::star::ui::dialogs::XFilePicker3
+<   ::com::sun::star::ui::dialogs::XFilePicker3
 ,   ::com::sun::star::ui::dialogs::XFilePickerControlAccess
 // TODO ::com::sun::star::ui::dialogs::XFilePreview
 ,   ::com::sun::star::lang::XInitialization


More information about the Libreoffice-commits mailing list