include/sfx2/filedlghelper.hxx            |    4 ++--
 sfx2/source/appl/appopen.cxx              |    4 ++--
 sfx2/source/dialog/filedlghelper.cxx      |   14 +++++++-------
 sfx2/source/dialog/filedlgimpl.hxx        |    2 +-
 vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx |    3 ++-
 5 files changed, 14 insertions(+), 13 deletions(-)

New commits:
commit 4a120aac11602e01164a222907a7b5bcdfd6ea7f
Author:     Mike Kaganski <[email protected]>
AuthorDate: Tue May 13 07:10:29 2025 +0200
Commit:     Mike Kaganski <[email protected]>
CommitDate: Tue May 13 09:56:56 2025 +0200

    Don't convert from Sequence to vector in FileDialogHelper::Execute
    
    The conversion serves no goal, and no place benefits from that.
    
    Change-Id: Id2f1865fb8ef0cdb51f959b35e482f35fad8b75f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185240
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins

diff --git a/include/sfx2/filedlghelper.hxx b/include/sfx2/filedlghelper.hxx
index b98e128b191b..68b8539e4540 100644
--- a/include/sfx2/filedlghelper.hxx
+++ b/include/sfx2/filedlghelper.hxx
@@ -272,7 +272,7 @@ public:
 
    DECL_DLLPRIVATE_LINK( ExecuteSystemFilePicker, void*, void );
 
