summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2011-11-14 22:07:23 +0100
committerStephan Bergmann <sbergman@redhat.com>2011-11-14 22:07:23 +0100
commit8b75883b87c9f7989f98fb413f5e51200c52891c (patch)
tree5eaf6d052d25c61654b4e06ffb67784eab9d263b /cui
parentf72516ed25d25963f497396985d56344eb3ff465 (diff)
Simplified some uses of css.configuration.theDefaultProvider.
* Retro-added new-style UNOIDL singleton specification for it, for easy instantiation. * Plus new comphelper::getComponentContext to map from XMultiServiceFactory to XComponentContext.
Diffstat (limited to 'cui')
-rw-r--r--cui/source/options/optgdlg.cxx45
-rw-r--r--cui/source/options/optinet2.cxx41
-rw-r--r--cui/source/options/optupdt.cxx7
3 files changed, 40 insertions, 53 deletions
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 72355b768ea0..3d2fdb460a66 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -77,6 +77,7 @@
#include <unotools/saveopt.hxx>
#include <sal/macros.h>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
@@ -587,17 +588,14 @@ CanvasSettings::CanvasSettings() :
{
try
{
- Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
Reference<XMultiServiceFactory> xConfigProvider(
- xFactory->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider"))),
- UNO_QUERY_THROW );
+ com::sun::star::configuration::theDefaultProvider::get(
+ comphelper::getProcessComponentContext()));
Any propValue(
- makeAny( PropertyValue(
- OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), -1,
- makeAny( OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Canvas")) ),
- PropertyState_DIRECT_VALUE ) ) );
+ makeAny( NamedValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")),
+ makeAny( OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Canvas")) ) ) ) );
mxForceFlagNameAccess.set(
xConfigProvider->createInstanceWithArguments(
@@ -606,10 +604,9 @@ CanvasSettings::CanvasSettings() :
UNO_QUERY_THROW );
propValue = makeAny(
- PropertyValue(
- OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), -1,
- makeAny( OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Canvas/CanvasServiceList")) ),
- PropertyState_DIRECT_VALUE ) );
+ NamedValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")),
+ makeAny( OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Canvas/CanvasServiceList")) ) ) );
Reference<XNameAccess> xNameAccess(
xConfigProvider->createInstanceWithArguments(
@@ -1230,7 +1227,6 @@ struct LanguageConfig_Impl
static sal_Bool bLanguageCurrentDoc_Impl = sal_False;
// some things we'll need...
-static const OUString sConfigSrvc(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider"));
static const OUString sAccessSrvc(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess"));
static const OUString sAccessUpdSrvc(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationUpdateAccess"));
static const OUString sInstalledLocalesPath(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Setup/Office/InstalledLocales"));
@@ -1293,15 +1289,14 @@ OfaLanguagesTabPage::OfaLanguagesTabPage( Window* pParent, const SfxItemSet& rSe
OUString sOfficeLocaleValue;
OUString sSystemLocaleValue;
- Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory();
- Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory > (
- theMSF->createInstance( sConfigSrvc ),UNO_QUERY_THROW);
- Sequence< Any > theArgs(2);
+ Reference< XMultiServiceFactory > theConfigProvider(
+ com::sun::star::configuration::theDefaultProvider::get(
+ comphelper::getProcessComponentContext()));
+ Sequence< Any > theArgs(1);
Reference< XNameAccess > theNameAccess;
// find out which locales are currently installed and add them to the listbox
- theArgs[0] = makeAny(NamedValue(OUString(RTL_CONSTASCII_USTRINGPARAM("NodePath")), makeAny(sInstalledLocalesPath)));
- theArgs[1] = makeAny(NamedValue(OUString(RTL_CONSTASCII_USTRINGPARAM("reload")), makeAny(sal_True)));
+ theArgs[0] = makeAny(NamedValue(OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), makeAny(sInstalledLocalesPath)));
theNameAccess = Reference< XNameAccess > (
theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs ), UNO_QUERY_THROW );
seqInstalledLanguages = theNameAccess->getElementNames();
@@ -1320,7 +1315,7 @@ OfaLanguagesTabPage::OfaLanguagesTabPage( Window* pParent, const SfxItemSet& rSe
// find out whether the user has a specific locale specified
Sequence< Any > theArgs2(1);
- theArgs2[0] = makeAny(NamedValue(OUString(RTL_CONSTASCII_USTRINGPARAM("NodePath")), makeAny(sUserLocalePath)));
+ theArgs2[0] = makeAny(NamedValue(OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), makeAny(sUserLocalePath)));
theNameAccess = Reference< XNameAccess > (
theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs2 ), UNO_QUERY_THROW );
if (theNameAccess->hasByName(sUserLocaleKey))
@@ -1490,11 +1485,11 @@ sal_Bool OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet )
if( aUserInterfaceLB.GetSelectEntryPos() > 0)
aLangString = ConvertLanguageToIsoString(aUserInterfaceLB.GetSelectLanguage());
*/
- Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory();
- Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory > (
- theMSF->createInstance( sConfigSrvc ),UNO_QUERY_THROW);
+ Reference< XMultiServiceFactory > theConfigProvider(
+ com::sun::star::configuration::theDefaultProvider::get(
+ comphelper::getProcessComponentContext()));
Sequence< Any > theArgs(1);
- theArgs[0] = makeAny(sUserLocalePath);
+ theArgs[0] = makeAny(NamedValue(OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), makeAny(sUserLocalePath)));
Reference< XPropertySet >xProp(
theConfigProvider->createInstanceWithArguments(sAccessUpdSrvc, theArgs ), UNO_QUERY_THROW );
if ( !m_sUserLocaleValue.equals(aLangString))
@@ -1509,6 +1504,8 @@ sal_Bool OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet )
// tell quickstarter to stop being a veto listener
+ Reference< XMultiServiceFactory > theMSF(
+ comphelper::getProcessServiceFactory());
Reference< XInitialization > xInit(theMSF->createInstance(
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.office.Quickstart"))), UNO_QUERY);
if (xInit.is())
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 17a55efdd03a..65679e2de94c 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -86,9 +86,10 @@
#include <rtl/ustring.hxx>
#include <osl/file.hxx>
#include <osl/process.h>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
@@ -224,35 +225,23 @@ SvxProxyTabPage::SvxProxyTabPage(Window* pParent, const SfxItemSet& rSet ) :
aProxyModeLB.SetSelectHdl(LINK( this, SvxProxyTabPage, ProxyHdl_Impl ));
- Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager(
- ::comphelper::getProcessServiceFactory());
+ Reference< com::sun::star::lang::XMultiServiceFactory >
+ xConfigurationProvider(
+ configuration::theDefaultProvider::get(
+ comphelper::getProcessComponentContext() ) );
- if( xServiceManager.is() )
- {
- try
- {
- Reference< com::sun::star::lang::XMultiServiceFactory > xConfigurationProvider =
- Reference< com::sun::star::lang::XMultiServiceFactory > ( xServiceManager->createInstance( rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ) ),
- UNO_QUERY_THROW);
+ OUString aConfigRoot(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings" ) );
- OUString aConfigRoot(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings" ) );
+ beans::NamedValue aProperty;
+ aProperty.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
+ aProperty.Value = makeAny( aConfigRoot );
- beans::PropertyValue aProperty;
- aProperty.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
- aProperty.Value = makeAny( aConfigRoot );
+ Sequence< Any > aArgumentList( 1 );
+ aArgumentList[0] = makeAny( aProperty );
- Sequence< Any > aArgumentList( 1 );
- aArgumentList[0] = makeAny( aProperty );
-
- m_xConfigurationUpdateAccess = xConfigurationProvider->createInstanceWithArguments( rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ),
- aArgumentList );
- }
- catch ( RuntimeException& )
- {
- }
- }
+ m_xConfigurationUpdateAccess = xConfigurationProvider->createInstanceWithArguments( rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ),
+ aArgumentList );
ArrangeControls_Impl();
}
diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx
index adcca4524532..ee87645b3bcd 100644
--- a/cui/source/options/optupdt.cxx
+++ b/cui/source/options/optupdt.cxx
@@ -35,6 +35,7 @@
#include <dialmgr.hxx>
#include <cuires.hrc>
#include <comphelper/processfactory.hxx>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
@@ -342,10 +343,10 @@ IMPL_LINK( SvxOnlineUpdateTabPage, CheckNowHdl_Impl, PushButton *, EMPTYARG )
try
{
uno::Reference< lang::XMultiServiceFactory > xConfigProvider(
- xFactory->createInstance( UNISTRING( "com.sun.star.configuration.ConfigurationProvider" )),
- uno::UNO_QUERY_THROW);
+ com::sun::star::configuration::theDefaultProvider::get(
+ comphelper::getProcessComponentContext() ) );
- beans::PropertyValue aProperty;
+ beans::NamedValue aProperty;
aProperty.Name = UNISTRING( "nodepath" );
aProperty.Value = uno::makeAny( UNISTRING("org.openoffice.Office.Addons/AddonUI/OfficeHelp/UpdateCheckJob") );