diff options
author | Noel Grandin <noel@peralex.com> | 2013-02-01 17:35:50 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-02-12 10:14:42 +0200 |
commit | 790b0c4d5328ccdb6e57206f1db2cd042335c635 (patch) | |
tree | 9b725cec1170b2506ce1a8957d1f8d2a27eda0fa /editeng/source | |
parent | e2ab5539a4a68f443cf7f77784a820e280fc969f (diff) |
fdo#46808, convert i18n::OrdinalSuffix to new-style
Change-Id: I62d0d3455d81bf9a2ea485b74faa5f1ecd417d87
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index a6a483ca53c9..ccc0f4eed2b5 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -31,7 +31,7 @@ #include <unotools/collatorwrapper.hxx> #include <com/sun/star/i18n/CollatorOptions.hpp> #include <com/sun/star/i18n/UnicodeScript.hpp> -#include <com/sun/star/i18n/XOrdinalSuffix.hpp> +#include <com/sun/star/i18n/OrdinalSuffix.hpp> #include <unotools/localedatawrapper.hxx> #include <unotools/transliterationwrapper.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -442,35 +442,29 @@ sal_Bool SvxAutoCorrect::FnChgOrdinalNumber( sal_Int32 nNum = rTxt.Copy( nSttPos, nNumEnd - nSttPos + 1 ).ToInt32( ); // Check if the characters after that number correspond to the ordinal suffix - rtl::OUString sServiceName("com.sun.star.i18n.OrdinalSuffix"); - uno::Reference< i18n::XOrdinalSuffix > xOrdSuffix( - comphelper::getProcessServiceFactory()->createInstance( sServiceName ), - uno::UNO_QUERY ); + uno::Reference< i18n::XOrdinalSuffix > xOrdSuffix + = i18n::OrdinalSuffix::create( comphelper::getProcessComponentContext() ); - if ( xOrdSuffix.is( ) ) + uno::Sequence< rtl::OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix( nNum, rCC.getLanguageTag().getLocale( ) ); + for ( sal_Int32 nSuff = 0; nSuff < aSuffixes.getLength(); nSuff++ ) { - uno::Sequence< rtl::OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix( nNum, rCC.getLanguageTag().getLocale( ) ); - for ( sal_Int32 nSuff = 0; nSuff < aSuffixes.getLength(); nSuff++ ) - { - String sSuffix( aSuffixes[ nSuff ] ); - String sEnd = rTxt.Copy( nNumEnd + 1, nEndPos - nNumEnd - 1 ); + String sSuffix( aSuffixes[ nSuff ] ); + String sEnd = rTxt.Copy( nNumEnd + 1, nEndPos - nNumEnd - 1 ); - if ( sSuffix == sEnd ) + if ( sSuffix == sEnd ) + { + // Check if the ordinal suffix has to be set as super script + if ( rCC.isLetter( sSuffix ) ) { - // Check if the ordinal suffix has to be set as super script - if ( rCC.isLetter( sSuffix ) ) - { - // Do the change - SvxEscapementItem aSvxEscapementItem( DFLT_ESC_AUTO_SUPER, - DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT ); - rDoc.SetAttr( nNumEnd + 1 , nEndPos, - SID_ATTR_CHAR_ESCAPEMENT, - aSvxEscapementItem); - } + // Do the change + SvxEscapementItem aSvxEscapementItem( DFLT_ESC_AUTO_SUPER, + DFLT_ESC_PROP, SID_ATTR_CHAR_ESCAPEMENT ); + rDoc.SetAttr( nNumEnd + 1 , nEndPos, + SID_ATTR_CHAR_ESCAPEMENT, + aSvxEscapementItem); } } } - } return bChg; } |