summaryrefslogtreecommitdiff
path: root/i18nutil
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-06-14 15:23:01 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-06-15 15:41:12 +0100
commit5dd3bf34cb7a469d98c910fff48217f5dbb3b31e (patch)
tree1c5384b83d2fe2c6190d9e2a5dd2d417af9e80de /i18nutil
parent57ea40b8b638ebbc8d7b5ade81bed3096c47ee95 (diff)
use new configmgr api and devomit visible code
Change-Id: I386725e07c34336249dfc935b1e9f9624d1d3be8
Diffstat (limited to 'i18nutil')
-rw-r--r--i18nutil/prj/build.lst2
-rw-r--r--i18nutil/source/utility/paper.cxx59
2 files changed, 8 insertions, 53 deletions
diff --git a/i18nutil/prj/build.lst b/i18nutil/prj/build.lst
index f8568078137f..1d0003fda8e7 100644
--- a/i18nutil/prj/build.lst
+++ b/i18nutil/prj/build.lst
@@ -1,2 +1,2 @@
-inu i18nutil : sal cppu comphelper offapi ICU:icu NULL
+inu i18nutil : sal cppu configmgr comphelper offapi ICU:icu NULL
inu i18nutil\prj nmake - all inu_prj NULL
diff --git a/i18nutil/source/utility/paper.cxx b/i18nutil/source/utility/paper.cxx
index 0f6b813e5754..8f4fb919131e 100644
--- a/i18nutil/source/utility/paper.cxx
+++ b/i18nutil/source/utility/paper.cxx
@@ -28,14 +28,12 @@
#include <osl/diagnose.h>
+#include <officecfg/Setup.hxx>
+#include <officecfg/System.hxx>
#include <sal/config.h>
#include <sal/macros.h>
#include <rtl/ustring.hxx>
#include <rtl/string.hxx>
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/i18n/ScriptType.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
#include "i18nutil/paper.hxx"
@@ -217,38 +215,7 @@ long PaperInfo::sloppyFitPageDimension(long nDimension)
PaperInfo PaperInfo::getSystemDefaultPaper()
{
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::lang::XMultiServiceFactory;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::Any;
- using ::com::sun::star::container::XNameAccess;
- using ::com::sun::star::uno::Exception;
-# define CREATE_OUSTRING( ascii ) \
- rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( ascii ) )
-
- rtl::OUString aLocaleStr;
-
- Reference< XMultiServiceFactory > xConfigProv;
- Reference< XNameAccess > xConfigNA;
- Sequence< Any > aArgs( 1 );
- try
- {
- Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
- xConfigProv = Reference< XMultiServiceFactory >(
- xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationProvider" ) ),
- UNO_QUERY_THROW);
-
- aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.Setup/L10N/" );
- xConfigNA = Reference< XNameAccess >(xConfigProv->createInstanceWithArguments(
- CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationAccess" ), aArgs ), UNO_QUERY_THROW);
-
- // try user-defined locale setting
- xConfigNA->getByName( CREATE_OUSTRING( "ooSetupSystemLocale" ) ) >>= aLocaleStr;
- }
- catch(const Exception&)
- {
- }
+ rtl::OUString aLocaleStr = officecfg::Setup::L10N::ooSetupSystemLocale::get();
#ifdef UNX
// if set to "use system", get papersize from system
@@ -364,24 +331,12 @@ PaperInfo PaperInfo::getSystemDefaultPaper()
}
#endif
- try
- {
- // if set to "use system", try to get locale from system
- if (aLocaleStr.isEmpty() && xConfigProv.is())
- {
- aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.System/L10N/" );
- xConfigNA.set( xConfigProv->createInstanceWithArguments(
- CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationAccess" ), aArgs ),
- UNO_QUERY_THROW );
- xConfigNA->getByName( CREATE_OUSTRING( "Locale" ) ) >>= aLocaleStr;
- }
- }
- catch(const Exception&)
- {
- }
+ // if set to "use system", try to get locale from system
+ if (aLocaleStr.isEmpty())
+ aLocaleStr = officecfg::System::L10N::Locale::get();
if (aLocaleStr.isEmpty())
- aLocaleStr = CREATE_OUSTRING("en-US");
+ aLocaleStr = rtl::OUString::intern(RTL_CONSTASCII_USTRINGPARAM("en-US"));
// convert locale string to locale struct
::com::sun::star::lang::Locale aSysLocale;