diff options
-rw-r--r-- | avmedia/source/viewer/mediawindowbase_impl.cxx | 58 | ||||
-rw-r--r-- | drawinglayer/source/primitive2d/controlprimitive2d.cxx | 17 | ||||
-rw-r--r-- | drawinglayer/source/primitive2d/textbreakuphelper.cxx | 125 |
3 files changed, 94 insertions, 106 deletions
diff --git a/avmedia/source/viewer/mediawindowbase_impl.cxx b/avmedia/source/viewer/mediawindowbase_impl.cxx index 74dc1d3f8304..cc54a180c9cb 100644 --- a/avmedia/source/viewer/mediawindowbase_impl.cxx +++ b/avmedia/source/viewer/mediawindowbase_impl.cxx @@ -46,7 +46,6 @@ MediaWindowBaseImpl::MediaWindowBaseImpl( MediaWindow* pMediaWindow ) MediaWindowBaseImpl::~MediaWindowBaseImpl() { - uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); } // ------------------------------------------------------------------------- @@ -54,42 +53,37 @@ MediaWindowBaseImpl::~MediaWindowBaseImpl() uno::Reference< media::XPlayer > MediaWindowBaseImpl::createPlayer( const ::rtl::OUString& rURL ) { uno::Reference< media::XPlayer > xPlayer; - uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - if( xFactory.is() ) - { - static const char * aServiceManagers[] = { - AVMEDIA_MANAGER_SERVICE_NAME, + static const char * aServiceManagers[] = { + AVMEDIA_MANAGER_SERVICE_NAME, // a fallback path just for gstreamer which has // two significant versions deployed at once ... #ifdef AVMEDIA_MANAGER_SERVICE_NAME_OLD - AVMEDIA_MANAGER_SERVICE_NAME_OLD + AVMEDIA_MANAGER_SERVICE_NAME_OLD #endif - }; + }; - for( sal_uInt32 i = 0; !xPlayer.is() && i < SAL_N_ELEMENTS( aServiceManagers ); ++i ) - { - const rtl::OUString aServiceName( aServiceManagers[ i ], - strlen( aServiceManagers[ i ] ), - RTL_TEXTENCODING_ASCII_US ); - - uno::Reference< ::com::sun::star::media::XManager > xManager; - - try { - xManager = uno::Reference< ::com::sun::star::media::XManager >( - xFactory->createInstance( aServiceName ), uno::UNO_QUERY ); - if( xManager.is() ) - xPlayer = uno::Reference< media::XPlayer >( xManager->createPlayer( rURL ), - uno::UNO_QUERY ); - else - SAL_WARN( "avmedia", - "failed to create media player service " << aServiceName ); - } catch ( const uno::Exception &e ) { - SAL_WARN( - "avmedia", - "couldn't create media player " AVMEDIA_MANAGER_SERVICE_NAME - ", exception '" << e.Message << '\''); - } + for( sal_uInt32 i = 0; !xPlayer.is() && i < SAL_N_ELEMENTS( aServiceManagers ); ++i ) + { + const rtl::OUString aServiceName( aServiceManagers[ i ], + strlen( aServiceManagers[ i ] ), + RTL_TEXTENCODING_ASCII_US ); + + try { + uno::Reference< media::XManager > xManager ( + xContext->getServiceManager()->createInstanceWithContext(aServiceName, xContext), + uno::UNO_QUERY ); + if( xManager.is() ) + xPlayer = uno::Reference< media::XPlayer >( xManager->createPlayer( rURL ), + uno::UNO_QUERY ); + else + SAL_WARN( "avmedia", + "failed to create media player service " << aServiceName ); + } catch ( const uno::Exception &e ) { + SAL_WARN( "avmedia", + "couldn't create media player " AVMEDIA_MANAGER_SERVICE_NAME + ", exception '" << e.Message << '\''); } } @@ -233,7 +227,7 @@ bool MediaWindowBaseImpl::setZoom( ::com::sun::star::media::ZoomLevel eLevel ) ::com::sun::star::media::ZoomLevel MediaWindowBaseImpl::getZoom() const { - return( mxPlayerWindow.is() ? mxPlayerWindow->getZoomLevel() : ::com::sun::star::media::ZoomLevel_NOT_AVAILABLE ); + return( mxPlayerWindow.is() ? mxPlayerWindow->getZoomLevel() : media::ZoomLevel_NOT_AVAILABLE ); } // --------------------------------------------------------------------- diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx index cb09566ccf17..0c94adaa6857 100644 --- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx @@ -62,19 +62,16 @@ namespace drawinglayer { if(!aUnoControlTypeName.isEmpty()) { - uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() ); + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + uno::Reference< awt::XControl > xXControl( + xContext->getServiceManager()->createInstanceWithContext(aUnoControlTypeName, xContext), uno::UNO_QUERY); - if(xFactory.is()) + if(xXControl.is()) { - uno::Reference< awt::XControl > xXControl(xFactory->createInstance(aUnoControlTypeName), uno::UNO_QUERY); + xXControl->setModel(getControlModel()); - if(xXControl.is()) - { - xXControl->setModel(getControlModel()); - - // remember XControl - mxXControl = xXControl; - } + // remember XControl + mxXControl = xXControl; } } } diff --git a/drawinglayer/source/primitive2d/textbreakuphelper.cxx b/drawinglayer/source/primitive2d/textbreakuphelper.cxx index 6a4a40cc1076..60f943d94b20 100644 --- a/drawinglayer/source/primitive2d/textbreakuphelper.cxx +++ b/drawinglayer/source/primitive2d/textbreakuphelper.cxx @@ -19,7 +19,7 @@ #include <drawinglayer/primitive2d/textbreakuphelper.hxx> #include <drawinglayer/primitive2d/textdecoratedprimitive2d.hxx> -#include <com/sun/star/i18n/XBreakIterator.hpp> +#include <com/sun/star/i18n/BreakIterator.hpp> #include <comphelper/processfactory.hxx> #include <com/sun/star/i18n/CharacterIteratorMode.hdl> #include <com/sun/star/i18n/WordType.hpp> @@ -193,93 +193,90 @@ namespace drawinglayer if(!xBreakIterator.is()) { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF(::comphelper::getProcessServiceFactory()); - xBreakIterator.set(xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.i18n.BreakIterator")), ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + xBreakIterator = ::com::sun::star::i18n::BreakIterator::create(xContext); } - if(xBreakIterator.is()) - { - const rtl::OUString& rTxt = mrSource.getText(); - const sal_Int32 nTextLength(mrSource.getTextLength()); - const ::com::sun::star::lang::Locale& rLocale = mrSource.getLocale(); - const sal_Int32 nTextPosition(mrSource.getTextPosition()); - sal_Int32 nCurrent(nTextPosition); + const rtl::OUString& rTxt = mrSource.getText(); + const sal_Int32 nTextLength(mrSource.getTextLength()); + const ::com::sun::star::lang::Locale& rLocale = mrSource.getLocale(); + const sal_Int32 nTextPosition(mrSource.getTextPosition()); + sal_Int32 nCurrent(nTextPosition); - switch(aBreakupUnit) + switch(aBreakupUnit) + { + case BreakupUnit_character: { - case BreakupUnit_character: - { - sal_Int32 nDone; - sal_Int32 nNextCellBreak(xBreakIterator->nextCharacters(rTxt, nTextPosition, rLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 0, nDone)); - sal_Int32 a(nTextPosition); + sal_Int32 nDone; + sal_Int32 nNextCellBreak(xBreakIterator->nextCharacters(rTxt, nTextPosition, rLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 0, nDone)); + sal_Int32 a(nTextPosition); - for(; a < nTextPosition + nTextLength; a++) + for(; a < nTextPosition + nTextLength; a++) + { + if(a == nNextCellBreak) { - if(a == nNextCellBreak) - { - breakupPortion(aTempResult, nCurrent, a - nCurrent, false); - nCurrent = a; - nNextCellBreak = xBreakIterator->nextCharacters(rTxt, a, rLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); - } + breakupPortion(aTempResult, nCurrent, a - nCurrent, false); + nCurrent = a; + nNextCellBreak = xBreakIterator->nextCharacters(rTxt, a, rLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); } - - breakupPortion(aTempResult, nCurrent, a - nCurrent, false); - break; } - case BreakupUnit_word: - { - ::com::sun::star::i18n::Boundary nNextWordBoundary(xBreakIterator->getWordBoundary(rTxt, nTextPosition, rLocale, ::com::sun::star::i18n::WordType::ANY_WORD, sal_True)); - sal_Int32 a(nTextPosition); - for(; a < nTextPosition + nTextLength; a++) + breakupPortion(aTempResult, nCurrent, a - nCurrent, false); + break; + } + case BreakupUnit_word: + { + ::com::sun::star::i18n::Boundary nNextWordBoundary(xBreakIterator->getWordBoundary(rTxt, nTextPosition, rLocale, ::com::sun::star::i18n::WordType::ANY_WORD, sal_True)); + sal_Int32 a(nTextPosition); + + for(; a < nTextPosition + nTextLength; a++) + { + if(a == nNextWordBoundary.endPos) { - if(a == nNextWordBoundary.endPos) + if(a > nCurrent) { - if(a > nCurrent) - { - breakupPortion(aTempResult, nCurrent, a - nCurrent, true); - } + breakupPortion(aTempResult, nCurrent, a - nCurrent, true); + } - nCurrent = a; + nCurrent = a; - // skip spaces (maybe enhanced with a bool later if needed) - { - const sal_Int32 nEndOfSpaces(xBreakIterator->endOfCharBlock(rTxt, a, rLocale, ::com::sun::star::i18n::CharType::SPACE_SEPARATOR)); + // skip spaces (maybe enhanced with a bool later if needed) + { + const sal_Int32 nEndOfSpaces(xBreakIterator->endOfCharBlock(rTxt, a, rLocale, ::com::sun::star::i18n::CharType::SPACE_SEPARATOR)); - if(nEndOfSpaces > a) - { - nCurrent = nEndOfSpaces; - } + if(nEndOfSpaces > a) + { + nCurrent = nEndOfSpaces; } - - nNextWordBoundary = xBreakIterator->getWordBoundary(rTxt, a + 1, rLocale, ::com::sun::star::i18n::WordType::ANY_WORD, sal_True); } - } - if(a > nCurrent) - { - breakupPortion(aTempResult, nCurrent, a - nCurrent, true); + nNextWordBoundary = xBreakIterator->getWordBoundary(rTxt, a + 1, rLocale, ::com::sun::star::i18n::WordType::ANY_WORD, sal_True); } - break; } - case BreakupUnit_sentence: + + if(a > nCurrent) { - sal_Int32 nNextSentenceBreak(xBreakIterator->endOfSentence(rTxt, nTextPosition, rLocale)); - sal_Int32 a(nTextPosition); + breakupPortion(aTempResult, nCurrent, a - nCurrent, true); + } + break; + } + case BreakupUnit_sentence: + { + sal_Int32 nNextSentenceBreak(xBreakIterator->endOfSentence(rTxt, nTextPosition, rLocale)); + sal_Int32 a(nTextPosition); - for(; a < nTextPosition + nTextLength; a++) + for(; a < nTextPosition + nTextLength; a++) + { + if(a == nNextSentenceBreak) { - if(a == nNextSentenceBreak) - { - breakupPortion(aTempResult, nCurrent, a - nCurrent, false); - nCurrent = a; - nNextSentenceBreak = xBreakIterator->endOfSentence(rTxt, a + 1, rLocale); - } + breakupPortion(aTempResult, nCurrent, a - nCurrent, false); + nCurrent = a; + nNextSentenceBreak = xBreakIterator->endOfSentence(rTxt, a + 1, rLocale); } - - breakupPortion(aTempResult, nCurrent, a - nCurrent, false); - break; } + + breakupPortion(aTempResult, nCurrent, a - nCurrent, false); + break; } } |