[Libreoffice-commits] .: 4 commits - basic/CppunitTest_basic_enable.mk basic/CppunitTest_basic_nested_struct.mk basic/source binaryurp/source connectivity/inc connectivity/source dbaccess/source desktop/source filter/CppunitTest_filter_pict_test.mk i18npool/inc i18npool/source lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk offapi/com offapi/type_reference offapi/UnoApi_offapi.mk remotebridges/source svtools/CppunitTest_svtools_filters_test.mk udkapi/com udkapi/UnoApi_udkapi.mk unotools/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Sep 17 05:28:56 PDT 2012
basic/CppunitTest_basic_enable.mk | 1
basic/CppunitTest_basic_nested_struct.mk | 1
basic/source/runtime/iosys.cxx | 20 +---
binaryurp/source/bridgefactory.hxx | 4
connectivity/inc/connectivity/predicateinput.hxx | 4
connectivity/inc/connectivity/sqlparse.hxx | 4
connectivity/source/commontools/predicateinput.cxx | 6 -
connectivity/source/parse/sqlbison.y | 2
connectivity/source/parse/sqlnode.cxx | 3
dbaccess/source/core/api/SingleSelectQueryComposer.cxx | 5 -
desktop/source/offacc/acceptor.cxx | 18 +--
desktop/source/offacc/acceptor.hxx | 6 -
desktop/source/pkgchk/unopkg/unopkg_app.cxx | 25 ++---
filter/CppunitTest_filter_pict_test.mk | 1
i18npool/inc/cclass_unicode.hxx | 4
i18npool/inc/collatorImpl.hxx | 4
i18npool/inc/numberformatcode.hxx | 8 -
i18npool/inc/transliterationImpl.hxx | 10 +-
i18npool/source/characterclassification/cclass_unicode_parser.cxx | 19 +--
i18npool/source/collator/collatorImpl.cxx | 38 +++----
i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx | 3
i18npool/source/numberformatcode/numberformatcode.cxx | 21 +---
i18npool/source/registerservices/registerservices.cxx | 16 ++-
i18npool/source/transliteration/transliterationImpl.cxx | 20 +---
lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk | 1
offapi/UnoApi_offapi.mk | 2
offapi/com/sun/star/i18n/LocaleData.idl | 9 -
offapi/type_reference/types.rdb |binary
remotebridges/source/unourl_resolver/unourl_resolver.cxx | 10 --
svtools/CppunitTest_svtools_filters_test.mk | 1
udkapi/UnoApi_udkapi.mk | 3
udkapi/com/sun/star/bridge/BridgeFactory.idl | 16 ---
udkapi/com/sun/star/bridge/XBridgeFactory2.idl | 49 ++++++++++
unotools/source/i18n/localedatawrapper.cxx | 44 +++-----
34 files changed, 186 insertions(+), 192 deletions(-)
New commits:
commit 581aa2ae225c0d61f65025a5b0155820818e89e0
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Sep 17 14:00:30 2012 +0200
Improvement on previous commit
Change-Id: Idadc0feb5e9c8a3abb5e53395003c386932aa05e
diff --git a/udkapi/UnoApi_udkapi.mk b/udkapi/UnoApi_udkapi.mk
index 164e439..a7a5778 100644
--- a/udkapi/UnoApi_udkapi.mk
+++ b/udkapi/UnoApi_udkapi.mk
@@ -127,6 +127,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,udkapi,udkapi/com/sun/star/beans,\
Introspection \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,udkapi,udkapi/com/sun/star/bridge,\
+ BridgeFactory \
UnoUrlResolver \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,udkapi,udkapi/com/sun/star/connection,\
@@ -228,7 +229,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,udkapi,udkapi/com/sun/star/beans,\
))
$(eval $(call gb_UnoApi_add_idlfiles,udkapi,udkapi/com/sun/star/bridge,\
BridgeExistsException \
- BridgeFactory \
InvalidProtocolChangeException \
ModelDependent \
ProtocolProperty \
commit 900d60b3cd648be79aaaa84c992edf9953c0c7f9
Author: Noel Grandin <noel at peralex.com>
Date: Thu Sep 13 13:30:07 2012 +0200
fdo#46808, Adapt bridge::BridgeFactory UNO service to new style
Create a merged XBridgeFactory2 interface for this service to implement.
Which is backwards-compatible, but does not require creating a new service.
Change-Id: I7309f4d30f0e772bc203c701eb3407b920ffafcc
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index ea1b0f7..aa59515 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -41,6 +41,8 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
+#include <com/sun/star/bridge/BridgeFactory.hpp>
+#include <com/sun/star/bridge/XBridge.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
@@ -52,8 +54,6 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/bridge/XBridge.hpp>
-#include <com/sun/star/bridge/XBridgeFactory.hpp>
using namespace comphelper;
using namespace com::sun::star::uno;
@@ -214,19 +214,11 @@ bool needSecurityRestrictions( void )
return true;
}
- Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory();
- if( !xSMgr.is() )
- return true;
- Reference< XBridgeFactory > xBridgeFac( xSMgr->createInstance
- ( ::rtl::OUString("com.sun.star.bridge.BridgeFactory" ) ), UNO_QUERY );
+ Reference< XComponentContext > xContext = getProcessComponentContext();
+ Reference< XBridgeFactory2 > xBridgeFac( BridgeFactory::create(xContext) );
- Sequence< Reference< XBridge > > aBridgeSeq;
- sal_Int32 nBridgeCount = 0;
- if( xBridgeFac.is() )
- {
- aBridgeSeq = xBridgeFac->getExistingBridges();
- nBridgeCount = aBridgeSeq.getLength();
- }
+ Sequence< Reference< XBridge > > aBridgeSeq = xBridgeFac->getExistingBridges();
+ sal_Int32 nBridgeCount = aBridgeSeq.getLength();
if( nBridgeCount == 0 )
{
diff --git a/binaryurp/source/bridgefactory.hxx b/binaryurp/source/bridgefactory.hxx
index c082092..a949e63 100644
--- a/binaryurp/source/bridgefactory.hxx
+++ b/binaryurp/source/bridgefactory.hxx
@@ -26,7 +26,7 @@
#include <map>
#include "boost/noncopyable.hpp"
-#include "com/sun/star/bridge/XBridgeFactory.hpp"
+#include "com/sun/star/bridge/XBridgeFactory2.hpp"
#include "com/sun/star/lang/XServiceInfo.hpp"
#include "com/sun/star/uno/Exception.hpp"
#include "com/sun/star/uno/Reference.hxx"
@@ -50,7 +50,7 @@ namespace binaryurp {
typedef
cppu::WeakComponentImplHelper2<
com::sun::star::lang::XServiceInfo,
- com::sun::star::bridge::XBridgeFactory >
+ com::sun::star::bridge::XBridgeFactory2 >
BridgeFactoryBase;
class BridgeFactory:
diff --git a/desktop/source/offacc/acceptor.cxx b/desktop/source/offacc/acceptor.cxx
index 64a3d3c..2fd0da3 100644
--- a/desktop/source/offacc/acceptor.cxx
+++ b/desktop/source/offacc/acceptor.cxx
@@ -32,6 +32,7 @@
#include <tools/stream.hxx>
#include <vcl/svapp.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/bridge/BridgeFactory.hpp>
#include <com/sun/star/uno/XNamingService.hpp>
#include <cppuhelper/factory.hxx>
@@ -44,12 +45,11 @@ extern "C" void workerfunc (void * acc)
((Acceptor*)acc)->run();
}
-static Reference<XInterface> getComponentContext( const Reference<XMultiServiceFactory>& rFactory)
+static Reference<XComponentContext> getComponentContext( const Reference<XMultiServiceFactory>& rFactory)
{
- Reference<XInterface> rContext;
+ Reference<XComponentContext> rContext;
Reference< XPropertySet > rPropSet( rFactory, UNO_QUERY );
- Any a = rPropSet->getPropertyValue(
- ::rtl::OUString( "DefaultContext" ) );
+ Any a = rPropSet->getPropertyValue( ::rtl::OUString( "DefaultContext" ) );
a >>= rContext;
return rContext;
}
@@ -65,14 +65,12 @@ Acceptor::Acceptor( const Reference< XMultiServiceFactory >& rFactory )
, m_bDying(false)
{
m_rSMgr = rFactory;
+ // get component context
+ m_rContext = getComponentContext(m_rSMgr);
m_rAcceptor = Reference< XAcceptor > (m_rSMgr->createInstance(
rtl::OUString("com.sun.star.connection.Acceptor" )),
UNO_QUERY );
- m_rBridgeFactory = Reference < XBridgeFactory > (m_rSMgr->createInstance(
- rtl::OUString("com.sun.star.bridge.BridgeFactory" )),
- UNO_QUERY );
- // get component context
- m_rContext = getComponentContext(m_rSMgr);
+ m_rBridgeFactory = BridgeFactory::create(m_rContext);
}
@@ -108,7 +106,7 @@ Acceptor::~Acceptor()
void SAL_CALL Acceptor::run()
{
- while ( m_rAcceptor.is() && m_rBridgeFactory.is() )
+ while ( m_rAcceptor.is() )
{
RTL_LOGFILE_CONTEXT( aLog, "desktop (lo119109) Acceptor::run" );
try
diff --git a/desktop/source/offacc/acceptor.hxx b/desktop/source/offacc/acceptor.hxx
index e25f4e3..0cb2dd3 100644
--- a/desktop/source/offacc/acceptor.hxx
+++ b/desktop/source/offacc/acceptor.hxx
@@ -24,7 +24,7 @@
#include <com/sun/star/connection/XAcceptor.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/bridge/XInstanceProvider.hpp>
-#include <com/sun/star/bridge/XBridgeFactory.hpp>
+#include <com/sun/star/bridge/XBridgeFactory2.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
@@ -66,9 +66,9 @@ private:
Condition m_cEnable;
Reference< XMultiServiceFactory > m_rSMgr;
- Reference< XInterface > m_rContext;
+ Reference< XComponentContext > m_rContext;
Reference< XAcceptor > m_rAcceptor;
- Reference< XBridgeFactory > m_rBridgeFactory;
+ Reference< XBridgeFactory2 > m_rBridgeFactory;
OUString m_aAcceptString;
OUString m_aConnectString;
diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
index ef16ea1..c3387f0 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
@@ -51,6 +51,7 @@
#include "com/sun/star/lang/DisposedException.hpp"
#include "boost/scoped_array.hpp"
#include "com/sun/star/ui/dialogs/XDialogClosedListener.hpp"
+#include "com/sun/star/bridge/BridgeFactory.hpp"
#include "com/sun/star/bridge/XBridgeFactory.hpp"
#include <stdio.h>
#include <vector>
@@ -197,25 +198,19 @@ void disposeBridges(Reference<css::uno::XComponentContext> ctx)
if (!ctx.is())
return;
- Reference<css::bridge::XBridgeFactory> bridgeFac(
- ctx->getServiceManager()->createInstanceWithContext(
- OUSTR("com.sun.star.bridge.BridgeFactory"), ctx),
- UNO_QUERY);
+ Reference<css::bridge::XBridgeFactory2> bridgeFac( css::bridge::BridgeFactory::create(ctx) );
- if (bridgeFac.is())
+ const Sequence< Reference<css::bridge::XBridge> >seqBridges = bridgeFac->getExistingBridges();
+ for (sal_Int32 i = 0; i < seqBridges.getLength(); i++)
{
- const Sequence< Reference<css::bridge::XBridge> >seqBridges = bridgeFac->getExistingBridges();
- for (sal_Int32 i = 0; i < seqBridges.getLength(); i++)
+ Reference<css::lang::XComponent> comp(seqBridges[i], UNO_QUERY);
+ if (comp.is())
{
- Reference<css::lang::XComponent> comp(seqBridges[i], UNO_QUERY);
- if (comp.is())
+ try {
+ comp->dispose();
+ }
+ catch ( const css::lang::DisposedException& )
{
- try {
- comp->dispose();
- }
- catch ( const css::lang::DisposedException& )
- {
- }
}
}
}
diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb
index 8f2fe3b..c0d725b 100644
Binary files a/offapi/type_reference/types.rdb and b/offapi/type_reference/types.rdb differ
diff --git a/remotebridges/source/unourl_resolver/unourl_resolver.cxx b/remotebridges/source/unourl_resolver/unourl_resolver.cxx
index b3a54c6..a44d0b4 100644
--- a/remotebridges/source/unourl_resolver/unourl_resolver.cxx
+++ b/remotebridges/source/unourl_resolver/unourl_resolver.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
#include <com/sun/star/connection/XConnector.hpp>
+#include <com/sun/star/bridge/BridgeFactory.hpp>
#include <com/sun/star/bridge/XBridgeFactory.hpp>
#include <com/sun/star/bridge/XUnoUrlResolver.hpp>
@@ -158,14 +159,7 @@ Reference< XInterface > ResolverImpl::resolve( const OUString & rUnoUrl )
Reference< XConnection > xConnection( xConnector->connect( aConnectDescr ) );
// As soon as singletons are ready, switch to singleton !
- Reference< XBridgeFactory > xBridgeFactory(
- _xSMgr->createInstanceWithContext(
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.BridgeFactory") ),
- _xCtx ),
- UNO_QUERY );
-
- if (! xBridgeFactory.is())
- throw RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM("no bridge factory!" ) ), Reference< XInterface >() );
+ Reference< XBridgeFactory2 > xBridgeFactory( BridgeFactory::create(_xCtx) );
// bridge
Reference< XBridge > xBridge( xBridgeFactory->createBridge(
diff --git a/udkapi/UnoApi_udkapi.mk b/udkapi/UnoApi_udkapi.mk
index cdffbda..164e439 100644
--- a/udkapi/UnoApi_udkapi.mk
+++ b/udkapi/UnoApi_udkapi.mk
@@ -44,7 +44,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,udkapi,udkapi/com/sun/star/beans,\
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,udkapi,udkapi/com/sun/star/bridge,\
Bridge \
- BridgeFactory \
IiopBridge \
OleApplicationRegistration \
OleBridgeSupplier \
@@ -229,11 +228,13 @@ $(eval $(call gb_UnoApi_add_idlfiles,udkapi,udkapi/com/sun/star/beans,\
))
$(eval $(call gb_UnoApi_add_idlfiles,udkapi,udkapi/com/sun/star/bridge,\
BridgeExistsException \
+ BridgeFactory \
InvalidProtocolChangeException \
ModelDependent \
ProtocolProperty \
XBridge \
XBridgeFactory \
+ XBridgeFactory2 \
XBridgeSupplier \
XBridgeSupplier2 \
XInstanceProvider \
diff --git a/udkapi/com/sun/star/bridge/BridgeFactory.idl b/udkapi/com/sun/star/bridge/BridgeFactory.idl
index 75fe2f7..765d2e4 100644
--- a/udkapi/com/sun/star/bridge/BridgeFactory.idl
+++ b/udkapi/com/sun/star/bridge/BridgeFactory.idl
@@ -19,11 +19,10 @@
#ifndef __com_sun_star_bridge_BridgeFactory_idl__
#define __com_sun_star_bridge_BridgeFactory_idl__
-#include <com/sun/star/lang/XComponent.idl>
-#include <com/sun/star/bridge/XBridgeFactory.idl>
+#include <com/sun/star/bridge/XBridgeFactory2.idl>
- module com { module sun { module star { module bridge {
+module com { module sun { module star { module bridge {
/** allows to create new or access existing interprocess bridges.
@@ -34,16 +33,7 @@
@see com::sun::star::bridge::Bridge
*/
-published service BridgeFactory
-{
- /** The main interface of the service
- */
- interface com::sun::star::bridge::XBridgeFactory;
-
- /** This interface allows to break possible cyclic references.
- */
- interface com::sun::star::lang::XComponent;
-};
+published service BridgeFactory : com::sun::star::bridge::XBridgeFactory2;
}; }; }; };
diff --git a/udkapi/com/sun/star/bridge/XBridgeFactory2.idl b/udkapi/com/sun/star/bridge/XBridgeFactory2.idl
new file mode 100644
index 0000000..b301024
--- /dev/null
+++ b/udkapi/com/sun/star/bridge/XBridgeFactory2.idl
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_bridge_XBridgeFactory2_idl__
+#define __com_sun_star_bridge_XBridgeFactory2_idl__
+
+#include <com/sun/star/lang/XComponent.idl>
+#include <com/sun/star/bridge/XBridgeFactory.idl>
+
+
+module com { module sun { module star { module bridge {
+
+
+/**
+ Provides a unified interface for the BridgeFactory service to implement.
+
+ @since LibreOffice 3.7
+ */
+published interface XBridgeFactory2
+{
+ /** The main interface of the service
+ */
+ interface com::sun::star::bridge::XBridgeFactory;
+
+ /** This interface allows to break possible cyclic references.
+ */
+ interface com::sun::star::lang::XComponent;
+};
+
+
+}; }; }; };
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit e3c05e34fddcecb81a8bd1f625ebcd601a0c0238
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Sep 17 13:54:01 2012 +0200
Improvement on previous commit
Change-Id: I609961ece562b7e02c542cfeb23d7c584a9663d9
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 8e81c2f..93eda0d 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -71,11 +71,11 @@ LocaleDataWrapper::LocaleDataWrapper(
)
:
xSMgr( xSF ),
+ xLD( LocaleData::create(comphelper::ComponentContext(xSMgr).getUNOContext()) ),
bLocaleDataItemValid( sal_False ),
bReservedWordValid( sal_False )
{
setLocale( rLocale );
- xLD = LocaleData::create(comphelper::ComponentContext(xSMgr).getUNOContext());
}
@@ -131,8 +131,7 @@ void LocaleDataWrapper::invalidateData()
{
try
{
- if ( xLD.is() )
- return xLD->getLanguageCountryInfo( getLocale() );
+ return xLD->getLanguageCountryInfo( getLocale() );
}
catch (const Exception& e)
{
@@ -146,8 +145,7 @@ void LocaleDataWrapper::invalidateData()
{
try
{
- if ( xLD.is() )
- return xLD->getLocaleItem( getLocale() );
+ return xLD->getLocaleItem( getLocale() );
}
catch (const Exception& e)
{
@@ -161,8 +159,7 @@ void LocaleDataWrapper::invalidateData()
{
try
{
- if ( xLD.is() )
- return xLD->getAllCurrencies2( getLocale() );
+ return xLD->getAllCurrencies2( getLocale() );
}
catch (const Exception& e)
{
@@ -176,8 +173,7 @@ void LocaleDataWrapper::invalidateData()
{
try
{
- if ( xLD.is() )
- return xLD->getAllFormats( getLocale() );
+ return xLD->getAllFormats( getLocale() );
}
catch (const Exception& e)
{
@@ -191,8 +187,7 @@ void LocaleDataWrapper::invalidateData()
{
try
{
- if ( xLD.is() )
- return xLD->getForbiddenCharacters( getLocale() );
+ return xLD->getForbiddenCharacters( getLocale() );
}
catch (const Exception& e)
{
@@ -206,8 +201,7 @@ void LocaleDataWrapper::invalidateData()
{
try
{
- if ( xLD.is() )
- return xLD->getReservedWord( getLocale() );
+ return xLD->getReservedWord( getLocale() );
}
catch ( const Exception& e )
{
@@ -226,8 +220,7 @@ void LocaleDataWrapper::invalidateData()
try
{
- if ( xLD.is() )
- rInstalledLocales = xLD->getAllInstalledLocaleNames();
+ rInstalledLocales = xLD->getAllInstalledLocaleNames();
}
catch ( const Exception& e )
{
@@ -1832,8 +1825,7 @@ void LocaleDataWrapper::evaluateLocaleDataChecking()
{
try
{
- if ( xLD.is() )
- return xLD->getAllCalendars2( getLocale() );
+ return xLD->getAllCalendars2( getLocale() );
}
catch (const Exception& e)
{
@@ -1856,12 +1848,9 @@ void LocaleDataWrapper::evaluateLocaleDataChecking()
try
{
- if ( xLD.is() )
- {
- const_cast<LocaleDataWrapper*>(this)->aDateAcceptancePatterns =
- xLD->getDateAcceptancePatterns( getLocale() );
- return aDateAcceptancePatterns;
- }
+ const_cast<LocaleDataWrapper*>(this)->aDateAcceptancePatterns =
+ xLD->getDateAcceptancePatterns( getLocale() );
+ return aDateAcceptancePatterns;
}
catch (const Exception& e)
{
@@ -1881,8 +1870,7 @@ void LocaleDataWrapper::setDateAcceptancePatterns(
{
try
{
- if ( xLD.is() )
- aDateAcceptancePatterns = xLD->getDateAcceptancePatterns( getLocale() );
+ aDateAcceptancePatterns = xLD->getDateAcceptancePatterns( getLocale() );
}
catch (const Exception& e)
{
commit 369e3fdcdafdb112a6963fb86fa4d4d0edb29c00
Author: Noel Grandin <noel at peralex.com>
Date: Thu Sep 13 12:47:11 2012 +0200
fdo#46808, Adapt i18n::LocaleData UNO service to new style
The implementation of the LocaleData implements the optional XLocaleData4,
so rather than creating a new interface for the new-style service, we simply
make the service implement XLocaleData4, which in turn implements
XLocaleData3, XLocaleData2, XLocaleData.
Change-Id: I3e9a48b031be6b2aa5e04b376b3940b942add85a
diff --git a/basic/CppunitTest_basic_enable.mk b/basic/CppunitTest_basic_enable.mk
index 3857909..76a9ecd 100644
--- a/basic/CppunitTest_basic_enable.mk
+++ b/basic/CppunitTest_basic_enable.mk
@@ -52,5 +52,6 @@ $(eval $(call gb_CppunitTest_use_ure,basic_enable))
$(eval $(call gb_CppunitTest_use_components,basic_enable,\
configmgr/source/configmgr \
+ i18npool/util/i18npool \
))
$(eval $(call gb_CppunitTest_use_configuration,basic_enable))
diff --git a/basic/CppunitTest_basic_nested_struct.mk b/basic/CppunitTest_basic_nested_struct.mk
index 4b0e33d..098840c 100644
--- a/basic/CppunitTest_basic_nested_struct.mk
+++ b/basic/CppunitTest_basic_nested_struct.mk
@@ -53,6 +53,7 @@ $(eval $(call gb_CppunitTest_use_ure,basic_nested_struct))
$(eval $(call gb_CppunitTest_use_components,basic_nested_struct,\
configmgr/source/configmgr \
+ i18npool/util/i18npool \
))
$(eval $(call gb_CppunitTest_use_configuration,basic_nested_struct))
diff --git a/connectivity/inc/connectivity/predicateinput.hxx b/connectivity/inc/connectivity/predicateinput.hxx
index 6350821..56abc6e 100644
--- a/connectivity/inc/connectivity/predicateinput.hxx
+++ b/connectivity/inc/connectivity/predicateinput.hxx
@@ -24,7 +24,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/util/XNumberFormatter.hpp>
-#include <com/sun/star/i18n/XLocaleData.hpp>
+#include <com/sun/star/i18n/XLocaleData4.hpp>
#include <connectivity/sqlparse.hxx>
#include "connectivity/dbtoolsdllapi.hxx"
@@ -48,7 +48,7 @@ namespace dbtools
m_xConnection;
::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >
m_xFormatter;
- ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData >
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData4 >
m_xLocaleData;
::connectivity::OSQLParser
diff --git a/connectivity/inc/connectivity/sqlparse.hxx b/connectivity/inc/connectivity/sqlparse.hxx
index acdf43c..a4a64b3 100644
--- a/connectivity/inc/connectivity/sqlparse.hxx
+++ b/connectivity/inc/connectivity/sqlparse.hxx
@@ -34,7 +34,7 @@
#endif
#include <com/sun/star/i18n/XCharacterClassification.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/i18n/XLocaleData.hpp>
+#include <com/sun/star/i18n/XLocaleData4.hpp>
#include "connectivity/IParseContext.hxx"
#include "connectivity/dbtoolsdllapi.hxx"
#include "connectivity/sqlerror.hxx"
@@ -165,7 +165,7 @@ namespace connectivity
sal_Int32 m_nDateFormatKey;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory;
::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCharacterClassification> m_xCharClass;
- static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData> s_xLocaleData;
+ static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData4> s_xLocaleData;
::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData> xDummy; // can be deleted after 627
// convert a string into double trim it to scale of _nscale and than transform it back to string
diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx
index f72b116..67ec21f 100644
--- a/connectivity/source/commontools/predicateinput.cxx
+++ b/connectivity/source/commontools/predicateinput.cxx
@@ -21,6 +21,7 @@
#include <connectivity/predicateinput.hxx>
#include <comphelper/types.hxx>
#include <connectivity/dbtools.hxx>
+#include <com/sun/star/i18n/LocaleData.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <com/sun/star/util/NumberFormatter.hpp>
@@ -47,6 +48,7 @@ namespace dbtools
using ::com::sun::star::beans::XPropertySetInfo;
using ::com::sun::star::lang::Locale;
using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::i18n::LocaleData;
using ::com::sun::star::i18n::XLocaleData;
using ::com::sun::star::i18n::LocaleDataItem;
@@ -123,9 +125,7 @@ namespace dbtools
// create the locale data
if ( m_xORB.is() )
{
- m_xLocaleData = m_xLocaleData.query( m_xORB->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.LocaleData" ) ) )
- );
+ m_xLocaleData = LocaleData::create( comphelper::ComponentContext(m_xORB).getUNOContext() );
}
}
catch( const Exception& )
diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y
index ce2d0e7..96d0782 100644
--- a/connectivity/source/parse/sqlbison.y
+++ b/connectivity/source/parse/sqlbison.y
@@ -4579,7 +4579,7 @@ sal_Int32 OSQLParser::s_nRefCount = 0;
// ::osl::Mutex OSQLParser::s_aMutex;
OSQLScanner* OSQLParser::s_pScanner = 0;
OSQLParseNodesGarbageCollector* OSQLParser::s_pGarbageCollector = 0;
-::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData> OSQLParser::s_xLocaleData = NULL;
+::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData4> OSQLParser::s_xLocaleData = NULL;
//-----------------------------------------------------------------------------
void setParser(OSQLParser* _pParser)
{
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 9cc9101..9936d18 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/util/XNumberFormatter.hpp>
#include <com/sun/star/util/XNumberFormatTypes.hpp>
+#include <com/sun/star/i18n/LocaleData.hpp>
#include <com/sun/star/i18n/NumberFormatIndex.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
@@ -1285,7 +1286,7 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star:
s_pGarbageCollector = new OSQLParseNodesGarbageCollector();
if(!s_xLocaleData.is())
- s_xLocaleData = Reference<XLocaleData>(m_xServiceFactory->createInstance(::rtl::OUString("com.sun.star.i18n.LocaleData")),UNO_QUERY);
+ s_xLocaleData = LocaleData::create(comphelper::ComponentContext(m_xServiceFactory).getUNOContext());
// reset to 0
memset(OSQLParser::s_nRuleIDs,0,sizeof(OSQLParser::s_nRuleIDs[0]) * (OSQLParseNode::rule_count+1));
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index da159c3..a3d35e2 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -28,7 +28,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/i18n/XLocaleData.hpp>
+#include <com/sun/star/i18n/LocaleData.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/sdb/BooleanComparisonMode.hpp>
@@ -258,8 +258,7 @@ OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAcc
m_aLocale = SvtSysLocale().GetLocaleData().getLocale();
m_xNumberFormatsSupplier = dbtools::getNumberFormats( m_xConnection, sal_True, m_aContext.getLegacyServiceFactory() );
- Reference< XLocaleData > xLocaleData;
- m_aContext.createComponent( "com.sun.star.i18n.LocaleData", xLocaleData );
+ Reference< XLocaleData4 > xLocaleData( LocaleData::create(m_aContext.getUNOContext()) );
LocaleDataItem aData = xLocaleData->getLocaleItem(m_aLocale);
m_sDecimalSep = aData.decimalSeparator;
OSL_ENSURE(m_sDecimalSep.getLength() == 1,"OSingleSelectQueryComposer::OSingleSelectQueryComposer decimal separator is not 1 length");
diff --git a/filter/CppunitTest_filter_pict_test.mk b/filter/CppunitTest_filter_pict_test.mk
index ce9eeb6..59a3244 100644
--- a/filter/CppunitTest_filter_pict_test.mk
+++ b/filter/CppunitTest_filter_pict_test.mk
@@ -31,6 +31,7 @@ $(eval $(call gb_CppunitTest_use_ure,filter_pict_test))
$(eval $(call gb_CppunitTest_use_components,filter_pict_test,\
configmgr/source/configmgr \
+ i18npool/util/i18npool \
))
$(eval $(call gb_CppunitTest_use_configuration,filter_pict_test))
diff --git a/i18npool/inc/cclass_unicode.hxx b/i18npool/inc/cclass_unicode.hxx
index a9d7878..340b72f 100644
--- a/i18npool/inc/cclass_unicode.hxx
+++ b/i18npool/inc/cclass_unicode.hxx
@@ -21,7 +21,7 @@
#include <com/sun/star/i18n/XNativeNumberSupplier.hpp>
#include <com/sun/star/i18n/XCharacterClassification.hpp>
-#include <com/sun/star/i18n/XLocaleData.hpp>
+#include <com/sun/star/i18n/XLocaleData4.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <cppuhelper/implbase1.hxx> // helper for implementations
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -122,7 +122,7 @@ private:
/// used for parser only
com::sun::star::lang::Locale aParserLocale;
- com::sun::star::uno::Reference < XLocaleData > xLocaleData;
+ com::sun::star::uno::Reference < XLocaleData4 > mxLocaleData;
com::sun::star::uno::Reference < com::sun::star::i18n::XNativeNumberSupplier > xNatNumSup;
rtl::OUString aStartChars;
rtl::OUString aContChars;
diff --git a/i18npool/inc/collatorImpl.hxx b/i18npool/inc/collatorImpl.hxx
index f09edfe..7af9619 100644
--- a/i18npool/inc/collatorImpl.hxx
+++ b/i18npool/inc/collatorImpl.hxx
@@ -22,7 +22,7 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/i18n/XLocaleData.hpp>
+#include <com/sun/star/i18n/XLocaleData4.hpp>
#include <com/sun/star/i18n/XCollator.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <cppuhelper/weak.hxx>
@@ -97,7 +97,7 @@ private :
// Service Factory
com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF;
// lang::Locale Data
- com::sun::star::uno::Reference < XLocaleData > localedata;
+ com::sun::star::uno::Reference < XLocaleData4 > mxLocaleData;
sal_Bool SAL_CALL createCollator(const lang::Locale& rLocale, const rtl::OUString& serviceName,
const rtl::OUString& rSortAlgorithm) throw(com::sun::star::uno::RuntimeException);
diff --git a/i18npool/inc/numberformatcode.hxx b/i18npool/inc/numberformatcode.hxx
index ee825ee..9433b11 100644
--- a/i18npool/inc/numberformatcode.hxx
+++ b/i18npool/inc/numberformatcode.hxx
@@ -25,7 +25,7 @@
#include <cppuhelper/implbase2.hxx> // helper for implementations
#include <com/sun/star/i18n/XNumberFormatCode.hpp>
-#include <com/sun/star/i18n/XLocaleData.hpp>
+#include <com/sun/star/i18n/XLocaleData4.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -37,7 +37,7 @@ class NumberFormatCodeMapper : public cppu::WeakImplHelper2
{
public:
NumberFormatCodeMapper( const ::com::sun::star::uno::Reference <
- ::com::sun::star::lang::XMultiServiceFactory >& rxMSF );
+ ::com::sun::star::uno::XComponentContext >& rxContext );
~NumberFormatCodeMapper();
virtual ::com::sun::star::i18n::NumberFormatCode SAL_CALL getDefault( sal_Int16 nFormatType, sal_Int16 nFormatUsage, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException);
@@ -55,9 +55,9 @@ public:
private:
::com::sun::star::lang::Locale aLocale;
- ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > xMSF;
+ ::com::sun::star::uno::Reference < ::com::sun::star::uno::XComponentContext > mxContext;
::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > aFormatSeq;
- ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XLocaleData > xlocaleData;
+ ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XLocaleData4 > mxLocaleData;
sal_Bool bFormatsValid;
void setupLocale( const ::com::sun::star::lang::Locale& rLocale );
diff --git a/i18npool/inc/transliterationImpl.hxx b/i18npool/inc/transliterationImpl.hxx
index 3ff3452..fd12616 100644
--- a/i18npool/inc/transliterationImpl.hxx
+++ b/i18npool/inc/transliterationImpl.hxx
@@ -19,10 +19,10 @@
#ifndef _I18N_TRANSLITERATIONIMPL_HXX_
#define _I18N_TRANSLITERATIONIMPL_HXX_
-#include <com/sun/star/i18n/XLocaleData.hpp>
+#include <com/sun/star/i18n/XLocaleData4.hpp>
#include <com/sun/star/i18n/XExtendedTransliteration.hpp>
#include <cppuhelper/implbase2.hxx> // helper for implementations
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <sal/types.h>
@@ -44,7 +44,7 @@ class TransliterationImpl : public cppu::WeakImplHelper2
{
public:
// Constructors
- TransliterationImpl(const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& xMSF);
+ TransliterationImpl(const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& xContext);
// Destructor
~TransliterationImpl();
@@ -104,8 +104,8 @@ private:
com::sun::star::uno::Reference< com::sun::star::i18n::XExtendedTransliteration > bodyCascade[maxCascade];
sal_Int16 numCascade;
sal_Bool caseignoreOnly;
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xSMgr;
- com::sun::star::uno::Reference< XLocaleData > localedata;
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext;
+ com::sun::star::uno::Reference< XLocaleData4 > mxLocaledata;
com::sun::star::uno::Reference< com::sun::star::i18n::XExtendedTransliteration > caseignore;
virtual sal_Bool SAL_CALL loadModuleByName( const rtl::OUString& implName,
diff --git a/i18npool/source/characterclassification/cclass_unicode_parser.cxx b/i18npool/source/characterclassification/cclass_unicode_parser.cxx
index 5de6eaa..f538933 100644
--- a/i18npool/source/characterclassification/cclass_unicode_parser.cxx
+++ b/i18npool/source/characterclassification/cclass_unicode_parser.cxx
@@ -25,8 +25,9 @@
#include <com/sun/star/i18n/KParseTokens.hpp>
#include <com/sun/star/i18n/KParseType.hpp>
#include <com/sun/star/i18n/UnicodeType.hpp>
-#include <com/sun/star/i18n/XLocaleData.hpp>
+#include <com/sun/star/i18n/LocaleData.hpp>
#include <com/sun/star/i18n/NativeNumberMode.hpp>
+#include <comphelper/componentcontext.hxx>
#include <string.h> // memcpy()
@@ -398,17 +399,9 @@ sal_Bool cclass_Unicode::setupInternational( const Locale& rLocale )
aParserLocale.Country = rLocale.Country;
aParserLocale.Variant = rLocale.Variant;
}
- if ( !xLocaleData.is() && xMSF.is() )
+ if ( !mxLocaleData.is() )
{
- Reference <
- XInterface > xI =
- xMSF->createInstance( OUString(
- RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.LocaleData" ) ) );
- if ( xI.is() )
- {
- Any x = xI->queryInterface( getCppuType((const Reference< XLocaleData>*)0) );
- x >>= xLocaleData;
- }
+ mxLocaleData.set( LocaleData::create(comphelper::ComponentContext(xMSF).getUNOContext()) );
}
return bChanged;
}
@@ -458,10 +451,10 @@ void cclass_Unicode::initParserTable( const Locale& rLocale, sal_Int32 startChar
aContChars = userDefinedCharactersCont;
// specials
- if( xLocaleData.is() )
+ if( mxLocaleData.is() )
{
LocaleDataItem aItem =
- xLocaleData->getLocaleItem( aParserLocale );
+ mxLocaleData->getLocaleItem( aParserLocale );
//!TODO: theoretically separators may be a string, adjustment would have to be
//! done here and in parsing and in ::rtl::math::stringToDouble()
cGroupSep = aItem.thousandSeparator.getStr()[0];
diff --git a/i18npool/source/collator/collatorImpl.cxx b/i18npool/source/collator/collatorImpl.cxx
index 90da69f..12a3cc6 100644
--- a/i18npool/source/collator/collatorImpl.cxx
+++ b/i18npool/source/collator/collatorImpl.cxx
@@ -20,7 +20,9 @@
#include <collatorImpl.hxx>
#include <com/sun/star/i18n/CollatorOptions.hpp>
+#include <com/sun/star/i18n/LocaleData.hpp>
#include <rtl/ustrbuf.hxx>
+#include <comphelper/componentcontext.hxx>
using namespace com::sun::star;
using namespace com::sun::star::lang;
@@ -33,12 +35,7 @@ namespace com { namespace sun { namespace star { namespace i18n {
CollatorImpl::CollatorImpl( const Reference < XMultiServiceFactory >& rxMSF ) : xMSF(rxMSF)
{
- if ( rxMSF.is()) {
- Reference < XInterface > xI =
- xMSF->createInstance( OUString("com.sun.star.i18n.LocaleData"));
- if ( xI.is() )
- xI->queryInterface(::getCppuType((const Reference< XLocaleData>*)0)) >>= localedata;
- }
+ mxLocaleData.set(LocaleData::create(comphelper::ComponentContext(xMSF).getUNOContext()));
cachedItem = NULL;
}
@@ -78,7 +75,7 @@ CollatorImpl::compareString( const OUString& in_str1, const OUString& in_str2) t
sal_Int32 SAL_CALL
CollatorImpl::loadDefaultCollator(const lang::Locale& rLocale, sal_Int32 collatorOptions) throw(RuntimeException)
{
- const Sequence< Implementation > &imp = localedata->getCollatorImplementations(rLocale);
+ const Sequence< Implementation > &imp = mxLocaleData->getCollatorImplementations(rLocale);
for (sal_Int16 i = 0; i < imp.getLength(); i++)
if (imp[i].isDefault)
return loadCollatorAlgorithm(imp[i].unoID, rLocale, collatorOptions);
@@ -116,7 +113,7 @@ Sequence< OUString > SAL_CALL
CollatorImpl::listCollatorAlgorithms( const lang::Locale& rLocale ) throw(RuntimeException)
{
nLocale = rLocale;
- const Sequence< Implementation > &imp = localedata->getCollatorImplementations(rLocale);
+ const Sequence< Implementation > &imp = mxLocaleData->getCollatorImplementations(rLocale);
Sequence< OUString > list(imp.getLength());
for (sal_Int32 i = 0; i < imp.getLength(); i++) {
@@ -134,7 +131,7 @@ CollatorImpl::listCollatorAlgorithms( const lang::Locale& rLocale ) throw(Runtim
Sequence< sal_Int32 > SAL_CALL
CollatorImpl::listCollatorOptions( const OUString& /*collatorAlgorithmName*/ ) throw(RuntimeException)
{
- Sequence< OUString > option_str = localedata->getCollationOptions(nLocale);
+ Sequence< OUString > option_str = mxLocaleData->getCollationOptions(nLocale);
Sequence< sal_Int32 > option_int(option_str.getLength());
for (sal_Int32 i = 0; i < option_str.getLength(); i++)
@@ -157,21 +154,18 @@ CollatorImpl::createCollator(const lang::Locale& rLocale, const OUString& servic
return sal_True;
}
}
- if (xMSF.is()) {
- Reference < XInterface > xI =
- xMSF->createInstance(OUString("com.sun.star.i18n.Collator_") + serviceName);
-
- if (xI.is()) {
- Reference < XCollator > xC;
- xI->queryInterface( getCppuType((const Reference< XCollator>*)0) ) >>= xC;
- if (xC.is()) {
- lookupTable.push_back(cachedItem = new lookupTableItem(rLocale, rSortAlgorithm, serviceName, xC));
- return sal_True;
- }
+ Reference < XInterface > xI =
+ xMSF->createInstance(OUString("com.sun.star.i18n.Collator_") + serviceName);
+
+ if (xI.is()) {
+ Reference < XCollator > xC;
+ xI->queryInterface( getCppuType((const Reference< XCollator>*)0) ) >>= xC;
+ if (xC.is()) {
+ lookupTable.push_back(cachedItem = new lookupTableItem(rLocale, rSortAlgorithm, serviceName, xC));
+ return sal_True;
}
- return sal_False;
}
- throw RuntimeException();
+ return sal_False;
}
void SAL_CALL
diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index 5caacbd..dc2e608 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -25,6 +25,7 @@
#include <nativenumbersupplier.hxx>
#include <stdio.h>
#include <string.h>
+#include <comphelper/componentcontext.hxx>
// Cyrillic upper case
#define C_CYR_A "\xD0\x90"
@@ -271,7 +272,7 @@ DefaultNumberingProvider::~DefaultNumberingProvider()
void DefaultNumberingProvider::impl_loadTranslit()
{
if ( !translit )
- translit = new TransliterationImpl(xSMgr);
+ translit = new TransliterationImpl(comphelper::ComponentContext(xSMgr).getUNOContext());
}
Sequence< Reference<container::XIndexAccess> >
diff --git a/i18npool/source/numberformatcode/numberformatcode.cxx b/i18npool/source/numberformatcode/numberformatcode.cxx
index 96b8377..6ec2379 100644
--- a/i18npool/source/numberformatcode/numberformatcode.cxx
+++ b/i18npool/source/numberformatcode/numberformatcode.cxx
@@ -21,14 +21,16 @@
#include <numberformatcode.hxx>
#include <com/sun/star/i18n/KNumberFormatUsage.hpp>
#include <com/sun/star/i18n/KNumberFormatType.hpp>
+#include <com/sun/star/i18n/LocaleData.hpp>
+#include <comphelper/componentcontext.hxx>
NumberFormatCodeMapper::NumberFormatCodeMapper(
const ::com::sun::star::uno::Reference <
- ::com::sun::star::lang::XMultiServiceFactory >& rxMSF )
+ ::com::sun::star::uno::XComponentContext >& rxContext )
:
- xMSF( rxMSF ),
+ mxContext( rxContext ),
bFormatsValid( sal_False )
{
}
@@ -164,10 +166,10 @@ void NumberFormatCodeMapper::getFormats( const ::com::sun::star::lang::Locale& r
if ( !bFormatsValid )
{
createLocaleDataObject();
- if( !xlocaleData.is() )
+ if( !mxLocaleData.is() )
aFormatSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > (0);
else
- aFormatSeq = xlocaleData->getAllFormats( aLocale );
+ aFormatSeq = mxLocaleData->getAllFormats( aLocale );
bFormatsValid = sal_True;
}
}
@@ -255,17 +257,10 @@ NumberFormatCodeMapper::mapElementUsageStringToShort(const ::rtl::OUString& form
void
NumberFormatCodeMapper::createLocaleDataObject() {
- if(xlocaleData.is())
+ if(mxLocaleData.is())
return;
- ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >
- xI = xMSF->createInstance(
- ::rtl::OUString( "com.sun.star.i18n.LocaleData" ));
-
- if ( xI.is() ) {
- ::com::sun::star::uno::Any x = xI->queryInterface( ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData >*)0) );
- x >>= xlocaleData;
- }
+ mxLocaleData.set( com::sun::star::i18n::LocaleData::create(mxContext) );
}
::rtl::OUString SAL_CALL
diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx
index 85e3af8..3eba12e 100644
--- a/i18npool/source/registerservices/registerservices.cxx
+++ b/i18npool/source/registerservices/registerservices.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <comphelper/componentcontext.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/weak.hxx>
#include <osl/mutex.hxx>
@@ -101,6 +102,17 @@
new ImplName( rxMSF ) ); \
}
+#define IMPL_CREATEINSTANCE_CTX( ImplName ) \
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > \
+ SAL_CALL ImplName##_CreateInstance( \
+ const ::com::sun::star::uno::Reference< \
+ ::com::sun::star::lang::XMultiServiceFactory >& rxMSF ) \
+{ \
+ return ::com::sun::star::uno::Reference < \
+ ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) \
+ new ImplName( comphelper::ComponentContext(rxMSF).getUNOContext() ) ); \
+}
+
typedef ::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface > (SAL_CALL *FN_CreateInstance)(
const ::com::sun::star::uno::Reference<
@@ -115,7 +127,7 @@ typedef ::com::sun::star::uno::Reference<
using namespace ::com::sun::star::i18n;
-IMPL_CREATEINSTANCE_MSF( NumberFormatCodeMapper )
+IMPL_CREATEINSTANCE_CTX( NumberFormatCodeMapper )
IMPL_CREATEINSTANCE( NativeNumberSupplier )
IMPL_CREATEINSTANCE( LocaleData )
IMPL_CREATEINSTANCE_MSF( DefaultNumberingProvider )
@@ -147,7 +159,7 @@ IMPL_CREATEINSTANCE( Collator_Unicode )
IMPL_CREATEINSTANCE_MSF( CharacterClassificationImpl )
IMPL_CREATEINSTANCE_MSF( cclass_Unicode )
-IMPL_CREATEINSTANCE_MSF( TransliterationImpl )
+IMPL_CREATEINSTANCE_CTX( TransliterationImpl )
IMPL_CREATEINSTANCE( UnoScriptTypeDetector )
IMPL_CREATEINSTANCE_MSF( InputSequenceCheckerImpl )
diff --git a/i18npool/source/transliteration/transliterationImpl.cxx b/i18npool/source/transliteration/transliterationImpl.cxx
index d6b1e14..af5ca8f 100644
--- a/i18npool/source/transliteration/transliterationImpl.cxx
+++ b/i18npool/source/transliteration/transliterationImpl.cxx
@@ -21,9 +21,11 @@
#include "transliterationImpl.hxx"
#include "servicename.hxx"
+#include <com/sun/star/i18n/LocaleData.hpp>
#include <com/sun/star/i18n/TransliterationType.hpp>
#include <com/sun/star/lang/XComponent.hpp>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/processfactory.hxx>
#include <rtl/instance.hxx>
#include <rtl/string.h>
@@ -136,25 +138,17 @@ static struct TMlist {
};
// Constructor/Destructor
-TransliterationImpl::TransliterationImpl(const Reference <XMultiServiceFactory>& xMSF) : xSMgr(xMSF)
+TransliterationImpl::TransliterationImpl(const Reference <XComponentContext>& xContext) : mxContext(xContext)
{
numCascade = 0;
caseignoreOnly = sal_True;
- if ( xMSF.is() )
- {
- Reference < XInterface > xI=
- xMSF->createInstance(OUString("com.sun.star.i18n.LocaleData"));
- if ( xI.is() ) {
- Any x = xI->queryInterface( ::getCppuType( (const uno::Reference< i18n::XLocaleData >*)0) );
- x >>= localedata;
- }
- }
+ mxLocaledata.set(LocaleData::create(xContext));
}
TransliterationImpl::~TransliterationImpl()
{
- localedata.clear();
+ mxLocaledata.clear();
clear();
}
@@ -261,7 +255,7 @@ TransliterationImpl::loadModulesByImplNames(const Sequence< OUString >& implName
Sequence<OUString> SAL_CALL
TransliterationImpl::getAvailableModules( const Locale& rLocale, sal_Int16 sType ) throw(RuntimeException)
{
- const Sequence<OUString> &translist = localedata->getTransliterations(rLocale);
+ const Sequence<OUString> &translist = mxLocaledata->getTransliterations(rLocale);
Sequence<OUString> r(translist.getLength());
Reference<XExtendedTransliteration> body;
sal_Int32 n = 0;
@@ -597,7 +591,7 @@ void TransliterationImpl::loadBody( OUString &implName, Reference<XExtendedTrans
if (implName != lastTransBody.Name)
{
lastTransBody.Body.set(
- xSMgr->createInstance(implName), UNO_QUERY_THROW);
+ mxContext->getServiceManager()->createInstanceWithContext(implName, mxContext), UNO_QUERY_THROW);
lastTransBody.Name = implName;
}
body = lastTransBody.Body;
diff --git a/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk b/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk
index 8605c37..3a08913 100644
--- a/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk
+++ b/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk
@@ -54,6 +54,7 @@ $(eval $(call gb_CppunitTest_use_ure,lotuswordpro_test_lotuswordpro))
$(eval $(call gb_CppunitTest_use_components,lotuswordpro_test_lotuswordpro,\
configmgr/source/configmgr \
+ i18npool/util/i18npool \
lotuswordpro/util/lwpfilter \
ucb/source/core/ucb1 \
ucb/source/ucp/file/ucpfile1 \
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 5587478..e5606da 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -150,6 +150,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/inspection
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/i18n,\
BreakIterator \
+ LocaleData \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/linguistic2,\
LanguageGuessing \
@@ -847,7 +848,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/i18n,\
IndexEntrySupplier \
InputSequenceChecker \
LocaleCalendar \
- LocaleData \
NativeNumberSupplier \
NumberFormatMapper \
OrdinalSuffix \
diff --git a/offapi/com/sun/star/i18n/LocaleData.idl b/offapi/com/sun/star/i18n/LocaleData.idl
index fd95168..93d7962 100644
--- a/offapi/com/sun/star/i18n/LocaleData.idl
+++ b/offapi/com/sun/star/i18n/LocaleData.idl
@@ -36,14 +36,7 @@ module com { module sun { module star { module i18n {
/// Access locale specific data.
-published service LocaleData
-{
- interface com::sun::star::i18n::XLocaleData;
-
- [optional] interface com::sun::star::i18n::XLocaleData2;
- [optional] interface com::sun::star::i18n::XLocaleData3;
- [optional] interface com::sun::star::i18n::XLocaleData4;
-};
+published service LocaleData : com::sun::star::i18n::XLocaleData4;
}; }; }; };
diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb
index 674109c..8f2fe3b 100644
Binary files a/offapi/type_reference/types.rdb and b/offapi/type_reference/types.rdb differ
diff --git a/svtools/CppunitTest_svtools_filters_test.mk b/svtools/CppunitTest_svtools_filters_test.mk
index c6abe11..96a1a8d 100644
--- a/svtools/CppunitTest_svtools_filters_test.mk
+++ b/svtools/CppunitTest_svtools_filters_test.mk
@@ -53,6 +53,7 @@ $(eval $(call gb_CppunitTest_use_ure,svtools_filters_test))
$(eval $(call gb_CppunitTest_use_components,svtools_filters_test,\
configmgr/source/configmgr \
+ i18npool/util/i18npool \
ucb/source/core/ucb1 \
))
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index db5e2b8..8e81c2f 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -32,10 +32,12 @@
#include "instance.hxx"
#include <com/sun/star/i18n/KNumberFormatUsage.hpp>
#include <com/sun/star/i18n/KNumberFormatType.hpp>
+#include <com/sun/star/i18n/LocaleData.hpp>
#include <com/sun/star/i18n/CalendarFieldIndex.hpp>
#include <com/sun/star/i18n/CalendarDisplayIndex.hpp>
-
#include <com/sun/star/i18n/NumberFormatIndex.hpp>
+
+#include <comphelper/componentcontext.hxx>
#include <rtl/instance.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/macros.h>
@@ -73,9 +75,7 @@ LocaleDataWrapper::LocaleDataWrapper(
bReservedWordValid( sal_False )
{
setLocale( rLocale );
- xLD = Reference< XLocaleData4 > (
- intl_createInstance( xSMgr, "com.sun.star.i18n.LocaleData",
- "LocaleDataWrapper" ), uno::UNO_QUERY );
+ xLD = LocaleData::create(comphelper::ComponentContext(xSMgr).getUNOContext());
}
More information about the Libreoffice-commits
mailing list