-   ErrCode                  Execute( std::vector<OUString>& rpURLList,
+   ErrCode                  Execute( css::uno::Sequence<OUString>& rpURLList,
                                      std::optional<SfxAllItemSet>& rpSet,
                                      OUString&         rFilter,
                                      const OUString&   rDirPath );
@@ -289,7 +289,7 @@ public:
 ErrCode FileOpenDialog_Impl( weld::Window* pParent,
                              sal_Int16 nDialogType,
                              FileDialogFlags nFlags,
-                             std::vector<OUString>& rpURLList,
+                             css::uno::Sequence<OUString>& rpURLList,
                              OUString& rFilter,
                              std::optional<SfxAllItemSet>& rpSet,
                              const OUString* pPath,
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 57978b099609..fed96a68051c 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -612,7 +612,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
     if ( !pFileNameItem )
     {
         // get FileName from dialog
-        std::vector<OUString> aURLList;
+        css::uno::Sequence<OUString> aURLList;
         OUString aFilter;
         std::optional<SfxAllItemSet> pSet;
         OUString aPath;
@@ -669,7 +669,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
         rReq.AppendItem( SfxStringItem( SID_REFERER, u"private:user"_ustr ) );
         pSet.reset();
 
-        if(!aURLList.empty())
+        if (aURLList.hasElements())
         {
             if ( nSID == SID_OPENTEMPLATE )
                 rReq.AppendItem( SfxBoolItem( SID_TEMPLATE, false ) );
diff --git a/sfx2/source/dialog/filedlghelper.cxx 
b/sfx2/source/dialog/filedlghelper.cxx
index 5ed936a33a64..effe8bae42c3 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -1403,7 +1403,7 @@ void FileDialogHelper_Impl::implStartExecute()
     }
 }
 
-ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList,
+ErrCode FileDialogHelper_Impl::execute( css::uno::Sequence<OUString>& 
rpURLList,
                                         std::optional<SfxAllItemSet>& rpSet,
                                         OUString&       rFilter,
                                         SignatureState const 
nScriptingSignatureState)
@@ -1456,7 +1456,7 @@ ErrCode FileDialogHelper_Impl::execute( 
std::vector<OUString>& rpURLList,
             SvtSecurityOptions::IsOptionSet( 
SvtSecurityOptions::EOption::DocWarnRecommendPassword ) );
     }
 
-    rpURLList.clear();
+    rpURLList = {};
     maPath.clear(); // tdf#165228 This should not survive between calls to 
execute
 
     if ( ! mxFileDlg.is() )
@@ -1527,8 +1527,8 @@ ErrCode FileDialogHelper_Impl::execute( 
std::vector<OUString>& rpURLList,
         std::shared_ptr<const SfxFilter> pCurrentFilter = 
getCurrentSfxFilter();
 
         // fill the rpURLList
-        comphelper::sequenceToContainer(rpURLList, 
mxFileDlg->getSelectedFiles());
-        if ( rpURLList.empty() )
+        rpURLList = mxFileDlg->getSelectedFiles();
+        if (!rpURLList.hasElements())
             return ERRCODE_ABORT;
 
         // check, whether or not we have to display a password box
@@ -2625,7 +2625,7 @@ IMPL_LINK_NOARG(FileDialogHelper, 
ExecuteSystemFilePicker, void*, void)
 }
 
 // rDirPath has to be a directory
-ErrCode FileDialogHelper::Execute( std::vector<OUString>& rpURLList,
+ErrCode FileDialogHelper::Execute( css::uno::Sequence<OUString>& rpURLList,
                                    std::optional<SfxAllItemSet>& rpSet,
                                    OUString&       rFilter,
                                    const OUString& rDirPath )
@@ -2645,7 +2645,7 @@ ErrCode FileDialogHelper::Execute( 
std::optional<SfxAllItemSet>& rpSet,
                                    SignatureState const 
nScriptingSignatureState)
 {
     ErrCode nRet;
-    std::vector<OUString> rURLList;
+    css::uno::Sequence<OUString> rURLList;
     nRet = mpImpl->execute(rURLList, rpSet, rFilter, nScriptingSignatureState);
     return nRet;
 }
@@ -2835,7 +2835,7 @@ void FileDialogHelper::DialogClosed( const 
DialogClosedEvent& _rEvent )
 ErrCode FileOpenDialog_Impl( weld::Window* pParent,
                              sal_Int16 nDialogType,
                              FileDialogFlags nFlags,
-                             std::vector<OUString>& rpURLList,
+                             css::uno::Sequence<OUString>& rpURLList,
                              OUString& rFilter,
                              std::optional<SfxAllItemSet>& rpSet,
                              const OUString* pPath,
diff --git a/sfx2/source/dialog/filedlgimpl.hxx 
b/sfx2/source/dialog/filedlgimpl.hxx
index 4867d9423e17..66c1aa37f53c 100644
--- a/sfx2/source/dialog/filedlgimpl.hxx
+++ b/sfx2/source/dialog/filedlgimpl.hxx
@@ -173,7 +173,7 @@ namespace sfx2
                                 );
         virtual                 ~FileDialogHelper_Impl() override;
 
-        ErrCode                 execute( std::vector<OUString>& rpURLList,
+        ErrCode                 execute( css::uno::Sequence<OUString>& 
rpURLList,
                                          std::optional<SfxAllItemSet>& rpSet,
                                          OUString&       rFilter,
                                          SignatureState 
nScriptingSignatureState);
commit 927093ab9d9a1a964a3b81655555600655daf195
Author:     Mike Kaganski <[email protected]>
AuthorDate: Tue May 13 08:11:16 2025 +0200
Commit:     Mike Kaganski <[email protected]>
CommitDate: Tue May 13 09:56:46 2025 +0200

    Fix SalGtkFilePicker::getFiles
    
    It should only realloc to 1, when the length is greater. The list may also 
be empty. This aligns the implementation with other pickers.
    
    Change-Id: I8018e71b855ad0c94184eab93d84655c4915f289
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185242
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx 
b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
index e4602128cfe3..7f10458b51d4 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
@@ -693,7 +693,8 @@ uno::Sequence<OUString> SAL_CALL 
SalGtkFilePicker::getFiles()
       and unimplementable for some heterogeneous pseudo-URIs eg. search:
       Thus crop unconditionally to a single selection.
     */
-    aFiles.realloc (1);
+    if (aFiles.getLength() > 1)
+        aFiles.realloc(1);
     return aFiles;
 }
 

Reply via email to