[Libreoffice-commits] .: 2 commits - i18npool/inc i18npool/source offapi/UnoApi_offapi.mk svl/inc svl/source unotools/inc unotools/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Nov 27 09:18:46 PST 2012
i18npool/inc/breakiteratorImpl.hxx | 4 -
i18npool/inc/cclass_unicode.hxx | 5 --
i18npool/source/breakiterator/breakiteratorImpl.cxx | 8 +--
i18npool/source/characterclassification/cclass_unicode.cxx | 4 -
i18npool/source/characterclassification/cclass_unicode_parser.cxx | 23 +---------
i18npool/source/registerservices/registerservices.cxx | 4 -
offapi/UnoApi_offapi.mk | 2
svl/inc/svl/ondemand.hxx | 12 ++---
svl/source/numbers/zforlist.cxx | 2
unotools/inc/unotools/nativenumberwrapper.hxx | 7 +--
unotools/source/i18n/nativenumberwrapper.cxx | 11 +---
11 files changed, 30 insertions(+), 52 deletions(-)
New commits:
commit 9df0baaf0b2d0dc22b88d13848014b402937aac6
Author: Noel Grandin <noel at peralex.com>
Date: Mon Nov 5 15:19:49 2012 +0200
fdo#46808, convert i18n::BreakIterator impl to XComponentContext
Change-Id: I2e6800d0f5a6346fc743d5a57bab34d1e36b4ee4
diff --git a/i18npool/inc/breakiteratorImpl.hxx b/i18npool/inc/breakiteratorImpl.hxx
index 395c144..7a6ef2a 100644
--- a/i18npool/inc/breakiteratorImpl.hxx
+++ b/i18npool/inc/breakiteratorImpl.hxx
@@ -46,7 +46,7 @@ class BreakIteratorImpl : public cppu::WeakImplHelper2
>
{
public:
- BreakIteratorImpl( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
+ BreakIteratorImpl( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext );
BreakIteratorImpl();
~BreakIteratorImpl();
@@ -123,8 +123,8 @@ private :
std::vector<lookupTableItem*> lookupTable;
com::sun::star::lang::Locale aLocale;
com::sun::star::uno::Reference < XBreakIterator > xBI;
+ com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xContext;
- com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF;
sal_Bool SAL_CALL createLocaleSpecificBreakIterator( const rtl::OUString& aLocaleName )
throw( com::sun::star::uno::RuntimeException );
com::sun::star::uno::Reference < XBreakIterator > SAL_CALL getLocaleSpecificBreakIterator( const com::sun::star::lang::Locale& rLocale )
diff --git a/i18npool/inc/cclass_unicode.hxx b/i18npool/inc/cclass_unicode.hxx
index 340b72f..d515cfd 100644
--- a/i18npool/inc/cclass_unicode.hxx
+++ b/i18npool/inc/cclass_unicode.hxx
@@ -22,7 +22,6 @@
#include <com/sun/star/i18n/XNativeNumberSupplier.hpp>
#include <com/sun/star/i18n/XCharacterClassification.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>
@@ -36,7 +35,7 @@ typedef sal_uInt32 UPT_FLAG_TYPE;
class cclass_Unicode : public cppu::WeakImplHelper1 < XCharacterClassification >
{
public:
- cclass_Unicode(com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xSMgr );
+ cclass_Unicode(const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext );
~cclass_Unicode();
virtual rtl::OUString SAL_CALL toUpper( const rtl::OUString& Text, sal_Int32 nPos, sal_Int32 nCount,
@@ -118,7 +117,7 @@ private:
static const sal_Unicode* StrChr( const sal_Unicode* pStr, sal_Unicode c );
- com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF;
+ com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xContext;
/// used for parser only
com::sun::star::lang::Locale aParserLocale;
diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx
index 4ea8e48..4f2207a 100644
--- a/i18npool/source/breakiterator/breakiteratorImpl.cxx
+++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx
@@ -29,7 +29,7 @@ using namespace ::rtl;
namespace com { namespace sun { namespace star { namespace i18n {
-BreakIteratorImpl::BreakIteratorImpl( const Reference < XMultiServiceFactory >& rxMSF ) : xMSF( rxMSF )
+BreakIteratorImpl::BreakIteratorImpl( const Reference < XComponentContext >& rxContext ) : m_xContext( rxContext )
{
}
@@ -545,8 +545,8 @@ sal_Bool SAL_CALL BreakIteratorImpl::createLocaleSpecificBreakIterator(const OUS
}
}
- Reference < uno::XInterface > xI = xMSF->createInstance(
- OUString("com.sun.star.i18n.BreakIterator_") + aLocaleName);
+ Reference < uno::XInterface > xI = m_xContext->getServiceManager()->createInstanceWithContext(
+ OUString("com.sun.star.i18n.BreakIterator_") + aLocaleName, m_xContext);
if ( xI.is() ) {
xI->queryInterface( getCppuType((const Reference< XBreakIterator>*)0) ) >>= xBI;
@@ -563,7 +563,7 @@ BreakIteratorImpl::getLocaleSpecificBreakIterator(const Locale& rLocale) throw (
{
if (xBI.is() && rLocale == aLocale)
return xBI;
- else if (xMSF.is()) {
+ else if (m_xContext.is()) {
aLocale = rLocale;
for (size_t i = 0; i < lookupTable.size(); i++) {
diff --git a/i18npool/source/characterclassification/cclass_unicode.cxx b/i18npool/source/characterclassification/cclass_unicode.cxx
index da8529b..5e27fa5 100644
--- a/i18npool/source/characterclassification/cclass_unicode.cxx
+++ b/i18npool/source/characterclassification/cclass_unicode.cxx
@@ -35,7 +35,7 @@ namespace com { namespace sun { namespace star { namespace i18n {
// class cclass_Unicode
// ----------------------------------------------------;
-cclass_Unicode::cclass_Unicode( uno::Reference < XMultiServiceFactory > xSMgr ) : xMSF( xSMgr ),
+cclass_Unicode::cclass_Unicode( const uno::Reference < XComponentContext >& rxContext ) : m_xContext( rxContext ),
pTable( NULL ),
pStart( NULL ),
pCont( NULL ),
@@ -90,7 +90,7 @@ cclass_Unicode::toTitle( const OUString& Text, sal_Int32 nPos, sal_Int32 nCount,
trans->setMappingType(MappingTypeToTitle, rLocale);
rtl_uString* pStr = comphelper::string::rtl_uString_alloc(nCount);
sal_Unicode* out = pStr->buffer;
- BreakIteratorImpl brk(xMSF);
+ BreakIteratorImpl brk(m_xContext);
Boundary bdy = brk.getWordBoundary(Text, nPos, rLocale,
WordType::ANYWORD_IGNOREWHITESPACES, sal_True);
for (sal_Int32 i = nPos; i < nCount + nPos; i++, out++) {
diff --git a/i18npool/source/characterclassification/cclass_unicode_parser.cxx b/i18npool/source/characterclassification/cclass_unicode_parser.cxx
index c3f5ac5..3f3de5b 100644
--- a/i18npool/source/characterclassification/cclass_unicode_parser.cxx
+++ b/i18npool/source/characterclassification/cclass_unicode_parser.cxx
@@ -402,7 +402,7 @@ sal_Bool cclass_Unicode::setupInternational( const Locale& rLocale )
}
if ( !mxLocaleData.is() )
{
- mxLocaleData.set( LocaleData::create(comphelper::getComponentContext(xMSF)) );
+ mxLocaleData.set( LocaleData::create(m_xContext) );
}
return bChanged;
}
@@ -1007,9 +1007,9 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32
{
if ( !xNatNumSup.is() )
{
- if ( xMSF.is() )
+ if ( m_xContext.is() )
{
- xNatNumSup = NativeNumberSupplier::create( comphelper::getComponentContext(xMSF) );
+ xNatNumSup = NativeNumberSupplier::create( m_xContext );
}
}
OUString aTmp( pTextStart + r.LeadingWhiteSpace, r.EndPos - nPos +
diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx
index c837022..44e00d3 100644
--- a/i18npool/source/registerservices/registerservices.cxx
+++ b/i18npool/source/registerservices/registerservices.cxx
@@ -146,7 +146,7 @@ IMPL_CREATEINSTANCE( Calendar_ROC )
IMPL_CREATEINSTANCE( Calendar_hijri )
IMPL_CREATEINSTANCE( Calendar_jewish )
IMPL_CREATEINSTANCE( Calendar_buddhist )
-IMPL_CREATEINSTANCE_MSF( BreakIteratorImpl )
+IMPL_CREATEINSTANCE_CTX( BreakIteratorImpl )
IMPL_CREATEINSTANCE( BreakIterator_Unicode )
IMPL_CREATEINSTANCE( BreakIterator_ja )
IMPL_CREATEINSTANCE( BreakIterator_zh )
@@ -158,7 +158,7 @@ IMPL_CREATEINSTANCE_MSF( CollatorImpl )
IMPL_CREATEINSTANCE( Collator_Unicode )
IMPL_CREATEINSTANCE_MSF( CharacterClassificationImpl )
-IMPL_CREATEINSTANCE_MSF( cclass_Unicode )
+IMPL_CREATEINSTANCE_CTX( cclass_Unicode )
IMPL_CREATEINSTANCE_CTX( TransliterationImpl )
IMPL_CREATEINSTANCE( UnoScriptTypeDetector )
commit c2bbc9797c2fef9078c11460100996972bebd971
Author: Noel Grandin <noel at peralex.com>
Date: Mon Nov 5 15:07:20 2012 +0200
fdo#46808, use service constructor for i18n::NativeNumberSupplier
Change-Id: I092ca8f912e26f0743909920c6e740d648b8677e
diff --git a/i18npool/source/characterclassification/cclass_unicode_parser.cxx b/i18npool/source/characterclassification/cclass_unicode_parser.cxx
index 24ec060..c3f5ac5 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 f01eb68..97b6394 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 70c028f..1aa7851 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 a8bc1ca..9496d9a 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 b8bac89..dea1ee0 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 5fa8f0a..5923808 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);
}
More information about the Libreoffice-commits
mailing list