summaryrefslogtreecommitdiffstats
path: root/svtools
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2013-12-23 08:57:47 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2013-12-23 10:28:39 +0100
commit2fbb47156773b2e300fc987efc2da85c66e567d1 (patch)
tree7bfb967e74745a4b97cda03519a6f7206dd4e5ff /svtools
parentsvt: All files are compiled with enabled exception handling. (diff)
downloadcore-2fbb47156773b2e300fc987efc2da85c66e567d1.tar.gz
core-2fbb47156773b2e300fc987efc2da85c66e567d1.zip
svt: Use constructor feature for FilePicker and FolderPicker services.
Change-Id: Idb14acb8fdb737b592a358eaa221ca9b1e14e589
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/uno/fpicker.cxx68
-rw-r--r--svtools/source/uno/fpicker.hxx47
-rw-r--r--svtools/source/uno/miscservices.cxx13
-rw-r--r--svtools/util/svt.component6
4 files changed, 24 insertions, 110 deletions
diff --git a/svtools/source/uno/fpicker.cxx b/svtools/source/uno/fpicker.cxx
index 397f661840b5..a9d06ad6d5c7 100644
--- a/svtools/source/uno/fpicker.cxx
+++ b/svtools/source/uno/fpicker.cxx
@@ -53,18 +53,16 @@ static OUString FilePicker_getSystemPickerServiceName()
#endif
}
-Reference< css::uno::XInterface > FilePicker_CreateInstance (
- Reference< css::uno::XComponentContext > const & rxContext)
+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;
Reference< css::uno::XInterface > xResult;
-
- if (!rxContext.is())
- return xResult;
-
- Reference< css::lang::XMultiComponentFactory > xFactory (rxContext->getServiceManager());
+ Reference< css::lang::XMultiComponentFactory > xFactory (context->getServiceManager());
if (xFactory.is() && SvtMiscOptions().UseSystemFileDialog())
{
- xResult = Reference< css::uno::XInterface >( Application::createFilePicker( rxContext ) );
+ xResult = Reference< css::uno::XInterface >( Application::createFilePicker( context ) );
if (!xResult.is())
{
@@ -72,7 +70,7 @@ Reference< css::uno::XInterface > FilePicker_CreateInstance (
{
xResult = xFactory->createInstanceWithContext (
FilePicker_getSystemPickerServiceName(),
- rxContext);
+ context);
}
catch (css::uno::Exception const &)
{
@@ -87,27 +85,15 @@ Reference< css::uno::XInterface > FilePicker_CreateInstance (
// Always fall back to OfficeFilePicker.
xResult = xFactory->createInstanceWithContext (
OUString( "com.sun.star.ui.dialogs.OfficeFilePicker"),
- rxContext);
+ context);
}
if (xResult.is())
{
// Add to FilePicker history.
svt::addFilePicker (xResult);
}
- return xResult;
-}
-
-OUString SAL_CALL FilePicker_getImplementationName()
-{
- return OUString("com.sun.star.comp.svt.FilePicker");
-}
-
-Sequence< OUString > FilePicker_getSupportedServiceNames()
-{
- Sequence< OUString > aServiceNames(1);
- aServiceNames.getArray()[0] =
- OUString( "com.sun.star.ui.dialogs.FilePicker");
- return aServiceNames;
+ xResult->acquire();
+ return xResult.get();
}
/*
@@ -127,25 +113,23 @@ static OUString FolderPicker_getSystemPickerServiceName()
return OUString("com.sun.star.ui.dialogs.SystemFolderPicker");
}
-Reference< css::uno::XInterface > FolderPicker_CreateInstance (
- Reference< css::uno::XComponentContext > const & rxContext)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_svt_FolderPicker_get_implementation(
+ css::uno::XComponentContext *context, uno_Sequence * arguments)
{
+ assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
Reference< css::uno::XInterface > xResult;
-
- if (!rxContext.is())
- return xResult;
-
- Reference< css::lang::XMultiComponentFactory > xFactory (rxContext->getServiceManager());
+ Reference< css::lang::XMultiComponentFactory > xFactory (context->getServiceManager());
if (xFactory.is() && SvtMiscOptions().UseSystemFileDialog())
{
- xResult = Reference< css::uno::XInterface >( Application::createFolderPicker( rxContext ) );
+ xResult = Reference< css::uno::XInterface >( Application::createFolderPicker( context ) );
if (!xResult.is())
{
try
{
xResult = xFactory->createInstanceWithContext (
FolderPicker_getSystemPickerServiceName(),
- rxContext);
+ context);
}
catch (css::uno::Exception const &)
{
@@ -158,27 +142,15 @@ Reference< css::uno::XInterface > FolderPicker_CreateInstance (
// Always fall back to OfficeFolderPicker.
xResult = xFactory->createInstanceWithContext (
OUString( "com.sun.star.ui.dialogs.OfficeFolderPicker"),
- rxContext);
+ context);
}
if (xResult.is())
{
// Add to FolderPicker history.
svt::addFolderPicker (xResult);
}
- return xResult;
-}
-
-OUString SAL_CALL FolderPicker_getImplementationName()
-{
- return OUString("com.sun.star.comp.svt.FolderPicker");
-}
-
-Sequence< OUString > FolderPicker_getSupportedServiceNames()
-{
- Sequence< OUString > aServiceNames(1);
- aServiceNames.getArray()[0] =
- OUString( "com.sun.star.ui.dialogs.FolderPicker");
- return aServiceNames;
+ xResult->acquire();
+ return xResult.get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/uno/fpicker.hxx b/svtools/source/uno/fpicker.hxx
deleted file mode 100644
index e465ee7053ca..000000000000
--- a/svtools/source/uno/fpicker.hxx
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_SVTOOLS_SOURCE_UNO_FPICKER_HXX
-#define INCLUDED_SVTOOLS_SOURCE_UNO_FPICKER_HXX
-
-#include "sal/config.h"
-
-#include "com/sun/star/uno/Reference.hxx"
-#include "com/sun/star/uno/Sequence.hxx"
-#include "rtl/ustring.hxx"
-#include "sal/types.h"
-
-namespace com { namespace sun { namespace star {
-namespace lang { class XMultiServiceFactory; }
-namespace uno { class XInterface; }
-} } }
-
-css::uno::Reference<css::uno::XInterface> SAL_CALL FilePicker_CreateInstance(
-css::uno::Reference< css::uno::XComponentContext > const & context);
-css::uno::Sequence<OUString> FilePicker_getSupportedServiceNames();
-OUString FilePicker_getImplementationName();
-
-css::uno::Reference<css::uno::XInterface> SAL_CALL FolderPicker_CreateInstance(
-css::uno::Reference< css::uno::XComponentContext > const & context);
-css::uno::Sequence<OUString> FolderPicker_getSupportedServiceNames();
-OUString FolderPicker_getImplementationName();
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx
index 38f29003b56f..a963236569a0 100644
--- a/svtools/source/uno/miscservices.cxx
+++ b/svtools/source/uno/miscservices.cxx
@@ -29,7 +29,6 @@
#include "documentcloser.hxx"
#include "hatchwindowfactory.hxx"
#include "hatchwindow.hxx"
-#include "fpicker.hxx"
#include "provider.hxx"
#include "renderer.hxx"
#include "unowizard.hxx"
@@ -71,18 +70,6 @@ namespace
::svt::uno::Wizard::getSupportedServiceNames_static,
::cppu::createSingleComponentFactory, NULL, 0
},
- {
- FilePicker_CreateInstance,
- FilePicker_getImplementationName,
- FilePicker_getSupportedServiceNames,
- ::cppu::createSingleComponentFactory, 0, 0
- },
- {
- FolderPicker_CreateInstance,
- FolderPicker_getImplementationName,
- FolderPicker_getSupportedServiceNames,
- ::cppu::createSingleComponentFactory, 0, 0
- },
{ 0, 0, 0, 0, 0, 0 }
};
}
diff --git a/svtools/util/svt.component b/svtools/util/svt.component
index ee1298f5dfa8..e389e2aeec38 100644
--- a/svtools/util/svt.component
+++ b/svtools/util/svt.component
@@ -37,10 +37,12 @@
<implementation name="com.sun.star.svtools.SvFilterOptionsDialog">
<service name="com.sun.star.ui.dialogs.FilterOptionsDialog"/>
</implementation>
- <implementation name="com.sun.star.comp.svt.FilePicker">
+ <implementation name="com.sun.star.comp.svt.FilePicker"
+ constructor="com_sun_star_comp_svt_FilePicker_get_implementation">
<service name="com.sun.star.ui.dialogs.FilePicker"/>
</implementation>
- <implementation name="com.sun.star.comp.svt.FolderPicker">
+ <implementation name="com.sun.star.comp.svt.FolderPicker"
+ constructor="com_sun_star_comp_svt_FolderPicker_get_implementation">
<service name="com.sun.star.ui.dialogs.FolderPicker"/>
</implementation>
<implementation name="com.sun.star.comp.embed.DocumentCloser">