fd0#46808, convert some getProcessServiceFactory
... to getProcessComponentContext Change-Id: I8d5c2be0186db963ba8aac31e1b527145b8bca2b
This commit is contained in:
@@ -46,7 +46,6 @@ MediaWindowBaseImpl::MediaWindowBaseImpl( MediaWindow* pMediaWindow )
|
|||||||
|
|
||||||
MediaWindowBaseImpl::~MediaWindowBaseImpl()
|
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 > MediaWindowBaseImpl::createPlayer( const ::rtl::OUString& rURL )
|
||||||
{
|
{
|
||||||
uno::Reference< media::XPlayer > xPlayer;
|
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
|
// a fallback path just for gstreamer which has
|
||||||
// two significant versions deployed at once ...
|
// two significant versions deployed at once ...
|
||||||
#ifdef AVMEDIA_MANAGER_SERVICE_NAME_OLD
|
#ifdef AVMEDIA_MANAGER_SERVICE_NAME_OLD
|
||||||
AVMEDIA_MANAGER_SERVICE_NAME_OLD
|
AVMEDIA_MANAGER_SERVICE_NAME_OLD
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
for( sal_uInt32 i = 0; !xPlayer.is() && i < SAL_N_ELEMENTS( aServiceManagers ); ++i )
|
for( sal_uInt32 i = 0; !xPlayer.is() && i < SAL_N_ELEMENTS( aServiceManagers ); ++i )
|
||||||
{
|
{
|
||||||
const rtl::OUString aServiceName( aServiceManagers[ i ],
|
const rtl::OUString aServiceName( aServiceManagers[ i ],
|
||||||
strlen( aServiceManagers[ i ] ),
|
strlen( aServiceManagers[ i ] ),
|
||||||
RTL_TEXTENCODING_ASCII_US );
|
RTL_TEXTENCODING_ASCII_US );
|
||||||
|
|
||||||
uno::Reference< ::com::sun::star::media::XManager > xManager;
|
try {
|
||||||
|
uno::Reference< media::XManager > xManager (
|
||||||
try {
|
xContext->getServiceManager()->createInstanceWithContext(aServiceName, xContext),
|
||||||
xManager = uno::Reference< ::com::sun::star::media::XManager >(
|
uno::UNO_QUERY );
|
||||||
xFactory->createInstance( aServiceName ), uno::UNO_QUERY );
|
if( xManager.is() )
|
||||||
if( xManager.is() )
|
xPlayer = uno::Reference< media::XPlayer >( xManager->createPlayer( rURL ),
|
||||||
xPlayer = uno::Reference< media::XPlayer >( xManager->createPlayer( rURL ),
|
uno::UNO_QUERY );
|
||||||
uno::UNO_QUERY );
|
else
|
||||||
else
|
SAL_WARN( "avmedia",
|
||||||
SAL_WARN( "avmedia",
|
"failed to create media player service " << aServiceName );
|
||||||
"failed to create media player service " << aServiceName );
|
} catch ( const uno::Exception &e ) {
|
||||||
} catch ( const uno::Exception &e ) {
|
SAL_WARN( "avmedia",
|
||||||
SAL_WARN(
|
"couldn't create media player " AVMEDIA_MANAGER_SERVICE_NAME
|
||||||
"avmedia",
|
", exception '" << e.Message << '\'');
|
||||||
"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
|
::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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
@@ -62,19 +62,16 @@ namespace drawinglayer
|
|||||||
{
|
{
|
||||||
if(!aUnoControlTypeName.isEmpty())
|
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())
|
// remember XControl
|
||||||
{
|
mxXControl = xXControl;
|
||||||
xXControl->setModel(getControlModel());
|
|
||||||
|
|
||||||
// remember XControl
|
|
||||||
mxXControl = xXControl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include <drawinglayer/primitive2d/textbreakuphelper.hxx>
|
#include <drawinglayer/primitive2d/textbreakuphelper.hxx>
|
||||||
#include <drawinglayer/primitive2d/textdecoratedprimitive2d.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 <comphelper/processfactory.hxx>
|
||||||
#include <com/sun/star/i18n/CharacterIteratorMode.hdl>
|
#include <com/sun/star/i18n/CharacterIteratorMode.hdl>
|
||||||
#include <com/sun/star/i18n/WordType.hpp>
|
#include <com/sun/star/i18n/WordType.hpp>
|
||||||
@@ -193,93 +193,90 @@ namespace drawinglayer
|
|||||||
|
|
||||||
if(!xBreakIterator.is())
|
if(!xBreakIterator.is())
|
||||||
{
|
{
|
||||||
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF(::comphelper::getProcessServiceFactory());
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
|
||||||
xBreakIterator.set(xMSF->createInstance(rtl::OUString::createFromAscii("com.sun.star.i18n.BreakIterator")), ::com::sun::star::uno::UNO_QUERY);
|
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);
|
||||||
|
|
||||||
|
switch(aBreakupUnit)
|
||||||
{
|
{
|
||||||
const rtl::OUString& rTxt = mrSource.getText();
|
case BreakupUnit_character:
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
case BreakupUnit_character:
|
sal_Int32 nDone;
|
||||||
{
|
sal_Int32 nNextCellBreak(xBreakIterator->nextCharacters(rTxt, nTextPosition, rLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 0, nDone));
|
||||||
sal_Int32 nDone;
|
sal_Int32 a(nTextPosition);
|
||||||
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;
|
||||||
breakupPortion(aTempResult, nCurrent, a - nCurrent, false);
|
nNextCellBreak = xBreakIterator->nextCharacters(rTxt, a, rLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone);
|
||||||
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
if(nEndOfSpaces > a)
|
||||||
{
|
{
|
||||||
breakupPortion(aTempResult, nCurrent, a - nCurrent, true);
|
nCurrent = nEndOfSpaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
if(nEndOfSpaces > a)
|
|
||||||
{
|
|
||||||
nCurrent = nEndOfSpaces;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nNextWordBoundary = xBreakIterator->getWordBoundary(rTxt, a + 1, rLocale, ::com::sun::star::i18n::WordType::ANY_WORD, sal_True);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(a > nCurrent)
|
nNextWordBoundary = xBreakIterator->getWordBoundary(rTxt, a + 1, rLocale, ::com::sun::star::i18n::WordType::ANY_WORD, sal_True);
|
||||||
{
|
|
||||||
breakupPortion(aTempResult, nCurrent, a - nCurrent, true);
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case BreakupUnit_sentence:
|
|
||||||
|
if(a > nCurrent)
|
||||||
{
|
{
|
||||||
sal_Int32 nNextSentenceBreak(xBreakIterator->endOfSentence(rTxt, nTextPosition, rLocale));
|
breakupPortion(aTempResult, nCurrent, a - nCurrent, true);
|
||||||
sal_Int32 a(nTextPosition);
|
|
||||||
|
|
||||||
for(; a < nTextPosition + nTextLength; a++)
|
|
||||||
{
|
|
||||||
if(a == nNextSentenceBreak)
|
|
||||||
{
|
|
||||||
breakupPortion(aTempResult, nCurrent, a - nCurrent, false);
|
|
||||||
nCurrent = a;
|
|
||||||
nNextSentenceBreak = xBreakIterator->endOfSentence(rTxt, a + 1, rLocale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
breakupPortion(aTempResult, nCurrent, a - nCurrent, false);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BreakupUnit_sentence:
|
||||||
|
{
|
||||||
|
sal_Int32 nNextSentenceBreak(xBreakIterator->endOfSentence(rTxt, nTextPosition, rLocale));
|
||||||
|
sal_Int32 a(nTextPosition);
|
||||||
|
|
||||||
|
for(; a < nTextPosition + nTextLength; a++)
|
||||||
|
{
|
||||||
|
if(a == nNextSentenceBreak)
|
||||||
|
{
|
||||||
|
breakupPortion(aTempResult, nCurrent, a - nCurrent, false);
|
||||||
|
nCurrent = a;
|
||||||
|
nNextSentenceBreak = xBreakIterator->endOfSentence(rTxt, a + 1, rLocale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
breakupPortion(aTempResult, nCurrent, a - nCurrent, false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user