Bug 44903 - MACRO - UCB multiple file selection using SimpleFileAccess in Calc fails
Summary: MACRO - UCB multiple file selection using SimpleFileAccess in Calc fails
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
(earliest affected)
3.4.5 release
Hardware: x86-64 (AMD64) Linux (All)
: high major
Assignee: Not Assigned
Keywords: regression
Depends on:
Reported: 2012-01-18 07:36 UTC by apyvalan
Modified: 2012-03-08 12:04 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description apyvalan 2012-01-18 07:36:47 UTC
Pb Description

1 - Open Calc, open The IDE. Write the folowing code

Sub GetAFileName
	Dim oFileDialog as Object
	Dim iAccept as Integer
	Dim sPath as String
	Dim InitPath as String
	Dim RefControlName as String
	Dim oUcb as object

	oFileDialog = createUnoService("com.sun.star.ui.dialogs.FilePicker")

	oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess")
	If InitPath = "" Then
		'InitPath = GetPathSettings("Work")
	End If
	If oUcb.Exists(InitPath) Then
	End If
	iAccept = oFileDialog.Execute()
	If iAccept = 1 Then
		Redim FichiersSources(Ubound(oFileDialog.Files))

	End If
End Sub

2- With LibreOffice 3.3 it was OK, With the LibreOffice 3.4.5 OOO340m1 (Build:502), you can select several files but only the first files url is memorised
Comment 1 Alex Thurgood 2012-02-04 04:12:45 UTC
Hi, I tested this on a Macbook Pro with Mac OSX 10.6.8 (Snow Leopard) :

NeoOffice 3.1.2 patch 8 : works
NeoOffice 3.2.1 patch 3 : works

LibreOffice 3.3.4 : single file selection only
LibreOffice 3.4.3 : single file selection only
LibreOffice 3.4.4 : single file selection only
LibreOffice 3.4.5 : single file selection only
LibreOffice 3.5 RC2 : single file selection only

Lotus Symphony 3.0.1 : macro fails to execute, nothing happens

OpenOffice.org 3.2.1 : single file selection only
OpenOffice.org 3.3.0 : single file selection only
OpenOffice.org 3.4-dev : single file selection only

So for me, this macro only worked properly with NeoOffice. Confirming as regression with regard to that, at least.

Comment 2 Alex Thurgood 2012-02-04 04:14:38 UTC
Changing title to better reflect problem

Comment 3 Michael Meeks 2012-03-08 12:04:39 UTC
So - nothing changed in this area, that I'm aware of in recent memory.

I did the work on this interface when the gtk+ file-selector was implemented. The XFilePicker interface is hideously broken - in it's multi-select mode it returns a common path prefix as the first entry and then a list of file-names that can be appended that that URL.

That sound sensible - until you hit things like a 'search' meta-URL where each and every multi-selected filename can be a totally different URL. Also the code to use this multi-selection feature is horribly tangled everywhere and spends extra time and code unwinding this damage.

Hence the XFilePicker2::getSelectedFiles() method - which returns all the selection as clean URLs.

Of course, not all fpickers implement that - patches to fix that much appreciated; it shouldn't be hard. But the gtk+ file picker cannot return more than one file reliably via this legacy / back-compat method.

I wonder if that is your issue.

Can you confirm that like-for-like - ie. using the gtk+ file-picker in LibreOffice 3.3 this really does work ? :-) since very little has changed there.