[Libreoffice] file-selector oddness / duplication ...
Michael Meeks
michael.meeks at novell.com
Thu Jul 21 04:19:10 PDT 2011
Hi there,
I was wondering why:
sc/source/ui/vba/vbaapplication.cxx
and
sc/source/ui/vba/vbafiledialog.cxx
had this complicated duplication of this big ugly block:
sal_Bool bUseXFilePicker2 = false;
uno::Reference< lang::XServiceInfo > xServiceInfo( xFilePicker, UNO_QUERY );
if ( xServiceInfo.is() )
{
rtl::OUString sImplName = xServiceInfo->getImplementationName();
if ( sImplName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.comp.fpicker.VistaFileDialog")) ||
sImplName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.ui.dialogs.SalGtkFilePicker")) )
{
bUseXFilePicker2 = sal_True;
}
}
uno::Sequence< rtl::OUString > aSelectedFiles;
if ( bUseXFilePicker2 && xFilePicker2.is() )
{
// On Linux, XFilePicker->getFiles() always return one selected file although we select more than one file, also on Vista
// XFilePicker->getFiles() does not work well too, so we call XFilePicker2->getSelectedFiles() to get selected files.
aSelectedFiles = xFilePicker2->getSelectedFiles();
}
AFAIR only those two services implement xFilePicker2 anyway - so it
-looks- to me as if all of it is redundant except for:
if ( xFilePicker2.is() )
which of course we should always prefer.
Any idea why that heavy-lifting service name check is there ? I'd like
to bin it from both places: in future all fpicker services should use
XFilePicker2 (ideally).
Thanks,
Michael.
--
michael.meeks at novell.com <><, Pseudo Engineer, itinerant idiot
More information about the LibreOffice
mailing list