diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-15 15:20:48 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-23 15:27:49 +0200 |
commit | c0f865c9b5a34b272c9e0b22d18969554265914a (patch) | |
tree | ee4bc2c0579245e92f51c82d91136e32cce7c9ca /svx | |
parent | e41f21b4165e40e1564cc75928b4b085ce7072e1 (diff) |
fdo#46808, use service constructor for i18n::BreakIterator
Note that I found a pre-existing bug in linguistic/source/gciterator.cxx
but I was not able to fix it, because doing so appears to expose
bugs elsewhere!
Change-Id: I17fb9108d98a98d0ae13fe5a8e043d2db5b27a6a
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 12 | ||||
-rw-r--r-- | svx/source/dialog/fntctrl.cxx | 74 | ||||
-rw-r--r-- | svx/source/svdraw/svdotextpathdecomposition.cxx | 12 |
3 files changed, 42 insertions, 56 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index da4394481002..f46c72e9e67c 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -56,6 +56,7 @@ #include <numeric> #include <algorithm> #include <comphelper/processfactory.hxx> +#include <com/sun/star/i18n/BreakIterator.hpp> #include <com/sun/star/i18n/ScriptType.hpp> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -833,19 +834,14 @@ SdrObject* CreateSdrObjectFromParagraphOutlines( const FWData& rFWData, const Sd return pRet; } -::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > EnhancedCustomShapeFontWork::mxBreakIterator = 0; +Reference < i18n::XBreakIterator > EnhancedCustomShapeFontWork::mxBreakIterator = 0; Reference < i18n::XBreakIterator > EnhancedCustomShapeFontWork::GetBreakIterator() { if ( !mxBreakIterator.is() ) { - Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference < XInterface > xI = xMSF->createInstance( rtl::OUString("com.sun.star.i18n.BreakIterator") ); - if ( xI.is() ) - { - Any x = xI->queryInterface( ::getCppuType((const Reference< i18n::XBreakIterator >*)0) ); - x >>= mxBreakIterator; - } + Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + mxBreakIterator = i18n::BreakIterator::create(xContext); } return mxBreakIterator; } diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index cc775a58e55d..2c37904575ea 100644 --- a/svx/source/dialog/fntctrl.cxx +++ b/svx/source/dialog/fntctrl.cxx @@ -33,7 +33,7 @@ #include <vcl/svapp.hxx> #include <unicode/uchar.h> #include <com/sun/star/uno/Reference.h> -#include <com/sun/star/i18n/XBreakIterator.hpp> +#include <com/sun/star/i18n/BreakIterator.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> @@ -87,6 +87,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using ::com::sun::star::i18n::XBreakIterator; +using ::com::sun::star::i18n::BreakIterator; // ----------------------------------------------------------------------- // small helper functions to set fonts @@ -251,55 +252,50 @@ void FontPrevWin_Impl::CheckScript() if( !xBreak.is() ) { - Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - xBreak = Reference< XBreakIterator >(xMSF->createInstance( - ::rtl::OUString("com.sun.star.i18n.BreakIterator") ),UNO_QUERY); + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + xBreak = BreakIterator::create(xContext); } - assert(xBreak.is()); // no can do without breakiter - if( xBreak.is() ) + sal_uInt16 nScript = xBreak->getScriptType( aText, 0 ); + sal_uInt16 nChg = 0; + if( com::sun::star::i18n::ScriptType::WEAK == nScript ) { - sal_uInt16 nScript = xBreak->getScriptType( aText, 0 ); - sal_uInt16 nChg = 0; - if( com::sun::star::i18n::ScriptType::WEAK == nScript ) - { - nChg = (xub_StrLen)xBreak->endOfScript( aText, nChg, nScript ); - if( nChg < aText.Len() ) - nScript = xBreak->getScriptType( aText, nChg ); - else - nScript = com::sun::star::i18n::ScriptType::LATIN; - } + nChg = (xub_StrLen)xBreak->endOfScript( aText, nChg, nScript ); + if( nChg < aText.Len() ) + nScript = xBreak->getScriptType( aText, nChg ); + else + nScript = com::sun::star::i18n::ScriptType::LATIN; + } - do + do + { + nChg = (xub_StrLen)xBreak->endOfScript( aText, nChg, nScript ); + if (nChg < aText.Len() && nChg > 0 && + (com::sun::star::i18n::ScriptType::WEAK == + xBreak->getScriptType(aText, nChg - 1))) { - nChg = (xub_StrLen)xBreak->endOfScript( aText, nChg, nScript ); - if (nChg < aText.Len() && nChg > 0 && - (com::sun::star::i18n::ScriptType::WEAK == - xBreak->getScriptType(aText, nChg - 1))) + int8_t nType = u_charType(aText.GetChar(nChg) ); + if (nType == U_NON_SPACING_MARK || nType == U_ENCLOSING_MARK || + nType == U_COMBINING_SPACING_MARK ) { - int8_t nType = u_charType(aText.GetChar(nChg) ); - if (nType == U_NON_SPACING_MARK || nType == U_ENCLOSING_MARK || - nType == U_COMBINING_SPACING_MARK ) - { - aScriptChg.push_back( nChg - 1 ); - } - else - { - aScriptChg.push_back( nChg ); - } + aScriptChg.push_back( nChg - 1 ); } else { aScriptChg.push_back( nChg ); } - aScriptType.push_back( nScript ); - aTextWidth.push_back( 0 ); + } + else + { + aScriptChg.push_back( nChg ); + } + aScriptType.push_back( nScript ); + aTextWidth.push_back( 0 ); - if( nChg < aText.Len() ) - nScript = xBreak->getScriptType( aText, nChg ); - else - break; - } while( sal_True ); - } + if( nChg < aText.Len() ) + nScript = xBreak->getScriptType( aText, nChg ); + else + break; + } while( sal_True ); } /* diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index f0935bb0ae0c..889052801ae0 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -41,7 +41,7 @@ #include <vcl/virdev.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/i18n/ScriptType.hpp> -#include <com/sun/star/i18n/XBreakIterator.hpp> +#include <com/sun/star/i18n/BreakIterator.hpp> #include <comphelper/processfactory.hxx> #include <com/sun/star/i18n/CharacterIteratorMode.hpp> #include <editeng/unolingu.hxx> @@ -270,14 +270,8 @@ namespace mrShadowDecomposition(rShadowDecomposition) { // prepare BreakIterator - Reference < XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference < XInterface > xInterface = xMSF->createInstance(::rtl::OUString("com.sun.star.i18n.BreakIterator")); - - if(xInterface.is()) - { - Any x = xInterface->queryInterface(::getCppuType((const Reference< XBreakIterator >*)0)); - x >>= mxBreak; - } + Reference < XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + mxBreak = com::sun::star::i18n::BreakIterator::create(xContext); } void HandlePair(const basegfx::B2DPolygon rPolygonCandidate, const ::std::vector< const impPathTextPortion* >& rTextPortions) |