summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--i18npool/source/characterclassification/cclass_unicode_parser.cxx19
-rw-r--r--offapi/UnoApi_offapi.mk2
-rw-r--r--svl/inc/svl/ondemand.hxx12
-rw-r--r--svl/source/numbers/zforlist.cxx2
-rw-r--r--unotools/inc/unotools/nativenumberwrapper.hxx7
-rw-r--r--unotools/source/i18n/nativenumberwrapper.cxx11
6 files changed, 16 insertions, 37 deletions
diff --git a/i18npool/source/characterclassification/cclass_unicode_parser.cxx b/i18npool/source/characterclassification/cclass_unicode_parser.cxx
index 24ec060fc613..c3f5ac5b72ca 100644
--- a/i18npool/source/characterclassification/cclass_unicode_parser.cxx
+++ b/i18npool/source/characterclassification/cclass_unicode_parser.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/i18n/UnicodeType.hpp>
#include <com/sun/star/i18n/LocaleData.hpp>
#include <com/sun/star/i18n/NativeNumberMode.hpp>
+#include <com/sun/star/i18n/NativeNumberSupplier.hpp>
#include <comphelper/processfactory.hxx>
#include <string.h> // memcpy()
@@ -1006,26 +1007,10 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32
{
if ( !xNatNumSup.is() )
{
-#define NATIVENUMBERSUPPLIER_SERVICENAME "com.sun.star.i18n.NativeNumberSupplier"
if ( xMSF.is() )
{
- xNatNumSup = Reference< XNativeNumberSupplier > (
- xMSF->createInstance( OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- NATIVENUMBERSUPPLIER_SERVICENAME ) ) ),
- UNO_QUERY );
+ xNatNumSup = NativeNumberSupplier::create( comphelper::getComponentContext(xMSF) );
}
- if ( !xNatNumSup.is() )
- {
- throw RuntimeException( OUString(
-#ifdef DBG_UTIL
- RTL_CONSTASCII_USTRINGPARAM(
- "cclass_Unicode::parseText: can't instanciate "
- NATIVENUMBERSUPPLIER_SERVICENAME )
-#endif
- ), *this );
- }
-#undef NATIVENUMBERSUPPLIER_SERVICENAME
}
OUString aTmp( pTextStart + r.LeadingWhiteSpace, r.EndPos - nPos +
r.LeadingWhiteSpace );
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index f01eb68f88d3..97b6394762eb 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -147,6 +147,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/i18n,\
CharacterClassification \
LocaleCalendar \
LocaleData \
+ NativeNumberSupplier \
NumberFormatMapper \
TextConversion \
Transliteration \
@@ -860,7 +861,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/i18n,\
Collator \
IndexEntrySupplier \
InputSequenceChecker \
- NativeNumberSupplier \
OrdinalSuffix \
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/image,\
diff --git a/svl/inc/svl/ondemand.hxx b/svl/inc/svl/ondemand.hxx
index 70c028f2ef52..1aa78516b57a 100644
--- a/svl/inc/svl/ondemand.hxx
+++ b/svl/inc/svl/ondemand.hxx
@@ -329,7 +329,7 @@ public:
*/
class OnDemandNativeNumberWrapper
{
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
mutable NativeNumberWrapper* pPtr;
bool bInitialized;
@@ -339,12 +339,12 @@ public:
, bInitialized(false)
{}
OnDemandNativeNumberWrapper(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
)
: pPtr(0)
, bInitialized(false)
{
- init( rxSMgr );
+ init( rxContext );
}
~OnDemandNativeNumberWrapper()
{
@@ -354,10 +354,10 @@ public:
bool isInitialized() const { return bInitialized; }
void init(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
)
{
- xSMgr = rxSMgr;
+ m_xContext = rxContext;
if ( pPtr )
{
delete pPtr;
@@ -371,7 +371,7 @@ public:
NativeNumberWrapper* get() const
{
if ( !pPtr )
- pPtr = new NativeNumberWrapper( xSMgr );
+ pPtr = new NativeNumberWrapper( m_xContext );
return pPtr;
}
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index a8bc1ca2bf30..9496d9acb841 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -240,7 +240,7 @@ void SvNumberFormatter::ImpConstruct( LanguageType eLang )
xCalendar.init( comphelper::getComponentContext(xServiceManager), maLanguageTag.getLocale() );
xTransliteration.init( comphelper::getComponentContext(xServiceManager), eLang,
::com::sun::star::i18n::TransliterationModules_IGNORE_CASE );
- xNatNum.init( xServiceManager );
+ xNatNum.init( comphelper::getComponentContext(xServiceManager) );
// cached locale data items
const LocaleDataWrapper* pLoc = GetLocaleData();
diff --git a/unotools/inc/unotools/nativenumberwrapper.hxx b/unotools/inc/unotools/nativenumberwrapper.hxx
index b8bac89a7cc0..dea1ee01e0f7 100644
--- a/unotools/inc/unotools/nativenumberwrapper.hxx
+++ b/unotools/inc/unotools/nativenumberwrapper.hxx
@@ -23,15 +23,14 @@
#include <com/sun/star/i18n/XNativeNumberSupplier.hpp>
namespace com { namespace sun { namespace star {
- namespace lang {
- class XMultiServiceFactory;
+ namespace uno {
+ class XComponentContext;
}
}}}
class UNOTOOLS_DLLPUBLIC NativeNumberWrapper
{
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
::com::sun::star::uno::Reference< ::com::sun::star::i18n::XNativeNumberSupplier > xNNS;
// not implemented, prevent usage
NativeNumberWrapper( const NativeNumberWrapper& );
@@ -39,7 +38,7 @@ class UNOTOOLS_DLLPUBLIC NativeNumberWrapper
public:
NativeNumberWrapper(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext
);
~NativeNumberWrapper();
diff --git a/unotools/source/i18n/nativenumberwrapper.cxx b/unotools/source/i18n/nativenumberwrapper.cxx
index 5fa8f0a0b943..59238084f695 100644
--- a/unotools/source/i18n/nativenumberwrapper.cxx
+++ b/unotools/source/i18n/nativenumberwrapper.cxx
@@ -20,20 +20,15 @@
#include <unotools/nativenumberwrapper.hxx>
#include <tools/debug.hxx>
-#include "instance.hxx"
+#include <com/sun/star/i18n/NativeNumberSupplier.hpp>
using namespace ::com::sun::star;
NativeNumberWrapper::NativeNumberWrapper(
- const uno::Reference< lang::XMultiServiceFactory > & xSF
+ const uno::Reference< uno::XComponentContext > & rxContext
)
- :
- xSMgr( xSF )
{
- xNNS = uno::Reference< i18n::XNativeNumberSupplier > (
- intl_createInstance( xSMgr, "com.sun.star.i18n.NativeNumberSupplier",
- "NativeNumberWrapper"), uno::UNO_QUERY );
- DBG_ASSERT( xNNS.is(), "NativeNumberWrapper: no NativeNumberSupplier" );
+ xNNS = i18n::NativeNumberSupplier::create(rxContext);
}