summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-12-28 17:05:40 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-12-28 17:11:31 +0000
commit58ea27124af27bfac21a796b0d13d72354bd0dd3 (patch)
tree283b986474957adf207481a16139e03484c8cc5a /svtools
parentfe868bf7cfba864c6f11f068df87c5fdaae7458c (diff)
make FilePicker::createWithMode not crash
i.e. calc->data->XML Source->"browse to set source" calls com_sun_star_comp_svt_FilePicker_get_implementation with its single argument in arguments as opposed to the empty argument expected there. So allow the single-argument case, and pass the argument through and apply it automatically via XInitialization::initialize in Application::createFilePicker. I'm far from sure that this is the right solution, but it has the advantage of working vs crashing. Change-Id: I07c1baae7f47781920eac56763e8fd003a7b99e1
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/uno/fpicker.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/svtools/source/uno/fpicker.cxx b/svtools/source/uno/fpicker.cxx
index a9d06ad6d5c7..1034bafa3bdb 100644
--- a/svtools/source/uno/fpicker.cxx
+++ b/svtools/source/uno/fpicker.cxx
@@ -57,19 +57,22 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
com_sun_star_comp_svt_FilePicker_get_implementation(
css::uno::XComponentContext *context, uno_Sequence * arguments)
{
- assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+ assert(arguments != 0 && (arguments->nElements == 0 || arguments->nElements == 1));
+ css::uno::Sequence<css::uno::Any> aArgs(reinterpret_cast<css::uno::Any *>(arguments->elements),
+ arguments->nElements);
Reference< css::uno::XInterface > xResult;
Reference< css::lang::XMultiComponentFactory > xFactory (context->getServiceManager());
if (xFactory.is() && SvtMiscOptions().UseSystemFileDialog())
{
- xResult = Reference< css::uno::XInterface >( Application::createFilePicker( context ) );
+ xResult = Reference<css::uno::XInterface>(Application::createFilePicker(aArgs, context));
if (!xResult.is())
{
try
{
- xResult = xFactory->createInstanceWithContext (
+ xResult = xFactory->createInstanceWithArgumentsAndContext(
FilePicker_getSystemPickerServiceName(),
+ aArgs,
context);
}
catch (css::uno::Exception const &)
@@ -83,8 +86,9 @@ com_sun_star_comp_svt_FilePicker_get_implementation(
if (!xResult.is() && xFactory.is())
{
// Always fall back to OfficeFilePicker.
- xResult = xFactory->createInstanceWithContext (
- OUString( "com.sun.star.ui.dialogs.OfficeFilePicker"),
+ xResult = xFactory->createInstanceWithArgumentsAndContext(
+ "com.sun.star.ui.dialogs.OfficeFilePicker",
+ aArgs,
context);
}
if (xResult.is())