summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-10-15 15:20:48 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-10-23 15:27:49 +0200
commitc0f865c9b5a34b272c9e0b22d18969554265914a (patch)
treeee4bc2c0579245e92f51c82d91136e32cce7c9ca /sd
parente41f21b4165e40e1564cc75928b4b085ce7072e1 (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 'sd')
-rw-r--r--sd/source/core/CustomAnimationEffect.cxx86
-rw-r--r--sd/source/filter/eppt/pptx-text.cxx12
2 files changed, 45 insertions, 53 deletions
diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx
index 65fbb4ad17f3..78fe9adb607b 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -54,7 +54,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
#include <com/sun/star/lang/Locale.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <com/sun/star/i18n/BreakIterator.hpp>
#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
#include <com/sun/star/i18n/WordType.hpp>
#include <com/sun/star/presentation/TextAnimationType.hpp>
@@ -317,65 +317,61 @@ sal_Int32 CustomAnimationEffect::getNumberOfSubitems( const Any& aTarget, sal_In
if( xShape.is() )
{
// TODO/LATER: Optimize this, don't create a break iterator each time
- Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
- Reference < i18n::XBreakIterator > xBI( xMSF->createInstance( "com.sun.star.i18n.BreakIterator" ), UNO_QUERY );
- DBG_ASSERT( xBI.is(), "sd::CustomAnimationEffect::getNumberOfSubitems(), could not create a 'com.sun.star.i18n.BreakIterator'!" );
+ Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ Reference < i18n::XBreakIterator > xBI = i18n::BreakIterator::create(xContext);
- if( xBI.is() )
+ Reference< XEnumerationAccess > xEA( xShape, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEA->createEnumeration(), UNO_QUERY_THROW );
+ Locale aLocale;
+ const OUString aStrLocaleName( "CharLocale" );
+ Reference< XTextRange > xParagraph;
+
+ sal_Int32 nPara = 0;
+ while( xEnumeration->hasMoreElements() )
{
- Reference< XEnumerationAccess > xEA( xShape, UNO_QUERY_THROW );
- Reference< XEnumeration > xEnumeration( xEA->createEnumeration(), UNO_QUERY_THROW );
- Locale aLocale;
- const OUString aStrLocaleName( "CharLocale" );
- Reference< XTextRange > xParagraph;
+ xEnumeration->nextElement() >>= xParagraph;
- sal_Int32 nPara = 0;
- while( xEnumeration->hasMoreElements() )
+ // skip this if its not the only paragraph we want to count
+ if( (nOnlyPara != -1) && (nOnlyPara != nPara ) )
+ continue;
+
+ if( nIterateType == TextAnimationType::BY_PARAGRAPH )
{
- xEnumeration->nextElement() >>= xParagraph;
+ nSubItems++;
+ }
+ else
+ {
+ const OUString aText( xParagraph->getString() );
+ Reference< XPropertySet > xSet( xParagraph, UNO_QUERY_THROW );
+ xSet->getPropertyValue( aStrLocaleName ) >>= aLocale;
- // skip this if its not the only paragraph we want to count
- if( (nOnlyPara != -1) && (nOnlyPara != nPara ) )
- continue;
+ sal_Int32 nPos;
+ const sal_Int32 nEndPos = aText.getLength();
- if( nIterateType == TextAnimationType::BY_PARAGRAPH )
+ if( nIterateType == TextAnimationType::BY_WORD )
{
- nSubItems++;
+ for( nPos = 0; nPos < nEndPos; nPos++ )
+ {
+ nPos = xBI->getWordBoundary(aText, nPos, aLocale, i18n::WordType::ANY_WORD, sal_True).endPos;
+ nSubItems++;
+ }
+ break;
}
else
{
- const OUString aText( xParagraph->getString() );
- Reference< XPropertySet > xSet( xParagraph, UNO_QUERY_THROW );
- xSet->getPropertyValue( aStrLocaleName ) >>= aLocale;
-
- sal_Int32 nPos;
- const sal_Int32 nEndPos = aText.getLength();
-
- if( nIterateType == TextAnimationType::BY_WORD )
+ sal_Int32 nDone;
+ for( nPos = 0; nPos < nEndPos; nPos++ )
{
- for( nPos = 0; nPos < nEndPos; nPos++ )
- {
- nPos = xBI->getWordBoundary(aText, nPos, aLocale, i18n::WordType::ANY_WORD, sal_True).endPos;
- nSubItems++;
- }
- break;
- }
- else
- {
- sal_Int32 nDone;
- for( nPos = 0; nPos < nEndPos; nPos++ )
- {
- nPos = xBI->nextCharacters(aText, nPos, aLocale, i18n::CharacterIteratorMode::SKIPCELL, 0, nDone);
- nSubItems++;
- }
+ nPos = xBI->nextCharacters(aText, nPos, aLocale, i18n::CharacterIteratorMode::SKIPCELL, 0, nDone);
+ nSubItems++;
}
}
+ }
- if( nPara == nOnlyPara )
- break;
+ if( nPara == nOnlyPara )
+ break;
- nPara++;
- }
+ nPara++;
}
}
}
diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
index f1bc0dd32e1f..bd8d8d4812c9 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -34,7 +34,7 @@
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XIndexReplace.hpp>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <com/sun/star/i18n/BreakIterator.hpp>
#include <com/sun/star/i18n/ScriptDirection.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <com/sun/star/text/FontRelief.hpp>
@@ -1298,13 +1298,9 @@ FontCollection::~FontCollection()
FontCollection::FontCollection() :
pVDev ( NULL )
{
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
- xMSF = ::comphelper::getProcessServiceFactory();
- com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
- xInterface = xMSF->createInstance( "com.sun.star.i18n.BreakIterator" );
- if ( xInterface.is() )
- xPPTBreakIter = com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator >
- ( xInterface, com::sun::star::uno::UNO_QUERY );
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ xContext = ::comphelper::getProcessComponentContext();
+ xPPTBreakIter = com::sun::star::i18n::BreakIterator::create( xContext );
}
short FontCollection::GetScriptDirection( const rtl::OUString& rString ) const