diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-03-07 23:50:19 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-03-08 12:02:37 +0000 |
commit | 5b395625901b1f9c2314a0b9a13f4876a3ae17ce (patch) | |
tree | 42f91df0ee35f2a55bac7da11442a4273c32b445 /sw | |
parent | 14c4c26cea838b3fffb0b17ba440c29a6066fad1 (diff) |
de-uno-ize ScriptTypeDetector
leave a UnoScriptTypeDetector implementation that points to the
trivial ScriptTypeDetector for external consumers, e.g. sdext
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/breakit.hxx | 8 | ||||
-rw-r--r-- | sw/source/core/bastyp/breakit.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/text/porlay.cxx | 11 |
3 files changed, 8 insertions, 18 deletions
diff --git a/sw/inc/breakit.hxx b/sw/inc/breakit.hxx index 05f4d9a8cb2c..34ae144d88a4 100644 --- a/sw/inc/breakit.hxx +++ b/sw/inc/breakit.hxx @@ -49,8 +49,6 @@ class SW_DLLPUBLIC SwBreakIt { com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMSF; mutable com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > xBreak; - com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector > xCTLDetect; - com::sun::star::lang::Locale * m_pLocale; com::sun::star::i18n::ForbiddenCharacters * m_pForbidden; @@ -89,12 +87,6 @@ public: return xBreak; } - com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector > GetScriptTypeDetector() - { - createScriptTypeDetector(); - return xCTLDetect; - } - const com::sun::star::lang::Locale& GetLocale( const LanguageType aLang ) { if( !m_pLocale || aLast != aLang ) diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx index bb9366023b7a..9b4476fa4d59 100644 --- a/sw/source/core/bastyp/breakit.cxx +++ b/sw/source/core/bastyp/breakit.cxx @@ -74,16 +74,13 @@ SwBreakIt::~SwBreakIt() delete m_pLocale; delete m_pForbidden; } + void SwBreakIt::createBreakIterator() const { if ( m_xMSF.is() && !xBreak.is() ) xBreak.set(m_xMSF->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator"))),uno::UNO_QUERY); } -void SwBreakIt::createScriptTypeDetector() -{ - if ( m_xMSF.is() && !xCTLDetect.is() ) - xCTLDetect.set(m_xMSF->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.ScriptTypeDetector" ))),uno::UNO_QUERY); -} + void SwBreakIt::_GetLocale( const LanguageType aLang ) { aLast = aLang; diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index ac773c5758a1..7f0e3874d01b 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -64,7 +64,8 @@ using namespace ::com::sun::star; using namespace i18n::ScriptType; #include <unicode/ubidi.h> -#include <i18nutil/unicode.hxx> //unicode::getUnicodeScriptType +#include <i18nutil/scripttypedetector.hxx> +#include <i18nutil/unicode.hxx> #define IS_JOINING_GROUP(c, g) ( u_getIntPropertyValue( (c), UCHAR_JOINING_GROUP ) == U_JG_##g ) #define isAinChar(c) IS_JOINING_GROUP((c), AIN) @@ -904,16 +905,16 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) // #i28203# // for 'complex' portions, we make sure that a portion does not contain more // than one script: - if( i18n::ScriptType::COMPLEX == nScript && pBreakIt->GetScriptTypeDetector().is() ) + if( i18n::ScriptType::COMPLEX == nScript ) { - const short nScriptType = pBreakIt->GetScriptTypeDetector()->getCTLScriptType( rTxt, nSearchStt ); + const short nScriptType = ScriptTypeDetector::getCTLScriptType( rTxt, nSearchStt ); xub_StrLen nNextCTLScriptStart = nSearchStt; short nCurrentScriptType = nScriptType; while( com::sun::star::i18n::CTLScriptType::CTL_UNKNOWN == nCurrentScriptType || nScriptType == nCurrentScriptType ) { - nNextCTLScriptStart = (xub_StrLen)pBreakIt->GetScriptTypeDetector()->endOfCTLScriptType( rTxt, nNextCTLScriptStart ); + nNextCTLScriptStart = (xub_StrLen)ScriptTypeDetector::endOfCTLScriptType( rTxt, nNextCTLScriptStart ); if( nNextCTLScriptStart < rTxt.Len() && nNextCTLScriptStart < nChg ) - nCurrentScriptType = pBreakIt->GetScriptTypeDetector()->getCTLScriptType( rTxt, nNextCTLScriptStart ); + nCurrentScriptType = ScriptTypeDetector::getCTLScriptType( rTxt, nNextCTLScriptStart ); else break; } |