diff options
Diffstat (limited to 'shell/source/backends/localebe/localebackend.cxx')
-rw-r--r-- | shell/source/backends/localebe/localebackend.cxx | 115 |
1 files changed, 38 insertions, 77 deletions
diff --git a/shell/source/backends/localebe/localebackend.cxx b/shell/source/backends/localebe/localebackend.cxx index c67d4f836d9e..1335d4a7fa50 100644 --- a/shell/source/backends/localebe/localebackend.cxx +++ b/shell/source/backends/localebe/localebackend.cxx @@ -29,9 +29,7 @@ #include "precompiled_shell.hxx" #include "localebackend.hxx" -#include "localelayer.hxx" -#include <com/sun/star/configuration/backend/ComponentChangeEvent.hpp> -#include <uno/current_context.hxx> +#include <com/sun/star/beans/Optional.hpp> #include <osl/time.h> #include <stdio.h> @@ -226,11 +224,7 @@ rtl::OUString ImplGetLocale(LCID lcid) // ------------------------------------------------------------------------------- -LocaleBackend::LocaleBackend(const uno::Reference<uno::XComponentContext>& xContext) - throw (backend::BackendAccessException) : - ::cppu::WeakImplHelper2 < backend::XSingleLayerStratum, lang::XServiceInfo > (), - m_xContext(xContext) - +LocaleBackend::LocaleBackend() { } @@ -242,11 +236,9 @@ LocaleBackend::~LocaleBackend(void) //------------------------------------------------------------------------------ -LocaleBackend* LocaleBackend::createInstance( - const uno::Reference<uno::XComponentContext>& xContext -) +LocaleBackend* LocaleBackend::createInstance() { - return new LocaleBackend(xContext); + return new LocaleBackend; } // --------------------------------------------------------------------------------------- @@ -288,61 +280,45 @@ rtl::OUString LocaleBackend::getSystemLocale(void) } //------------------------------------------------------------------------------ -rtl::OUString LocaleBackend::createTimeStamp() +void LocaleBackend::setPropertyValue( + rtl::OUString const &, css::uno::Any const &) + throw ( + css::beans::UnknownPropertyException, css::beans::PropertyVetoException, + css::lang::IllegalArgumentException, css::lang::WrappedTargetException, + css::uno::RuntimeException) { - // the time stamp is free text, so just returning the values here. - return getLocale() + getUILocale() + getSystemLocale(); + throw css::lang::IllegalArgumentException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")), + static_cast< cppu::OWeakObject * >(this), -1); } -//------------------------------------------------------------------------------ - -uno::Reference<backend::XLayer> SAL_CALL LocaleBackend::getLayer( - const rtl::OUString& aComponent, const rtl::OUString& /*aTimestamp*/) - throw (backend::BackendAccessException, lang::IllegalArgumentException) +css::uno::Any LocaleBackend::getPropertyValue( + rtl::OUString const & PropertyName) + throw ( + css::beans::UnknownPropertyException, css::lang::WrappedTargetException, + css::uno::RuntimeException) { - - uno::Sequence<rtl::OUString> aComps( getSupportedComponents() ); - if( aComponent.equals( aComps[0]) ) + if (PropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Locale"))) { + return css::uno::makeAny( + css::beans::Optional< css::uno::Any >( + true, css::uno::makeAny(getLocale()))); + } else if (PropertyName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("SystemLocale"))) { - if( ! m_xSystemLayer.is() ) - { - uno::Sequence<backend::PropertyInfo> aPropInfoList(3); - - aPropInfoList[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.System/L10N/UILocale") ); - aPropInfoList[0].Type = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "string" ) ); - aPropInfoList[0].Protected = sal_False; - aPropInfoList[0].Value = uno::makeAny( getUILocale() ); - - aPropInfoList[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.System/L10N/Locale") ); - aPropInfoList[1].Type = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "string" )); - aPropInfoList[1].Protected = sal_False; - aPropInfoList[1].Value = uno::makeAny( getLocale() ); - - aPropInfoList[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.System/L10N/SystemLocale") ); - aPropInfoList[2].Type = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "string" )); - aPropInfoList[2].Protected = sal_False; - aPropInfoList[2].Value = uno::makeAny( getSystemLocale() ); - - m_xSystemLayer = new LocaleLayer(aPropInfoList, createTimeStamp(), m_xContext); - } - - return m_xSystemLayer; + return css::uno::makeAny( + css::beans::Optional< css::uno::Any >( + true, css::uno::makeAny(getSystemLocale()))); + } else if (PropertyName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("UILocale"))) + { + return css::uno::makeAny( + css::beans::Optional< css::uno::Any >( + true, css::uno::makeAny(getUILocale()))); + } else { + throw css::beans::UnknownPropertyException( + PropertyName, static_cast< cppu::OWeakObject * >(this)); } - - return uno::Reference<backend::XLayer>(); -} - -//------------------------------------------------------------------------------ - -uno::Reference<backend::XUpdatableLayer> SAL_CALL -LocaleBackend::getUpdatableLayer(const rtl::OUString& /*aComponent*/) - throw (backend::BackendAccessException,lang::NoSupportException, - lang::IllegalArgumentException) -{ - throw lang::NoSupportException( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "LocaleBackend: No Update Operation allowed, Read Only access") ), - *this) ; } //------------------------------------------------------------------------------ @@ -363,10 +339,8 @@ rtl::OUString SAL_CALL LocaleBackend::getImplementationName(void) uno::Sequence<rtl::OUString> SAL_CALL LocaleBackend::getBackendServiceNames(void) { - uno::Sequence<rtl::OUString> aServiceNameList(2); + uno::Sequence<rtl::OUString> aServiceNameList(1); aServiceNameList[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.LocaleBackend")) ; - aServiceNameList[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.PlatformBackend")) ; - return aServiceNameList ; } @@ -391,16 +365,3 @@ uno::Sequence<rtl::OUString> SAL_CALL LocaleBackend::getSupportedServiceNames(vo { return getBackendServiceNames() ; } - -// --------------------------------------------------------------------------------------- - -uno::Sequence<rtl::OUString> SAL_CALL LocaleBackend::getSupportedComponents(void) -{ - uno::Sequence<rtl::OUString> aSupportedComponentList(1); - aSupportedComponentList[0] = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.System" ) - ); - - return aSupportedComponentList; -} - |