summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-11-02 15:13:28 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-11-05 18:05:00 +0100
commit0666e43c45876199ddc71e378554878cca6f0539 (patch)
tree39fd44bd26cceaa71a86a06c480d80c8351b5e0f /xmloff
parentebc61e11cdb02f5cc33aeabead3d191eaf0d23d3 (diff)
fdo#46808, use service constructor for i18n::CharacterClassification
Change-Id: I0499ad7de27b1539e97f01ab8aa0ef2d6713ae76
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/core/xmluconv.cxx20
-rw-r--r--xmloff/source/style/xmlnumfe.cxx8
-rw-r--r--xmloff/source/transform/TransformerBase.cxx62
3 files changed, 28 insertions, 62 deletions
diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
index 7aa93280c769..fc8303d97af9 100644
--- a/xmloff/source/core/xmluconv.cxx
+++ b/xmloff/source/core/xmluconv.cxx
@@ -47,7 +47,7 @@
#include <com/sun/star/text/XDefaultNumberingProvider.hpp>
#include <com/sun/star/text/XNumberingTypeInfo.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/i18n/XCharacterClassification.hpp>
+#include <com/sun/star/i18n/CharacterClassification.hpp>
#include <com/sun/star/i18n/UnicodeType.hpp>
#include <basegfx/vector/b3dvector.hxx>
#include <comphelper/processfactory.hxx>
@@ -810,21 +810,9 @@ OUString SvXMLUnitConverter::encodeStyleName(
{
if (m_pImpl->m_xServiceFactory.is())
{
- try
- {
- const_cast < SvXMLUnitConverter * >(this)
- ->m_pImpl->m_xCharClass =
- Reference < XCharacterClassification >(
- m_pImpl->m_xServiceFactory->createInstance(
- OUString( "com.sun.star.i18n.CharacterClassification_Unicode") ),
- UNO_QUERY );
-
- OSL_ENSURE( m_pImpl->m_xCharClass.is(),
- "can't instantiate character clossification component" );
- }
- catch( com::sun::star::uno::Exception& )
- {
- }
+ const_cast < SvXMLUnitConverter * >(this)
+ ->m_pImpl->m_xCharClass = CharacterClassification::create(
+ comphelper::getComponentContext(m_pImpl->m_xServiceFactory) );
}
}
if (m_pImpl->m_xCharClass.is())
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index d2c1782890fa..4d6373d1f30b 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -245,7 +245,7 @@ SvXMLNumFmtExport::SvXMLNumFmtExport(
if ( pFormatter )
{
- pCharClass = new CharClass( pFormatter->GetServiceManager(),
+ pCharClass = new CharClass( comphelper::getComponentContext(pFormatter->GetServiceManager()),
pFormatter->GetLocale() );
pLocaleData = new LocaleDataWrapper( pFormatter->GetServiceManager(),
pFormatter->GetLocale() );
@@ -254,7 +254,7 @@ SvXMLNumFmtExport::SvXMLNumFmtExport(
{
lang::Locale aLocale( MsLangId::convertLanguageToLocale( MsLangId::getSystemLanguage() ) );
- pCharClass = new CharClass( rExport.getServiceFactory(), aLocale );
+ pCharClass = new CharClass( comphelper::getComponentContext(rExport.getServiceFactory()), aLocale );
pLocaleData = new LocaleDataWrapper( rExport.getServiceFactory(), aLocale );
}
@@ -280,7 +280,7 @@ SvXMLNumFmtExport::SvXMLNumFmtExport(
if ( pFormatter )
{
- pCharClass = new CharClass( pFormatter->GetServiceManager(),
+ pCharClass = new CharClass( comphelper::getComponentContext(pFormatter->GetServiceManager()),
pFormatter->GetLocale() );
pLocaleData = new LocaleDataWrapper( pFormatter->GetServiceManager(),
pFormatter->GetLocale() );
@@ -289,7 +289,7 @@ SvXMLNumFmtExport::SvXMLNumFmtExport(
{
lang::Locale aLocale( MsLangId::convertLanguageToLocale( MsLangId::getSystemLanguage() ) );
- pCharClass = new CharClass( rExport.getServiceFactory(), aLocale );
+ pCharClass = new CharClass( comphelper::getComponentContext(rExport.getServiceFactory()), aLocale );
pLocaleData = new LocaleDataWrapper( rExport.getServiceFactory(), aLocale );
}
diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx
index 53323118c6cf..851ec4442e3f 100644
--- a/xmloff/source/transform/TransformerBase.cxx
+++ b/xmloff/source/transform/TransformerBase.cxx
@@ -28,7 +28,7 @@
#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
-#include <com/sun/star/i18n/XCharacterClassification.hpp>
+#include <com/sun/star/i18n/CharacterClassification.hpp>
#include <com/sun/star/i18n/UnicodeType.hpp>
#include <com/sun/star/util/MeasureUnit.hpp>
#include <sax/tools/converter.hxx>
@@ -1062,49 +1062,27 @@ sal_Bool XMLTransformerBase::EncodeStyleName( OUString& rName ) const
{
if( !xCharClass.is() )
{
- Reference< XMultiServiceFactory > xFactory =
- comphelper::getProcessServiceFactory();
- if( xFactory.is() )
- {
- try
- {
- const_cast < XMLTransformerBase * >(this)
- ->xCharClass =
- Reference < XCharacterClassification >(
- xFactory->createInstance(
- OUString(
- "com.sun.star.i18n.CharacterClassification_Unicode") ),
- UNO_QUERY );
-
- OSL_ENSURE( xCharClass.is(),
- "can't instantiate character clossification component" );
- }
- catch( com::sun::star::uno::Exception& )
- {
- }
- }
+ const_cast < XMLTransformerBase * >(this)
+ ->xCharClass = CharacterClassification::create( comphelper::getProcessComponentContext() );
}
- if( xCharClass.is() )
- {
- sal_Int16 nType = xCharClass->getType( rName, i );
+ sal_Int16 nType = xCharClass->getType( rName, i );
- switch( nType )
- {
- case UnicodeType::UPPERCASE_LETTER: // Lu
- case UnicodeType::LOWERCASE_LETTER: // Ll
- case UnicodeType::TITLECASE_LETTER: // Lt
- case UnicodeType::OTHER_LETTER: // Lo
- case UnicodeType::LETTER_NUMBER: // Nl
- bValidChar = sal_True;
- break;
- case UnicodeType::NON_SPACING_MARK: // Ms
- case UnicodeType::ENCLOSING_MARK: // Me
- case UnicodeType::COMBINING_SPACING_MARK: //Mc
- case UnicodeType::MODIFIER_LETTER: // Lm
- case UnicodeType::DECIMAL_DIGIT_NUMBER: // Nd
- bValidChar = i > 0;
- break;
- }
+ switch( nType )
+ {
+ case UnicodeType::UPPERCASE_LETTER: // Lu
+ case UnicodeType::LOWERCASE_LETTER: // Ll
+ case UnicodeType::TITLECASE_LETTER: // Lt
+ case UnicodeType::OTHER_LETTER: // Lo
+ case UnicodeType::LETTER_NUMBER: // Nl
+ bValidChar = sal_True;
+ break;
+ case UnicodeType::NON_SPACING_MARK: // Ms
+ case UnicodeType::ENCLOSING_MARK: // Me
+ case UnicodeType::COMBINING_SPACING_MARK: //Mc
+ case UnicodeType::MODIFIER_LETTER: // Lm
+ case UnicodeType::DECIMAL_DIGIT_NUMBER: // Nd
+ bValidChar = i > 0;
+ break;
}
}
}