summaryrefslogtreecommitdiff
path: root/svtools/source/dialogs/insdlg.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-10-30 14:02:56 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-10-31 15:31:36 +0100
commit0ac9a10d312dc8f12a74720ce211823ce4addf7b (patch)
tree2c812432eca9315170af8b5b6b7ae5bcbf828d5b /svtools/source/dialogs/insdlg.cxx
parentd27c92961b78da138d3563ab596cca416af9eb38 (diff)
fdo#46808, Deprecate configuration::ConfigurationProvider old-style service
...in favor of existing new-style configuration::theDefaultProvider singleton. Theoretically, ConfigurationProvider instances can be created with specific Locale and EnableAsync arguments, but this is hardly used in practice, and thus effectively all uses of the ConfigurationProvider service use the theDefaultProvider instance, anyway. theDefaultProvider is restricted to the XMultiServiceFactory interface, while ConfigurationProvider also makes available XComponent. However, dispose must not be called manually on theDefaultProvider singleton anyway, and calls to add-/removeEventListener are so few (and in dubious code that should better be cleaned up) that requiring an explicit queryInterface does not really hurt there. This commit originated as a patch by Noel Grandin to "Adapt configuration::ConfigurationProvider UNO service to new style [by creating] a merged XConfigurationProvider interface for this service to implement." It was then modified by Stephan Bergmann by deprecating ConfigurationProvider instead of adding XConfigurationProvider and by replacing calls to ConfigurationProvider::create with calls to theDefaultProvider::get. Change-Id: I9c16700afe0faff1ef6f20338a66bd7a9af990bd
Diffstat (limited to 'svtools/source/dialogs/insdlg.cxx')
-rw-r--r--svtools/source/dialogs/insdlg.cxx123
1 files changed, 59 insertions, 64 deletions
diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx
index 460b183cea84..a5e1f0eaafdb 100644
--- a/svtools/source/dialogs/insdlg.cxx
+++ b/svtools/source/dialogs/insdlg.cxx
@@ -37,6 +37,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -118,89 +119,83 @@ void SvObjectServerList::FillInsertObjects()
*/
{
try{
- uno::Reference< lang::XMultiServiceFactory > _globalMSFactory= comphelper::getProcessServiceFactory();
- if( _globalMSFactory.is())
- {
- ::rtl::OUString sProviderService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ));
- uno::Reference< lang::XMultiServiceFactory > sProviderMSFactory(
- _globalMSFactory->createInstance( sProviderService ), uno::UNO_QUERY );
+ uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
+
+ uno::Reference< lang::XMultiServiceFactory > sProviderMSFactory =
+ configuration::theDefaultProvider::get(xContext);
+
+ ::rtl::OUString sReaderService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" ));
+ uno::Sequence< uno::Any > aArguments( 1 );
+ beans::PropertyValue aPathProp;
+ aPathProp.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
+ aPathProp.Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Embedding/ObjectNames" ));
+ aArguments[0] <<= aPathProp;
+
+ uno::Reference< container::XNameAccess > xNameAccess(
+ sProviderMSFactory->createInstanceWithArguments( sReaderService,aArguments ),
+ uno::UNO_QUERY );
- if( sProviderMSFactory.is())
+ if( xNameAccess.is())
{
- ::rtl::OUString sReaderService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" ));
- uno::Sequence< uno::Any > aArguments( 1 );
- beans::PropertyValue aPathProp;
- aPathProp.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
- aPathProp.Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Embedding/ObjectNames" ));
- aArguments[0] <<= aPathProp;
-
- uno::Reference< container::XNameAccess > xNameAccess(
- sProviderMSFactory->createInstanceWithArguments( sReaderService,aArguments ),
- uno::UNO_QUERY );
-
- if( xNameAccess.is())
- {
- uno::Sequence< ::rtl::OUString > seqNames= xNameAccess->getElementNames();
- sal_Int32 nInd;
+ uno::Sequence< ::rtl::OUString > seqNames= xNameAccess->getElementNames();
+ sal_Int32 nInd;
- ::rtl::OUString aStringProductName( RTL_CONSTASCII_USTRINGPARAM( "%PRODUCTNAME" ) );
- sal_Int32 nStringProductNameLength = aStringProductName.getLength();
+ ::rtl::OUString aStringProductName( RTL_CONSTASCII_USTRINGPARAM( "%PRODUCTNAME" ) );
+ sal_Int32 nStringProductNameLength = aStringProductName.getLength();
- ::rtl::OUString aStringProductVersion( RTL_CONSTASCII_USTRINGPARAM( "%PRODUCTVERSION" ) );
- sal_Int32 nStringProductVersionLength = aStringProductVersion.getLength();
+ ::rtl::OUString aStringProductVersion( RTL_CONSTASCII_USTRINGPARAM( "%PRODUCTVERSION" ) );
+ sal_Int32 nStringProductVersionLength = aStringProductVersion.getLength();
- for( nInd = 0; nInd < seqNames.getLength(); nInd++ )
+ for( nInd = 0; nInd < seqNames.getLength(); nInd++ )
+ {
+ uno::Reference< container::XNameAccess > xEntry ;
+ xNameAccess->getByName( seqNames[nInd] ) >>= xEntry;
+ if ( xEntry.is() )
{
- uno::Reference< container::XNameAccess > xEntry ;
- xNameAccess->getByName( seqNames[nInd] ) >>= xEntry;
- if ( xEntry.is() )
- {
- ::rtl::OUString aUIName;
- ::rtl::OUString aClassID;
- xEntry->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ObjectUIName" )) ) >>= aUIName;
- xEntry->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ClassID" )) ) >>= aClassID;
+ ::rtl::OUString aUIName;
+ ::rtl::OUString aClassID;
+ xEntry->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ObjectUIName" )) ) >>= aUIName;
+ xEntry->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ClassID" )) ) >>= aClassID;
- if ( !aUIName.isEmpty() )
+ if ( !aUIName.isEmpty() )
+ {
+ // replace %PRODUCTNAME
+ sal_Int32 nIndex = aUIName.indexOf( aStringProductName );
+ while( nIndex != -1 )
{
- // replace %PRODUCTNAME
- sal_Int32 nIndex = aUIName.indexOf( aStringProductName );
- while( nIndex != -1 )
- {
- aUIName = aUIName.replaceAt(
- nIndex, nStringProductNameLength,
- utl::ConfigManager::getProductName() );
- nIndex = aUIName.indexOf( aStringProductName );
- }
-
- // replace %PRODUCTVERSION
- nIndex = aUIName.indexOf( aStringProductVersion );
- while( nIndex != -1 )
- {
- aUIName = aUIName.replaceAt(
- nIndex, nStringProductVersionLength,
- utl::ConfigManager::getProductVersion() );
- nIndex = aUIName.indexOf( aStringProductVersion );
- }
+ aUIName = aUIName.replaceAt(
+ nIndex, nStringProductNameLength,
+ utl::ConfigManager::getProductName() );
+ nIndex = aUIName.indexOf( aStringProductName );
}
- SvGlobalName aClassName;
- if( aClassName.MakeId( String( aClassID )))
+ // replace %PRODUCTVERSION
+ nIndex = aUIName.indexOf( aStringProductVersion );
+ while( nIndex != -1 )
{
- if( !Get( aClassName ) )
- // noch nicht eingetragen
- aObjectServerList.push_back( SvObjectServer( aClassName, aUIName ) );
+ aUIName = aUIName.replaceAt(
+ nIndex, nStringProductVersionLength,
+ utl::ConfigManager::getProductVersion() );
+ nIndex = aUIName.indexOf( aStringProductVersion );
}
}
+
+ SvGlobalName aClassName;
+ if( aClassName.MakeId( String( aClassID )))
+ {
+ if( !Get( aClassName ) )
+ // noch nicht eingetragen
+ aObjectServerList.push_back( SvObjectServer( aClassName, aUIName ) );
+ }
}
}
}
- }
#ifdef WNT
- SvGlobalName aOleFact( SO3_OUT_CLASSID );
- String aOleObj( SVT_RESSTR( STR_FURTHER_OBJECT ) );
- aObjectServerList.push_back( SvObjectServer( aOleFact, aOleObj ) );
+ SvGlobalName aOleFact( SO3_OUT_CLASSID );
+ String aOleObj( SVT_RESSTR( STR_FURTHER_OBJECT ) );
+ aObjectServerList.push_back( SvObjectServer( aOleFact, aOleObj ) );
#endif
}catch(const container::NoSuchElementException&)