use more officecfg in SvObjectServerList
Change-Id: I049dedc577e2dc9c44417b041004a9180c19dc59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167643 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
0b8f585f8a
commit
9091fb1c1e
1 changed files with 22 additions and 35 deletions
|
@ -31,6 +31,7 @@
|
|||
#include <comphelper/processfactory.hxx>
|
||||
#include <comphelper/propertysequence.hxx>
|
||||
#include <com/sun/star/container/XNameAccess.hpp>
|
||||
#include <officecfg/Office/Embedding.hxx>
|
||||
|
||||
#if defined _WIN32
|
||||
#include <prewin.h>
|
||||
|
@ -108,47 +109,33 @@ void SvObjectServerList::FillInsertObjects()
|
|||
*/
|
||||
{
|
||||
try{
|
||||
uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
|
||||
uno::Reference< container::XNameAccess > xNameAccess = officecfg::Office::Embedding::ObjectNames::get();
|
||||
|
||||
uno::Reference< lang::XMultiServiceFactory > sProviderMSFactory =
|
||||
configuration::theDefaultProvider::get(xContext);
|
||||
const uno::Sequence< OUString > seqNames= xNameAccess->getElementNames();
|
||||
|
||||
uno::Sequence<uno::Any> aArguments(comphelper::InitAnyPropertySequence(
|
||||
for( const auto& rName : seqNames )
|
||||
{
|
||||
{"nodepath", uno::Any(u"/org.openoffice.Office.Embedding/ObjectNames"_ustr)}
|
||||
}));
|
||||
uno::Reference< container::XNameAccess > xNameAccess(
|
||||
sProviderMSFactory->createInstanceWithArguments( u"com.sun.star.configuration.ConfigurationAccess"_ustr, aArguments ),
|
||||
uno::UNO_QUERY );
|
||||
|
||||
if( xNameAccess.is())
|
||||
{
|
||||
const uno::Sequence< OUString > seqNames= xNameAccess->getElementNames();
|
||||
|
||||
for( const auto& rName : seqNames )
|
||||
uno::Reference< container::XNameAccess > xEntry ;
|
||||
xNameAccess->getByName( rName ) >>= xEntry;
|
||||
if ( xEntry.is() )
|
||||
{
|
||||
uno::Reference< container::XNameAccess > xEntry ;
|
||||
xNameAccess->getByName( rName ) >>= xEntry;
|
||||
if ( xEntry.is() )
|
||||
OUString aUIName;
|
||||
OUString aClassID;
|
||||
xEntry->getByName(u"ObjectUIName"_ustr) >>= aUIName;
|
||||
xEntry->getByName(u"ClassID"_ustr) >>= aClassID;
|
||||
|
||||
if ( !aUIName.isEmpty() )
|
||||
{
|
||||
OUString aUIName;
|
||||
OUString aClassID;
|
||||
xEntry->getByName(u"ObjectUIName"_ustr) >>= aUIName;
|
||||
xEntry->getByName(u"ClassID"_ustr) >>= aClassID;
|
||||
aUIName = aUIName.replaceAll("%PRODUCTNAME", utl::ConfigManager::getProductName());
|
||||
aUIName = aUIName.replaceAll("%PRODUCTVERSION", utl::ConfigManager::getProductVersion());
|
||||
}
|
||||
|
||||
if ( !aUIName.isEmpty() )
|
||||
{
|
||||
aUIName = aUIName.replaceAll("%PRODUCTNAME", utl::ConfigManager::getProductName());
|
||||
aUIName = aUIName.replaceAll("%PRODUCTVERSION", utl::ConfigManager::getProductVersion());
|
||||
}
|
||||
|
||||
SvGlobalName aClassName;
|
||||
if( aClassName.MakeId( aClassID) )
|
||||
{
|
||||
if( !Get( aClassName ) )
|
||||
// not entered yet
|
||||
aObjectServerList.emplace_back( aClassName, aUIName );
|
||||
}
|
||||
SvGlobalName aClassName;
|
||||
if( aClassName.MakeId( aClassID) )
|
||||
{
|
||||
if( !Get( aClassName ) )
|
||||
// not entered yet
|
||||
aObjectServerList.emplace_back( aClassName, aUIName );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue