Make utl::ConfigManager::get* use direct C++ config access internally
But some of those functions' names may be more telling than their configuration property counterparts, so there may be merit in keeping those trivial wrapper functions around. Change-Id: Ibbf4965fcefd58649920fad964b4a8d2108deaca Reviewed-on: https://gerrit.libreoffice.org/72836 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#include <com/sun/star/uno/Sequence.hxx>
|
||||
#include <i18nlangtag/languagetag.hxx>
|
||||
#include <officecfg/Setup.hxx>
|
||||
#include <rtl/instance.hxx>
|
||||
#include <rtl/ustring.hxx>
|
||||
#include <sal/log.hxx>
|
||||
@@ -66,21 +67,6 @@ getConfigurationProvider() {
|
||||
return css::configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() );
|
||||
}
|
||||
|
||||
OUString getConfigurationString(OUString const & module, OUString const & path)
|
||||
{
|
||||
css::uno::Sequence< css::uno::Any > args(1);
|
||||
args[0] <<= css::beans::NamedValue(
|
||||
"nodepath",
|
||||
css::uno::makeAny(module));
|
||||
return
|
||||
css::uno::Reference< css::container::XHierarchicalNameAccess >(
|
||||
getConfigurationProvider()->createInstanceWithArguments(
|
||||
"com.sun.star.configuration.ConfigurationAccess",
|
||||
args),
|
||||
css::uno::UNO_QUERY_THROW)->
|
||||
getByHierarchicalName(path).get< OUString >();
|
||||
}
|
||||
|
||||
struct theConfigManager:
|
||||
public rtl::Static< utl::ConfigManager, theConfigManager >
|
||||
{};
|
||||
@@ -88,57 +74,39 @@ struct theConfigManager:
|
||||
}
|
||||
|
||||
OUString utl::ConfigManager::getAboutBoxProductVersion() {
|
||||
return getConfigurationString(
|
||||
"/org.openoffice.Setup",
|
||||
"Product/ooSetupVersionAboutBox");
|
||||
return officecfg::Setup::Product::ooSetupVersionAboutBox::get();
|
||||
}
|
||||
|
||||
OUString utl::ConfigManager::getAboutBoxProductVersionSuffix() {
|
||||
return getConfigurationString(
|
||||
"/org.openoffice.Setup",
|
||||
"Product/ooSetupVersionAboutBoxSuffix");
|
||||
return officecfg::Setup::Product::ooSetupVersionAboutBoxSuffix::get();
|
||||
}
|
||||
|
||||
OUString utl::ConfigManager::getDefaultCurrency() {
|
||||
return getConfigurationString(
|
||||
"/org.openoffice.Setup",
|
||||
"L10N/ooSetupCurrency");
|
||||
return officecfg::Setup::L10N::ooSetupCurrency::get();
|
||||
}
|
||||
|
||||
OUString utl::ConfigManager::getUILocale() {
|
||||
return getConfigurationString(
|
||||
"/org.openoffice.Setup",
|
||||
"L10N/ooLocale");
|
||||
return officecfg::Setup::L10N::ooLocale::get();
|
||||
}
|
||||
|
||||
OUString utl::ConfigManager::getWorkLocale() {
|
||||
return getConfigurationString(
|
||||
"/org.openoffice.Setup",
|
||||
"L10N/ooSetupSystemLocale");
|
||||
return officecfg::Setup::L10N::ooSetupSystemLocale::get();
|
||||
}
|
||||
|
||||
OUString utl::ConfigManager::getProductExtension() {
|
||||
return getConfigurationString(
|
||||
"/org.openoffice.Setup",
|
||||
"Product/ooSetupExtension");
|
||||
return officecfg::Setup::Product::ooSetupExtension::get();
|
||||
}
|
||||
|
||||
OUString utl::ConfigManager::getProductName() {
|
||||
return getConfigurationString(
|
||||
"/org.openoffice.Setup",
|
||||
"Product/ooName");
|
||||
return officecfg::Setup::Product::ooName::get();
|
||||
}
|
||||
|
||||
OUString utl::ConfigManager::getProductVersion() {
|
||||
return getConfigurationString(
|
||||
"/org.openoffice.Setup",
|
||||
"Product/ooSetupVersion");
|
||||
return officecfg::Setup::Product::ooSetupVersion::get();
|
||||
}
|
||||
|
||||
OUString utl::ConfigManager::getVendor() {
|
||||
return getConfigurationString(
|
||||
"/org.openoffice.Setup",
|
||||
"Product/ooVendor");
|
||||
return officecfg::Setup::Product::ooVendor::get();
|
||||
}
|
||||
|
||||
void utl::ConfigManager::storeConfigItems() {
|
||||
|
Reference in New Issue
Block a user