Use comphelper::getComponentContext

...and some further clean up.

Change-Id: Id294c0f38fe0041646fc86cacbd2e19734c746a9
This commit is contained in:
Stephan Bergmann 2012-09-29 17:20:22 +02:00
parent f05d7abf93
commit c2ca6fabd1
80 changed files with 338 additions and 899 deletions

View File

@ -724,10 +724,7 @@ bool DialogWindow::SaveDialog()
// export dialog model to xml
Reference< container::XNameContainer > xDialogModel = GetDialog();
Reference< XComponentContext > xContext;
Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() );
Reference< XInputStream > xInput( xISP->createInputStream() );
@ -1002,10 +999,8 @@ bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const Scri
if( xSFI->exists( aCurPath ) )
xInput = xSFI->openFileRead( aCurPath );
Reference< XComponentContext > xContext;
Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
Reference< XComponentContext > xContext(
comphelper::getComponentContext( xMSF ) );
::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
::rtl::OUString aXmlDlgName;
@ -1327,10 +1322,8 @@ void DialogWindow::StoreData()
if( xDialogModel.is() )
{
Reference< XComponentContext > xContext;
Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
Reference< XComponentContext > xContext(
comphelper::getProcessComponentContext() );
Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() );
xLib->replaceByName( ::rtl::OUString( GetName() ), makeAny( xISP ) );
}

View File

@ -81,10 +81,8 @@ DialogWindow* Shell::CreateDlgWin( const ScriptDocument& rDocument, const ::rtl:
Reference< container::XNameContainer > xDialogModel( xMSF->createInstance
( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
Reference< XInputStream > xInput( xISP->createInputStream() );
Reference< XComponentContext > xContext;
Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
Reference< XComponentContext > xContext(
comphelper::getComponentContext( xMSF ) );
::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
LocalizationMgr::setStringResourceAtDialog( rDocument, rLibName, aDlgName, xDialogModel );

View File

@ -28,7 +28,6 @@
#include "iderdll.hxx"
#include <basic/basmgr.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#include <comphelper/processfactory.hxx>
#include <sfx2/app.hxx>
@ -288,10 +287,8 @@ void Shell::CopyDialogResources(
Reference< container::XNameContainer > xDialogModel = Reference< container::XNameContainer >( xMSF->createInstance
( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
Reference< io::XInputStream > xInput( io_xISP->createInputStream() );
Reference< XComponentContext > xContext;
Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
Reference< XComponentContext > xContext(
comphelper::getComponentContext( xMSF ) );
::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rSourceDoc.isDocument() ? rSourceDoc.getDocument() : Reference< frame::XModel >() );
if( xDialogModel.is() )

View File

@ -960,9 +960,8 @@ namespace basctl
{
::rtl::OUString aDecodedURL( aAuthority.copy( sizeof ( "vnd.sun.star.expand:" ) - 1 ) );
aDecodedURL = ::rtl::Uri::decode( aDecodedURL, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
Reference< XComponentContext > xContext;
Reference< XPropertySet > xProps( xMSF, UNO_QUERY_THROW );
xContext.set( xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" )) ), UNO_QUERY_THROW );
Reference< XComponentContext > xContext(
comphelper::getComponentContext( xMSF ) );
Reference< XMacroExpander > xMacroExpander(
xContext->getValueByName(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander" )) ),

View File

@ -742,10 +742,8 @@ void DlgEditor::Copy()
}
// export clipboard dialog model to xml
Reference< XComponentContext > xContext;
Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
Reference< XComponentContext > xContext(
comphelper::getProcessComponentContext() );
Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
Reference< XInputStream > xStream( xISP->createInputStream() );
Sequence< sal_Int8 > DialogModelBytes;
@ -920,10 +918,8 @@ void DlgEditor::Paste()
if ( xClipDialogModel.is() )
{
Reference< XComponentContext > xContext;
Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
Reference< XComponentContext > xContext(
comphelper::getComponentContext( xMSF ) );
::xmlscript::importDialogModel( ::xmlscript::createInputStream( rtl::ByteSequence(DialogModelBytes.getArray(), DialogModelBytes.getLength()) ) , xClipDialogModel, xContext, m_xDocument );
}

View File

@ -127,10 +127,8 @@ void PropBrw::ImplReCreateController()
try
{
Reference< XPropertySet > xFactoryProperties( m_xORB, UNO_QUERY_THROW );
Reference< XComponentContext > xOwnContext(
xFactoryProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ),
UNO_QUERY_THROW );
comphelper::getComponentContext( m_xORB ) );
// a ComponentContext for the
::cppu::ContextEntry_Init aHandlerContextInfo[] =

View File

@ -94,23 +94,18 @@ void SFURL_firing_impl( const ScriptEvent& aScriptEvent, Any* pRet, const Refere
}
else
{
Reference< XComponentContext > xContext;
Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
if ( xContext.is() )
{
Reference< provider::XScriptProviderFactory > xFactory(
xContext->getValueByName(
Reference< XComponentContext > xContext(
comphelper::getProcessComponentContext() );
Reference< provider::XScriptProviderFactory > xFactory(
xContext->getValueByName(
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.script.provider.theMasterScriptProviderFactory")) ),
UNO_QUERY );
OSL_ENSURE( xFactory.is(), "SFURL_firing_impl: failed to get master script provider factory" );
if ( xFactory.is() )
{
Any aCtx;
aCtx <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user"));
xScriptProvider.set( xFactory->createScriptProvider( aCtx ), UNO_QUERY );
}
UNO_QUERY );
OSL_ENSURE( xFactory.is(), "SFURL_firing_impl: failed to get master script provider factory" );
if ( xFactory.is() )
{
Any aCtx;
aCtx <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user"));
xScriptProvider.set( xFactory->createScriptProvider( aCtx ), UNO_QUERY );
}
}
@ -469,10 +464,8 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrit
if( !xISP.is() )
return;
Reference< XComponentContext > xContext;
Reference< XPropertySet > xProps( xMSF, UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
Reference< XComponentContext > xContext(
comphelper::getComponentContext( xMSF ) );
// Import the DialogModel
Reference< XInputStream > xInput( xISP->createInputStream() );

View File

@ -162,26 +162,6 @@ void SetSbUnoObjectDfltPropName( SbxObject* pObj )
}
}
Reference< XComponentContext > getComponentContext_Impl( void )
{
static Reference< XComponentContext > xContext;
// Do we have already CoreReflection; if not obtain it
if( !xContext.is() )
{
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
Reference< XPropertySet > xProps( xFactory, UNO_QUERY );
OSL_ASSERT( xProps.is() );
if (xProps.is())
{
xProps->getPropertyValue(
::rtl::OUString( "DefaultContext" ) ) >>= xContext;
OSL_ASSERT( xContext.is() );
}
}
return xContext;
}
// save CoreReflection statically
Reference< XIdlReflection > getCoreReflection_Impl( void )
{
@ -190,7 +170,8 @@ Reference< XIdlReflection > getCoreReflection_Impl( void )
// Do we have already CoreReflection; if not obtain it
if( !xCoreReflection.is() )
{
Reference< XComponentContext > xContext = getComponentContext_Impl();
Reference< XComponentContext > xContext(
comphelper::getProcessComponentContext() );
if( xContext.is() )
{
xContext->getValueByName(
@ -233,7 +214,8 @@ Reference< XHierarchicalNameAccess > getTypeProvider_Impl( void )
// Do we have already CoreReflection; if not obtain it
if( !xAccess.is() )
{
Reference< XComponentContext > xContext = getComponentContext_Impl();
Reference< XComponentContext > xContext(
comphelper::getProcessComponentContext() );
if( xContext.is() )
{
xContext->getValueByName(
@ -260,7 +242,8 @@ Reference< XTypeConverter > getTypeConverter_Impl( void )
// Do we have already CoreReflection; if not obtain it
if( !xTypeConverter.is() )
{
Reference< XComponentContext > xContext = getComponentContext_Impl();
Reference< XComponentContext > xContext(
comphelper::getProcessComponentContext() );
if( xContext.is() )
{
xTypeConverter = Converter::create(xContext);
@ -287,7 +270,8 @@ SbUnoObject* createOLEObject_Impl( const ::rtl::OUString& aType )
{
bNeedsInit = false;
Reference< XComponentContext > xContext = getComponentContext_Impl();
Reference< XComponentContext > xContext(
comphelper::getProcessComponentContext() );
if( xContext.is() )
{
Reference<XMultiComponentFactory> xSMgr = xContext->getServiceManager();
@ -3694,33 +3678,24 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
// "Call" ctor using createInstanceWithArgumentsAndContext
Reference < XComponentContext > xContext;
if( xFirstParamContext.is() )
{
xContext = xFirstParamContext;
}
else
{
Reference < XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
xContext.set( xProps->getPropertyValue( rtl::OUString( "DefaultContext" ) ), UNO_QUERY_THROW );
}
Reference < XComponentContext > xContext(
xFirstParamContext.is()
? xFirstParamContext
: comphelper::getProcessComponentContext() );
Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
Any aRetAny;
if( xServiceMgr.is() )
::rtl::OUString aServiceName = GetName();
Reference < XInterface > xRet;
try
{
::rtl::OUString aServiceName = GetName();
Reference < XInterface > xRet;
try
{
xRet = xServiceMgr->createInstanceWithArgumentsAndContext( aServiceName, args, xContext );
}
catch( const Exception& )
{
implHandleAnyException( ::cppu::getCaughtException() );
}
aRetAny <<= xRet;
xRet = xServiceMgr->createInstanceWithArgumentsAndContext( aServiceName, args, xContext );
}
catch( const Exception& )
{
implHandleAnyException( ::cppu::getCaughtException() );
}
aRetAny <<= xRet;
unoToSbxValue( pVar, aRetAny );
// Copy back out parameters?
@ -3835,8 +3810,7 @@ void SbUnoSingleton::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
if( !xContextToUse.is() )
{
Reference < XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
xContextToUse.set( xProps->getPropertyValue( rtl::OUString( "DefaultContext" ) ), UNO_QUERY_THROW );
xContextToUse = comphelper::getProcessComponentContext();
--nAllowedParamCount;
}
@ -4205,22 +4179,12 @@ void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWr
SbxVariableRef refVar = rPar.Get(0);
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
Reference< XPropertySet> xPSMPropertySet( xFactory, UNO_QUERY );
if( xPSMPropertySet.is() )
{
Any aContextAny = xPSMPropertySet->getPropertyValue(
::rtl::OUString( "DefaultContext" ) );
Any aContextAny( comphelper::getProcessComponentContext() );
SbUnoObjectRef xUnoObj = new SbUnoObject
( ::rtl::OUString( "DefaultContext" ),
aContextAny );
refVar->PutObject( (SbUnoObject*)xUnoObj );
}
else
{
refVar->PutObject( NULL );
}
SbUnoObjectRef xUnoObj = new SbUnoObject
( ::rtl::OUString( "DefaultContext" ),
aContextAny );
refVar->PutObject( (SbUnoObject*)xUnoObj );
}
//========================================================================
@ -4544,7 +4508,8 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::
{
Reference< XInterface > xRet;
Reference< XComponentContext > xContext = getComponentContext_Impl();
Reference< XComponentContext > xContext(
comphelper::getProcessComponentContext() );
Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
Reference< XInvocation > xProxy = new ModuleInvocationProxy( aPrefix, xScopeObj );
@ -4665,7 +4630,8 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
// For now: Take first interface that allows to instantiate COM wrapper
// TODO: Check if support for multiple interfaces is needed
Reference< XComponentContext > xContext = getComponentContext_Impl();
Reference< XComponentContext > xContext(
comphelper::getProcessComponentContext() );
Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
Reference< XSingleServiceFactory > xComImplementsFactory
(

View File

@ -139,7 +139,6 @@ DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pV
{
if ( pMod->GetModuleType() == ModuleType::DOCUMENT )
{
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
// Use proxy factory service to create aggregatable proxy.
SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pMod->GetObject() );
Reference< XInterface > xIf;
@ -157,11 +156,10 @@ DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pV
{
try
{
Reference< XMultiComponentFactory > xMFac( xFactory, UNO_QUERY_THROW );
Reference< XPropertySet> xPSMPropertySet( xMFac, UNO_QUERY_THROW );
Reference< XComponentContext > xCtx;
xPSMPropertySet->getPropertyValue(
String( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xCtx;
Reference< XComponentContext > xCtx(
comphelper::getProcessComponentContext() );
Reference< XMultiComponentFactory > xMFac(
xCtx->getServiceManager() );
Reference< XProxyFactory > xProxyFac( xMFac->createInstanceWithContext( rtl::OUString( "com.sun.star.reflection.ProxyFactory" ), xCtx ), UNO_QUERY_THROW );
m_xAggProxy = xProxyFac->createProxy( xIf );
}

View File

@ -24,7 +24,6 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
@ -117,23 +116,12 @@ bool SAL_CALL SfxDialogLibraryContainer::isLibraryElementValid( Any aElement ) c
bool writeOasis2OOoLibraryElement(
Reference< XInputStream > xInput, Reference< XOutputStream > xOutput )
{
Reference< XMultiServiceFactory > xMSF(
comphelper::getProcessServiceFactory() );
Reference< XComponentContext > xContext;
Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
Reference< XComponentContext > xContext(
comphelper::getProcessComponentContext() );
Reference< lang::XMultiComponentFactory > xSMgr(
xContext->getServiceManager() );
if (! xSMgr.is())
{
return sal_False;
}
Reference< xml::sax::XParser > xParser(
xSMgr->createInstanceWithContext(
OUString( RTL_CONSTASCII_USTRINGPARAM(
@ -267,10 +255,8 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e
Reference< io::XInputStream > xInput( xISP->createInputStream() );
Reference< XNameContainer > xDialogModel( mxMSF->createInstance
( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
Reference< XComponentContext > xContext;
Reference< beans::XPropertySet > xProps( mxMSF, UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
Reference< XComponentContext > xContext(
comphelper::getComponentContext( mxMSF ) );
::xmlscript::importDialogModel( xInput, xDialogModel, xContext, mxOwnerDocument );
std::vector< rtl::OUString > vEmbeddedImageURLs;
GraphicObject::InspectForGraphicObjectImageURL( Reference< XInterface >( xDialogModel, UNO_QUERY ), vEmbeddedImageURLs );
@ -351,10 +337,8 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
if( !xInput.is() )
return aRetAny;
Reference< XComponentContext > xContext;
Reference< beans::XPropertySet > xProps( mxMSF, UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
Reference< XComponentContext > xContext(
comphelper::getComponentContext( mxMSF ) );
InputSource source;
source.aInputStream = xInput;

View File

@ -2725,29 +2725,20 @@ OUString SfxLibraryContainer::expand_url( const OUString& url )
{
if( !mxMacroExpander.is() )
{
Reference< XPropertySet > xProps( mxMSF, UNO_QUERY_THROW );
if( xProps.is() )
Reference< XComponentContext > xContext(
comphelper::getComponentContext( mxMSF ) );
Reference< util::XMacroExpander > xExpander;
xContext->getValueByName(
OUSTR("/singletons/com.sun.star.util.theMacroExpander") ) >>= xExpander;
if(! xExpander.is())
{
Reference< XComponentContext > xContext;
xProps->getPropertyValue(
OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xContext;
SAL_WARN_IF(!xContext.is(), "basic", "no DefaultContext");
if( xContext.is() )
{
Reference< util::XMacroExpander > xExpander;
xContext->getValueByName(
OUSTR("/singletons/com.sun.star.util.theMacroExpander") ) >>= xExpander;
if(! xExpander.is())
{
throw uno::DeploymentException(
OUSTR("no macro expander singleton available!"), Reference< XInterface >() );
}
MutexGuard guard( Mutex::getGlobalMutex() );
if( !mxMacroExpander.is() )
{
mxMacroExpander = xExpander;
}
}
throw uno::DeploymentException(
OUSTR("no macro expander singleton available!"), Reference< XInterface >() );
}
MutexGuard guard( Mutex::getGlobalMutex() );
if( !mxMacroExpander.is() )
{
mxMacroExpander = xExpander;
}
}
@ -3172,7 +3163,8 @@ void SAL_CALL SfxLibrary::removeChangesListener( const Reference< XChangesListen
#define sDialogLibMediaType "application/vnd.sun.star.dialog-library"
ScriptExtensionIterator::ScriptExtensionIterator( void )
: m_eState( USER_EXTENSIONS )
: m_xContext( comphelper::getProcessComponentContext() )
, m_eState( USER_EXTENSIONS )
, m_bUserPackagesLoaded( false )
, m_bSharedPackagesLoaded( false )
, m_bBundledPackagesLoaded( false )
@ -3180,22 +3172,7 @@ ScriptExtensionIterator::ScriptExtensionIterator( void )
, m_iSharedPackage( 0 )
, m_iBundledPackage( 0 )
, m_pScriptSubPackageIterator( NULL )
{
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
Reference< XPropertySet > xProps( xFactory, UNO_QUERY_THROW );
if (xProps.is())
{
xProps->getPropertyValue(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= m_xContext;
SAL_WARN_IF(!m_xContext.is(), "basic", "no DefaultContext");
}
if( !m_xContext.is() )
{
throw RuntimeException(
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScriptExtensionIterator::init(), no XComponentContext")),
Reference< XInterface >() );
}
}
{}
rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDialogLib )
{

View File

@ -18,7 +18,7 @@
*/
#include <comphelper/componentcontext.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/NullPointerException.hpp>
#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@ -53,8 +53,6 @@ namespace comphelper
{
if ( m_xContext.is() )
m_xORB = m_xContext->getServiceManager();
if ( !m_xORB.is() )
throw NullPointerException();
}
//------------------------------------------------------------------------
@ -63,23 +61,8 @@ namespace comphelper
if ( !_rxLegacyFactory.is() )
throw NullPointerException();
try
{
Reference< XPropertySet > xFactoryProperties( _rxLegacyFactory, UNO_QUERY_THROW );
m_xContext = Reference< XComponentContext >(
xFactoryProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ),
UNO_QUERY );
}
catch( const RuntimeException& ) { throw; }
catch( const Exception& )
{
throw RuntimeException();
}
if ( m_xContext.is() )
m_xORB = m_xContext->getServiceManager();
if ( !m_xORB.is() )
throw NullPointerException();
m_xContext = comphelper::getComponentContext( _rxLegacyFactory );
m_xORB = m_xContext->getServiceManager();
}
//------------------------------------------------------------------------

View File

@ -36,6 +36,7 @@ $(eval $(call gb_Library_add_defs,postgresql-sdbc,\
$(eval $(call gb_Library_use_sdk_api,postgresql-sdbc))
$(eval $(call gb_Library_use_libraries,postgresql-sdbc,\
comphelper \
cppu \
cppuhelper \
sal \

View File

@ -57,13 +57,12 @@
#include <stdio.h>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/compbase1.hxx>
#include <cppuhelper/compbase2.hxx>
#include <cppuhelper/implementationentry.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include "pq_driver.hxx"
using rtl::OUString;
@ -86,7 +85,6 @@ using com::sun::star::uno::XComponentContext;
using com::sun::star::uno::Any;
using com::sun::star::beans::PropertyValue;
using com::sun::star::beans::XPropertySet;
using com::sun::star::sdbc::XConnection;
using com::sun::star::sdbc::SQLException;
@ -352,26 +350,17 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
// XSingleComponentFactory interface ...
void * pRet = 0;
Reference< XSingleComponentFactory > xFactory;
Reference< XInterface > xSmgr( (XInterface * ) pServiceManager );
Reference< com::sun::star::lang::XMultiServiceFactory > xSmgr(
static_cast< XInterface * >(pServiceManager),
com::sun::star::uno::UNO_QUERY_THROW );
for( sal_Int32 i = 0 ; g_entries[i].create ; i ++ )
{
OUString implName = g_entries[i].getImplementationName();
if( 0 == implName.compareToAscii( pImplName ) )
{
Reference< XComponentContext > defaultContext;
Reference< XPropertySet > propSet( xSmgr, UNO_QUERY );
if( propSet.is() )
{
try
{
propSet->getPropertyValue( ASCII_STR( "DefaultContext" ) ) >>= defaultContext;
}
catch( com::sun::star::uno::Exception & )
{
// if there is no default context, ignore it
}
}
Reference< XComponentContext > defaultContext(
comphelper::getComponentContext( xSmgr ) );
xFactory = new pq_sdbc_driver::OOneInstanceComponentFactory(
implName,
g_entries[i].create,

View File

@ -22,7 +22,6 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/officeresourcebundle.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <tools/diagnose_ex.h>
@ -35,8 +34,6 @@ namespace connectivity
/** === begin UNO using === **/
using ::com::sun::star::uno::Reference;
using ::com::sun::star::beans::XPropertySet;
using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::uno::Exception;
/** === end UNO using === **/
@ -82,12 +79,8 @@ namespace connectivity
{
try
{
Reference< XPropertySet > xFactoryProps(
::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
Reference< XComponentContext > xContext(
xFactoryProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ),
UNO_QUERY_THROW
);
comphelper::getProcessComponentContext() );
m_pResourceBundle.reset( new ::comphelper::OfficeResourceBundle( xContext, "cnr" ) );
}
catch( const Exception& )

View File

@ -888,15 +888,9 @@ SaveInData::SaveInData(
bDocConfig( isDocConfig ),
bReadOnly( sal_False ),
m_xCfgMgr( xCfgMgr ),
m_xParentCfgMgr( xParentCfgMgr )
m_xParentCfgMgr( xParentCfgMgr ),
m_xComponentContext( comphelper::getProcessComponentContext() )
{
uno::Reference< beans::XPropertySet > xProps(
::comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
xProps->getPropertyValue(
OUString("DefaultContext" ))
>>= m_xComponentContext;
m_aSeparatorSeq.realloc( 1 );
m_aSeparatorSeq[0].Name = OUString( ITEM_DESCRIPTOR_TYPE );
m_aSeparatorSeq[0].Value <<= css::ui::ItemType::SEPARATOR_LINE;

View File

@ -596,12 +596,10 @@ void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::lang::XMul
OSL_TRACE("** ** About to initialise SF Scripts");
// Add Scripting Framework entries
Reference< browse::XBrowseNode > rootNode;
Reference< XComponentContext > xCtx;
Reference< XComponentContext > xCtx(
comphelper::getProcessComponentContext() );
try
{
Reference < beans::XPropertySet > xProps(
::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
xCtx.set( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW );
Reference< browse::XBrowseNodeFactory > xFac( xCtx->getValueByName(
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.script.browse.theBrowseNodeFactory") ) ), UNO_QUERY_THROW );
rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) );

View File

@ -164,7 +164,8 @@ void SFTreeListBox::Init( const ::rtl::OUString& language )
deleteAllTree();
Reference< browse::XBrowseNode > rootNode;
Reference< XComponentContext > xCtx;
Reference< XComponentContext > xCtx(
comphelper::getProcessComponentContext() );
Sequence< Reference< browse::XBrowseNode > > children;
@ -175,12 +176,6 @@ void SFTreeListBox::Init( const ::rtl::OUString& language )
try
{
Reference < beans::XPropertySet > xProps(
::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
xCtx.set( xProps->getPropertyValue( rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("DefaultContext" ))), UNO_QUERY_THROW );
Reference< browse::XBrowseNodeFactory > xFac(
xCtx->getValueByName( singleton ), UNO_QUERY_THROW );

View File

@ -835,13 +835,10 @@ void OfaTreeOptionsDialog::ActivateLastSelection()
if ( bMustExpand )
{
Reference< XComponentContext > xContext;
Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
xProps->getPropertyValue(
::rtl::OUString( "DefaultContext" ) ) >>= xContext;
if ( xContext.is() )
m_xMacroExpander = Reference< com::sun::star::util::XMacroExpander >(
xContext->getValueByName( ::rtl::OUString( "/singletons/com.sun.star.util.theMacroExpander" ) ), UNO_QUERY );
Reference< XComponentContext > xContext(
comphelper::getProcessComponentContext() );
m_xMacroExpander = Reference< com::sun::star::util::XMacroExpander >(
xContext->getValueByName( ::rtl::OUString( "/singletons/com.sun.star.util.theMacroExpander" ) ), UNO_QUERY );
}
SvLBoxEntry* pTemp = aTreeLB.First();

View File

@ -34,6 +34,7 @@ $(eval $(call gb_Library_set_include,offacc,\
$(eval $(call gb_Library_use_sdk_api,offacc))
$(eval $(call gb_Library_use_libraries,offacc,\
comphelper \
cppu \
cppuhelper \
sal \

View File

@ -144,8 +144,6 @@ class Desktop : public Application
void RegisterServices();
void DeregisterServices();
void DestroyApplicationServiceManager( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr );
void CreateTemporaryDirectory();
void RemoveTemporaryDirectory();

View File

@ -665,8 +665,9 @@ void Desktop::DeInit()
// close splashscreen if it's still open
CloseSplashScreen();
Reference<XMultiServiceFactory> xXMultiServiceFactory(::comphelper::getProcessServiceFactory());
DestroyApplicationServiceManager( xXMultiServiceFactory );
Reference< XComponent >(
comphelper::getProcessComponentContext(), UNO_QUERY_THROW )->
dispose();
// nobody should get a destroyd service factory...
::comphelper::setProcessServiceFactory( NULL );

View File

@ -128,25 +128,6 @@ void Desktop::InitApplicationServiceManager()
comphelper::setProcessServiceFactory(sm);
}
void Desktop::DestroyApplicationServiceManager( Reference< XMultiServiceFactory >& xSMgr )
{
Reference< XPropertySet > xProps( xSMgr, UNO_QUERY );
if ( xProps.is() )
{
try
{
Reference< XComponent > xComp;
if (xProps->getPropertyValue( OUString( "DefaultContext" )) >>= xComp )
{
xComp->dispose();
}
}
catch (const UnknownPropertyException&)
{
}
}
}
void Desktop::RegisterServices()
{
if( !m_bServicesRegistered )

View File

@ -31,10 +31,9 @@
#include <unotools/bootstrap.hxx>
#include <tools/stream.hxx>
#include <vcl/svapp.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/bridge/BridgeFactory.hpp>
#include <com/sun/star/uno/XNamingService.hpp>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/factory.hxx>
namespace desktop
@ -45,15 +44,6 @@ extern "C" void workerfunc (void * acc)
((Acceptor*)acc)->run();
}
static Reference<XComponentContext> getComponentContext( const Reference<XMultiServiceFactory>& rFactory)
{
Reference<XComponentContext> rContext;
Reference< XPropertySet > rPropSet( rFactory, UNO_QUERY );
Any a = rPropSet->getPropertyValue( ::rtl::OUString( "DefaultContext" ) );
a >>= rContext;
return rContext;
}
Mutex Acceptor::m_aMutex;
Acceptor::Acceptor( const Reference< XMultiServiceFactory >& rFactory )
@ -66,7 +56,7 @@ Acceptor::Acceptor( const Reference< XMultiServiceFactory >& rFactory )
{
m_rSMgr = rFactory;
// get component context
m_rContext = getComponentContext(m_rSMgr);
m_rContext = comphelper::getComponentContext(m_rSMgr);
m_rAcceptor = Reference< XAcceptor > (m_rSMgr->createInstance(
rtl::OUString("com.sun.star.connection.Acceptor" )),
UNO_QUERY );
@ -266,7 +256,7 @@ Reference<XInterface> SAL_CALL AccInstanceProvider::getInstance (const OUString&
}
else if(aName.compareToAscii( "StarOffice.ComponentContext" ) == 0 )
{
rInstance = getComponentContext( m_rSMgr );
rInstance = comphelper::getComponentContext( m_rSMgr );
}
else if ( aName.compareToAscii("StarOffice.NamingService" ) == 0 )
{
@ -278,7 +268,7 @@ Reference<XInterface> SAL_CALL AccInstanceProvider::getInstance (const OUString&
rNamingService->registerObject(
OUString("StarOffice.ServiceManager" ), m_rSMgr );
rNamingService->registerObject(
OUString("StarOffice.ComponentContext" ), getComponentContext( m_rSMgr ));
OUString("StarOffice.ComponentContext" ), comphelper::getComponentContext( m_rSMgr ));
rInstance = rNamingService;
}
}

View File

@ -18,7 +18,6 @@
*/
#include <com/sun/star/embed/Aspects.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/frame/XSynchronousFrameLoader.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@ -635,15 +634,9 @@ uno::Reference< container::XIndexAccess > DocumentHolder::MergeMenuesForInplace(
uno::Reference< lang::XSingleComponentFactory > xIndAccessFact( xContMenu, uno::UNO_QUERY_THROW );
uno::Reference< uno::XComponentContext > xComponentContext;
uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
if ( xProps.is() )
xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>=
xComponentContext;
uno::Reference< container::XIndexContainer > xMergedMenu(
xIndAccessFact->createInstanceWithContext( xComponentContext ),
xIndAccessFact->createInstanceWithContext(
comphelper::getProcessComponentContext() ),
uno::UNO_QUERY_THROW );
FindConnectPoints( xContMenu, nContPoints );

View File

@ -53,6 +53,7 @@ $(eval $(call gb_Executable_add_libs,nsplugin,\
))
$(eval $(call gb_Executable_use_libraries,nsplugin,\
comphelper \
cppu \
cppuhelper \
sal \

View File

@ -38,6 +38,7 @@
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/presentation/XPresentation.hpp>
#include <com/sun/star/presentation/XPresentationSupplier.hpp>
#include <comphelper/processfactory.hxx>
#include <vcl/window.hxx>
#include <rtl/textenc.h>
#include <rtl/locale.h>
@ -239,8 +240,8 @@ sal_Bool SoPluginInstance::LoadDocument(NSP_HWND hParent)
}
//create stream for the document
Reference< beans::XPropertySet > xFactoryProperties( mxRemoteMSF, uno::UNO_QUERY );
Reference< uno::XComponentContext > xContext( xFactoryProperties->getPropertyValue( "DefaultContext" ), UNO_QUERY );
Reference< uno::XComponentContext > xContext(
comphelper::getComponentContext( mxRemoteMSF ) );
Reference< ucb::XSimpleFileAccess2 > xSimpleFileAccess( ucb::SimpleFileAccess::create(xContext) );
Reference<io::XInputStream> xInputStream = xSimpleFileAccess->openFileRead( m_sURL );

View File

@ -31,7 +31,6 @@
#include <tools/stream.hxx>
#include <com/sun/star/beans/Property.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
@ -253,15 +252,8 @@ void OFileAccess::transferImpl( const rtl::OUString& rSource,
try
{
Reference< XComponentContext > xCtx;
Reference< XPropertySet > xPropSet( mxSMgr, UNO_QUERY_THROW );
if ( xPropSet.is() )
{
xPropSet->getPropertyValue(
rtl::OUString(
"DefaultContext" ) )
>>= xCtx;
}
Reference< XComponentContext > xCtx(
comphelper::getComponentContext( mxSMgr ) );
Reference< XMacroExpander > xExpander;

View File

@ -58,7 +58,6 @@
#include <com/sun/star/xml/sax/SAXException.hpp>
#include <com/sun/star/xml/XImportFilter.hpp>
#include <com/sun/star/xml/XExportFilter.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
@ -190,12 +189,8 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False)
::rtl::OUString sExpandedUrl;
try
{
css::uno::Reference<XComponentContext> xContext;
css::uno::Reference<XPropertySet> xProps(m_rServiceFactory,
UNO_QUERY_THROW);
xContext.set(xProps->getPropertyValue(::rtl::OUString(
"DefaultContext" )),
UNO_QUERY_THROW);
css::uno::Reference<XComponentContext> xContext(
comphelper::getComponentContext(m_rServiceFactory));
css::uno::Reference<XMacroExpander>
xMacroExpander(
xContext->getValueByName(

View File

@ -41,8 +41,8 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/Type.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <cppuhelper/factory.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
#include <rtl/ustring.hxx>
#include <rtl/logfile.hxx>
@ -143,10 +143,8 @@ ________________________________________________________________________________
throw( css::uno::Exception ) \
{ \
/* retrieve component context from the given service manager */ \
static const ::rtl::OUString PROP_DEFAULTCONTEXT("DefaultContext"); \
css::uno::Reference< css::beans::XPropertySet > xSMGRProps(xServiceManager, css::uno::UNO_QUERY_THROW); \
css::uno::Reference< css::uno::XComponentContext > xComponentContext; \
xSMGRProps->getPropertyValue( PROP_DEFAULTCONTEXT ) >>= xComponentContext; \
css::uno::Reference< css::uno::XComponentContext > xComponentContext( \
comphelper::getComponentContext( xServiceManager ) ); \
/* create new instance of service */ \
CLASS* pClass = new CLASS( xComponentContext ); \
/* hold it alive by increasing his ref count!!! */ \

View File

@ -35,7 +35,6 @@
#include <com/sun/star/uno/Sequence.hxx>
#include "com/sun/star/util/XMacroExpander.hpp"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/beans/XPropertySet.hpp"
#include <rtl/ustrbuf.hxx>
#include <rtl/uri.hxx>
#include <comphelper/processfactory.hxx>
@ -415,15 +414,11 @@ AddonsOptions_Impl::AddonsOptions_Impl()
m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECONTEXT ] = PROPERTYNAME_MERGETOOLBAR_MERGECONTEXT;
m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_TOOLBARITEMS ] = PROPERTYNAME_MERGETOOLBAR_TOOLBARITEMS;
Reference< XComponentContext > xContext;
Reference< com::sun::star::beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
if ( xContext.is() )
{
m_xMacroExpander = Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName(
Reference< XComponentContext > xContext(
comphelper::getProcessComponentContext() );
m_xMacroExpander = Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander"))),
UNO_QUERY );
}
ReadConfigurationData();

View File

@ -39,7 +39,6 @@
#include <com/sun/star/ui/ItemType.hpp>
#include <com/sun/star/ui/ItemStyle.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <comphelper/processfactory.hxx>
#include <rtl/logfile.hxx>
@ -376,10 +375,8 @@ throw( SAXException, RuntimeException )
m_bMenuMode = sal_True;
// Container must be factory to create sub container
Reference< XComponentContext > xComponentContext;
Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>=
xComponentContext;
Reference< XComponentContext > xComponentContext(
comphelper::getProcessComponentContext() );
Reference< XIndexContainer > xSubItemContainer;
if ( m_xContainerFactory.is() )
@ -573,6 +570,7 @@ OReadMenuPopupHandler::OReadMenuPopupHandler(
m_bMenuMode( sal_False ),
m_xMenuContainer( rMenuContainer ),
m_xContainerFactory( rFactory ),
m_xComponentContext( comphelper::getProcessComponentContext() ),
m_nNextElementExpected( ELEM_CLOSE_NONE )
{
}
@ -612,12 +610,6 @@ throw( SAXException, RuntimeException )
m_bMenuMode = sal_True;
// Container must be factory to create sub container
if ( !m_xComponentContext.is() )
{
const Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
m_xComponentContext.set(xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW );
}
Reference< XIndexContainer > xSubItemContainer;
if ( m_xContainerFactory.is() )
xSubItemContainer = Reference< XIndexContainer >( m_xContainerFactory->createInstanceWithContext( m_xComponentContext ), UNO_QUERY );

View File

@ -34,6 +34,7 @@
#include <uiconfiguration/windowstateconfiguration.hxx>
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/ui/UIElementType.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
#include <com/sun/star/container/XNameContainer.hpp>

View File

@ -591,9 +591,8 @@ FrameHelper::rebuildMenu (Reference < XMenu > xMenu,
//we need to access that info through a special XPopupMenuController
if (isSpecialSubmenu (oUCommand))
{
Reference < XPropertySet > xMSFProps (m_xMSF, UNO_QUERY);
Reference <XComponentContext> xContext (xMSFProps->getPropertyValue (OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext"))),
UNO_QUERY);
Reference <XComponentContext> xContext(
comphelper::getComponentContext(m_xMSF));
Reference < XPopupMenuController > xRFC (m_xPCF->createInstanceWithArgumentsAndContext(oUCommand,
m_args,
@ -736,9 +735,8 @@ FrameHelper::dispatchCommand (OUString command)
{
target = OUString(RTL_CONSTASCII_USTRINGPARAM("_default"));
Reference < XPropertySet > xMSFProps (m_xMSF, UNO_QUERY);
Reference <XComponentContext> xContext (xMSFProps->getPropertyValue (OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext"))),
UNO_QUERY);
Reference <XComponentContext> xContext(
comphelper::getComponentContext(m_xMSF));
Reference < XPopupMenuController > xRFC (m_xPCF->createInstanceWithArgumentsAndContext(OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:RecentFileList")),
m_args,
xContext),

View File

@ -50,12 +50,11 @@
#include <com/sun/star/ui/ItemType.hpp>
#include <com/sun/star/frame/XToolbarController.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/ui/DockingArea.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <comphelper/processfactory.hxx>
#include <svtools/imgdef.hxx>
#include <svtools/toolboxcontroller.hxx>
#include <toolkit/unohlp.hxx>
@ -235,11 +234,8 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue
}
Reference< XMultiComponentFactory > xToolbarControllerFactory( m_xToolbarControllerRegistration, UNO_QUERY );
Reference< XComponentContext > xComponentContext;
Reference< XPropertySet > xProps( m_xServiceManager, UNO_QUERY );
if ( xProps.is() )
xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xComponentContext;
Reference< XComponentContext > xComponentContext(
comphelper::getComponentContext( m_xServiceManager ) );
sal_uInt32 nElements( 0 );
sal_Bool bAppendSeparator( sal_False );

View File

@ -38,7 +38,6 @@
#include <com/sun/star/frame/XControlNotificationListener.hpp>
#include "com/sun/star/util/XMacroExpander.hpp"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/beans/XPropertySet.hpp"
#include <rtl/uri.hxx>
#include <osl/mutex.hxx>
@ -81,16 +80,12 @@ uno::Reference< util::XMacroExpander > GetMacroExpander()
if ( !xMacroExpander.is() )
{
uno::Reference< uno::XComponentContext > xContext;
uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
if ( xContext.is() )
{
m_xMacroExpander = Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName(
uno::Reference< uno::XComponentContext > xContext(
comphelper::getProcessComponentContext() );
m_xMacroExpander = Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander"))),
UNO_QUERY );
xMacroExpander = m_xMacroExpander;
}
xMacroExpander = m_xMacroExpander;
}
}

View File

@ -43,7 +43,6 @@
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XFramesSupplier.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/container/XEnumeration.hpp>
@ -1217,11 +1216,8 @@ sal_Bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHa
aPropValue.Value <<= m_xFrame;
aSeq[1] <<= aPropValue;
Reference< XComponentContext > xComponentContext;
Reference< XPropertySet > xProps( getServiceFactory(), UNO_QUERY );
xProps->getPropertyValue( rtl::OUString( "DefaultContext" )) >>=
xComponentContext;
Reference< XComponentContext > xComponentContext(
comphelper::getComponentContext( getServiceFactory() ) );
Reference< XPopupMenuController > xPopupMenuController(
xPopupMenuControllerFactory->createInstanceWithArgumentsAndContext(

View File

@ -177,8 +177,8 @@ bool PopupMenuController::CreatePopupMenuController() throw (Exception)
aPropValue.Value <<= m_xFrame;
aSeq[1] <<= aPropValue;
Reference< XPropertySet > xProps( getServiceManager(), UNO_QUERY_THROW );
Reference< XComponentContext > xComponentContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW );
Reference< XComponentContext > xComponentContext(
comphelper::getComponentContext( getServiceManager() ) );
Reference< XPopupMenuController > xPopupMenuController( xPopupMenuControllerRegistration->createInstanceWithArgumentsAndContext( getCommandURL(), aSeq, xComponentContext ), UNO_QUERY );
if ( xPopupMenuController.is() )

View File

@ -50,7 +50,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/awt/Command.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <comphelper/processfactory.hxx>
#include <toolkit/unohlp.hxx>
#include <svtools/statusbarcontroller.hxx>
@ -335,13 +335,10 @@ void StatusBarManager::CreateControllers()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::CreateControllers" );
uno::Reference< lang::XMultiComponentFactory > xStatusbarControllerFactory( m_xStatusbarControllerRegistration, uno::UNO_QUERY );
uno::Reference< uno::XComponentContext > xComponentContext;
uno::Reference< beans::XPropertySet > xProps( m_xServiceManager, uno::UNO_QUERY );
uno::Reference< uno::XComponentContext > xComponentContext(
comphelper::getComponentContext( m_xServiceManager ) );
uno::Reference< awt::XWindow > xStatusbarWindow = VCLUnoHelper::GetInterface( m_pStatusBar );
if ( xProps.is() )
xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xComponentContext;
for ( sal_uInt16 i = 0; i < m_pStatusBar->GetItemCount(); i++ )
{
sal_uInt16 nId = m_pStatusBar->GetItemId( i );

View File

@ -897,17 +897,14 @@ void ToolBarManager::CreateControllers()
RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::ToolBarManager::CreateControllers" );
Reference< XMultiComponentFactory > xToolbarControllerFactory( m_xToolbarControllerRegistration, UNO_QUERY );
Reference< XComponentContext > xComponentContext;
Reference< XPropertySet > xProps( m_xServiceManager, UNO_QUERY );
Reference< XComponentContext > xComponentContext(
comphelper::getComponentContext( m_xServiceManager ) );
Reference< XWindow > xToolbarWindow = VCLUnoHelper::GetInterface( m_pToolBar );
css::util::URL aURL;
sal_Bool bHasDisabledEntries = SvtCommandOptions().HasEntries( SvtCommandOptions::CMDOPTION_DISABLED );
SvtCommandOptions aCmdOptions;
if ( xProps.is() )
xProps->getPropertyValue( rtl::OUString( "DefaultContext" )) >>= xComponentContext;
for ( sal_uInt16 i = 0; i < m_pToolBar->GetItemCount(); i++ )
{
sal_uInt16 nId = m_pToolBar->GetItemId( i );

View File

@ -1088,10 +1088,8 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
{
try
{
uno::Reference < uno::XComponentContext > xContext;
uno::Reference< beans::XPropertySet > xProps( xFac, uno::UNO_QUERY );
xProps->getPropertyValue( "DefaultContext" ) >>= xContext;
uno::Reference < uno::XComponentContext > xContext(
comphelper::getComponentContext( xFac ) );
xSvc = uno::Reference< linguistic2::XSpellChecker >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
}
catch (const uno::Exception &)
@ -1152,10 +1150,8 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
{
try
{
uno::Reference < uno::XComponentContext > xContext;
uno::Reference< beans::XPropertySet > xProps( xFac, uno::UNO_QUERY );
xProps->getPropertyValue( "DefaultContext" ) >>= xContext;
uno::Reference < uno::XComponentContext > xContext(
comphelper::getComponentContext( xFac ) );
xSvc = uno::Reference< linguistic2::XProofreader >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
}
catch (const uno::Exception &)
@ -1215,10 +1211,8 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl()
{
try
{
uno::Reference < uno::XComponentContext > xContext;
uno::Reference< beans::XPropertySet > xProps( xFac, uno::UNO_QUERY );
xProps->getPropertyValue( "DefaultContext" ) >>= xContext;
uno::Reference < uno::XComponentContext > xContext(
comphelper::getComponentContext( xFac ) );
xSvc = uno::Reference< linguistic2::XHyphenator >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
}
@ -1281,10 +1275,8 @@ void LngSvcMgr::GetAvailableThesSvcs_Impl()
{
try
{
uno::Reference < uno::XComponentContext > xContext;
uno::Reference< beans::XPropertySet > xProps( xFac, uno::UNO_QUERY );
xProps->getPropertyValue( "DefaultContext" ) >>= xContext;
uno::Reference < uno::XComponentContext > xContext(
comphelper::getComponentContext( xFac ) );
xSvc = uno::Reference< linguistic2::XThesaurus >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
}
catch (const uno::Exception &)

View File

@ -44,7 +44,6 @@
#include <com/sun/star/document/XOOXMLDocumentPropertiesImporter.hpp>
#include <com/sun/star/xml/dom/XDocument.hpp>
#include <com/sun/star/xml/dom/DocumentBuilder.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/mediadescriptor.hxx>
#include <oox/core/filterdetect.hxx>
@ -56,7 +55,6 @@ using ::com::sun::star::xml::dom::DocumentBuilder;
using ::com::sun::star::xml::dom::XDocument;
using ::com::sun::star::xml::dom::XDocumentBuilder;
using ::com::sun::star::xml::sax::XFastSAXSerializable;
using ::com::sun::star::beans::XPropertySet;
using ::com::sun::star::lang::XComponent;
namespace oox {
@ -194,26 +192,6 @@ XmlFilterBaseImpl::XmlFilterBaseImpl( const Reference< XComponentContext >& rxCo
maFastParser.registerNamespace( ids[i].Second );
}
static Reference< XComponentContext > lcl_getComponentContext(Reference< XMultiServiceFactory > aFactory)
{
Reference< XComponentContext > xContext;
try
{
Reference< XPropertySet > xFactProp( aFactory, UNO_QUERY );
if( xFactProp.is() )
xFactProp->getPropertyValue( "DefaultContext") >>= xContext;
}
catch( Exception& )
{}
return xContext;
}
// ============================================================================
// ============================================================================
XmlFilterBase::XmlFilterBase( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
FilterBase( rxContext ),
mxImpl( new XmlFilterBaseImpl( rxContext ) ),
@ -233,7 +211,7 @@ void XmlFilterBase::importDocumentProperties() throw()
Reference< XMultiServiceFactory > xFactory( getServiceFactory(), UNO_QUERY );
MediaDescriptor aMediaDesc( getMediaDescriptor() );
Reference< XInputStream > xInputStream;
Reference< XComponentContext > xContext = lcl_getComponentContext(getServiceFactory());
Reference< XComponentContext > xContext = comphelper::getComponentContext(getServiceFactory());
::oox::core::FilterDetect aDetector( xContext );
xInputStream = aDetector.extractUnencryptedPackage( aMediaDesc );
Reference< XComponent > xModel( getModel(), UNO_QUERY );
@ -357,7 +335,7 @@ Reference<XDocument> XmlFilterBase::importFragment( const ::rtl::OUString& aFrag
{
// create the dom parser
Reference< XComponentContext > xContext =
lcl_getComponentContext(getServiceFactory());
comphelper::getComponentContext(getServiceFactory());
Reference<XDocumentBuilder> xDomBuilder( DocumentBuilder::create(xContext) );
// create DOM from fragment

View File

@ -121,21 +121,6 @@ namespace oox { namespace drawingml {
if ( GETA(propName) ) \
mAny >>= variable;
Reference< uno::XComponentContext > lcl_getComponentContext()
{
Reference< uno::XComponentContext > xContext;
try
{
Reference< beans::XPropertySet > xFactProp( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
if( xFactProp.is())
xFactProp->getPropertyValue(OUString("DefaultContext")) >>= xContext;
}
catch( uno::Exception& )
{}
return xContext;
}
class lcl_MatchesRole : public ::std::unary_function< Reference< chart2::data::XLabeledDataSequence >, bool >
{
public:
@ -217,13 +202,12 @@ Reference< chart2::data::XLabeledDataSequence > lcl_getCategories( const Referen
Reference< chart2::data::XDataSource > lcl_createDataSource(
const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aData )
{
Reference< chart2::data::XDataSink > xSink;
Reference< uno::XComponentContext > xContext( lcl_getComponentContext());
if( xContext.is() )
xSink.set(
xContext->getServiceManager()->createInstanceWithContext(
OUString("com.sun.star.chart2.data.DataSource"),
xContext ), uno::UNO_QUERY_THROW );
Reference< uno::XComponentContext > xContext(
comphelper::getProcessComponentContext() );
Reference< chart2::data::XDataSink > xSink(
xContext->getServiceManager()->createInstanceWithContext(
"com.sun.star.chart2.data.DataSource", xContext ),
uno::UNO_QUERY_THROW );
if( xSink.is())
xSink->setData( aData );

View File

@ -132,16 +132,10 @@ PropBrw::PropBrw(const Reference< XMultiServiceFactory >& _xORB,Window* pParen
if (m_xMeAsFrame.is())
{
Reference< XComponentContext > xOwnContext;
Reference< XComponentContext > xOwnContext(
comphelper::getComponentContext( m_xORB ) );
try
{
// our own component context
Reference< XPropertySet > xFactoryProperties( m_xORB, UNO_QUERY_THROW );
xOwnContext.set(
xFactoryProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ),
UNO_QUERY_THROW );
// a ComponentContext for the
::cppu::ContextEntry_Init aHandlerContextInfo[] =
{
::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContextDocument" ) ), makeAny( m_pDesignView->getController().getModel() )),

View File

@ -2628,9 +2628,6 @@ uno::Sequence<rtl::OUString> ScDPObject::GetRegisteredSources()
return aSeq;
}
// use getContext from addincol.cxx
uno::Reference<uno::XComponentContext> getContext(uno::Reference<lang::XMultiServiceFactory> xMSF);
uno::Reference<sheet::XDimensionsSupplier> ScDPObject::CreateSource( const ScDPServiceDesc& rDesc )
{
rtl::OUString aImplName = rDesc.aServiceName;
@ -2664,9 +2661,10 @@ uno::Reference<sheet::XDimensionsSupplier> ScDPObject::CreateSource( const ScDPS
// passing the context to the component (see ScUnoAddInCollection::Initialize)
uno::Reference<uno::XInterface> xInterface;
uno::Reference<uno::XComponentContext> xCtx = getContext(xManager);
uno::Reference<uno::XComponentContext> xCtx(
comphelper::getComponentContext(xManager));
uno::Reference<lang::XSingleComponentFactory> xCFac( xIntFac, uno::UNO_QUERY );
if (xCtx.is() && xCFac.is())
if (xCFac.is())
xInterface = xCFac->createInstanceWithContext(xCtx);
if (!xInterface.is())

View File

@ -281,19 +281,6 @@ void ScUnoAddInCollection::Clear()
bInitialized = false;
}
uno::Reference<uno::XComponentContext> getContext(uno::Reference<lang::XMultiServiceFactory> xMSF)
{
uno::Reference<uno::XComponentContext> xCtx;
try {
uno::Reference<beans::XPropertySet> xPropset(xMSF, uno::UNO_QUERY);
xPropset->getPropertyValue(
::rtl::OUString("DefaultContext")) >>= xCtx;
}
catch ( uno::Exception & ) {
}
return xCtx;
}
void ScUnoAddInCollection::Initialize()
{
OSL_ENSURE( !bInitialized, "Initialize twice?" );
@ -321,9 +308,10 @@ void ScUnoAddInCollection::Initialize()
// passing the context to the component
uno::Reference<uno::XInterface> xInterface;
uno::Reference<uno::XComponentContext> xCtx = getContext(xManager);
uno::Reference<uno::XComponentContext> xCtx(
comphelper::getComponentContext(xManager));
uno::Reference<lang::XSingleComponentFactory> xCFac( xIntFac, uno::UNO_QUERY );
if (xCtx.is() && xCFac.is())
if (xCFac.is())
{
xInterface = xCFac->createInstanceWithContext(xCtx);
if (xInterface.is())

View File

@ -683,36 +683,34 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
try
{
uno::Reference< uno::XComponentContext > xContext;
uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
uno::Reference< beans::XPropertySet > xProp( xServiceManager, uno::UNO_QUERY_THROW );
xProp->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ) >>= xContext;
if ( xContext.is() )
uno::Reference< uno::XComponentContext > xContext(
comphelper::getProcessComponentContext() );
uno::Reference< lang::XMultiServiceFactory > xServiceManager(
xContext->getServiceManager(),
uno::UNO_QUERY_THROW );
uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xServiceManager, uno::UNO_QUERY_THROW );
uno::Reference< container::XEnumeration> xEnum = xEnumAccess->createContentEnumeration(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.SpreadsheetDocumentJob" ) ) );
if ( xEnum.is() )
{
uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xServiceManager, uno::UNO_QUERY_THROW );
uno::Reference< container::XEnumeration> xEnum = xEnumAccess->createContentEnumeration(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.SpreadsheetDocumentJob" ) ) );
if ( xEnum.is() )
while ( xEnum->hasMoreElements() )
{
while ( xEnum->hasMoreElements() )
uno::Any aAny = xEnum->nextElement();
uno::Reference< lang::XSingleComponentFactory > xFactory;
aAny >>= xFactory;
if ( xFactory.is() )
{
uno::Any aAny = xEnum->nextElement();
uno::Reference< lang::XSingleComponentFactory > xFactory;
aAny >>= xFactory;
if ( xFactory.is() )
{
uno::Reference< task::XJob > xJob( xFactory->createInstanceWithContext( xContext ), uno::UNO_QUERY_THROW );
uno::Sequence< beans::NamedValue > aArgsForJob(1);
ScViewData* pViewData = GetViewData();
SfxViewShell* pViewShell = ( pViewData ? pViewData->GetViewShell() : NULL );
SfxViewFrame* pViewFrame = ( pViewShell ? pViewShell->GetViewFrame() : NULL );
SfxFrame* pFrame = ( pViewFrame ? &pViewFrame->GetFrame() : NULL );
uno::Reference< frame::XController > xController = ( pFrame ? pFrame->GetController() : 0 );
uno::Reference< sheet::XSpreadsheetView > xSpreadsheetView( xController, uno::UNO_QUERY_THROW );
aArgsForJob[0] = beans::NamedValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "SpreadsheetView" )),
uno::Reference< task::XJob > xJob( xFactory->createInstanceWithContext( xContext ), uno::UNO_QUERY_THROW );
uno::Sequence< beans::NamedValue > aArgsForJob(1);
ScViewData* pViewData = GetViewData();
SfxViewShell* pViewShell = ( pViewData ? pViewData->GetViewShell() : NULL );
SfxViewFrame* pViewFrame = ( pViewShell ? pViewShell->GetViewFrame() : NULL );
SfxFrame* pFrame = ( pViewFrame ? &pViewFrame->GetFrame() : NULL );
uno::Reference< frame::XController > xController = ( pFrame ? pFrame->GetController() : 0 );
uno::Reference< sheet::XSpreadsheetView > xSpreadsheetView( xController, uno::UNO_QUERY_THROW );
aArgsForJob[0] = beans::NamedValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "SpreadsheetView" )),
uno::makeAny( xSpreadsheetView ) );
xJob->execute( aArgsForJob );
}
xJob->execute( aArgsForJob );
}
}
}

View File

@ -29,6 +29,7 @@
#include "solverutil.hxx"
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XSingleComponentFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
@ -84,19 +85,13 @@ void ScSolverUtil::GetImplementations( uno::Sequence<rtl::OUString>& rImplNames,
rImplNames.realloc(0); // clear
rDescriptions.realloc(0);
uno::Reference<uno::XComponentContext> xCtx;
uno::Reference<lang::XMultiServiceFactory> xMSF = comphelper::getProcessServiceFactory();
uno::Reference<beans::XPropertySet> xPropset(xMSF, uno::UNO_QUERY);
try
{
xPropset->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xCtx;
}
catch ( uno::Exception & )
{
}
uno::Reference<uno::XComponentContext> xCtx(
comphelper::getProcessComponentContext() );
uno::Reference<lang::XMultiServiceFactory> xMSF(
xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
uno::Reference<container::XContentEnumerationAccess> xEnAc( xMSF, uno::UNO_QUERY );
if ( xCtx.is() && xEnAc.is() )
if ( xEnAc.is() )
{
uno::Reference<container::XEnumeration> xEnum =
xEnAc->createContentEnumeration( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SCSOLVER_SERVICE)) );
@ -140,19 +135,13 @@ uno::Reference<sheet::XSolver> ScSolverUtil::GetSolver( const rtl::OUString& rIm
{
uno::Reference<sheet::XSolver> xSolver;
uno::Reference<uno::XComponentContext> xCtx;
uno::Reference<lang::XMultiServiceFactory> xMSF = comphelper::getProcessServiceFactory();
uno::Reference<beans::XPropertySet> xPropset(xMSF, uno::UNO_QUERY);
try
{
xPropset->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xCtx;
}
catch ( uno::Exception & )
{
}
uno::Reference<uno::XComponentContext> xCtx(
comphelper::getProcessComponentContext() );
uno::Reference<lang::XMultiServiceFactory> xMSF(
xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
uno::Reference<container::XContentEnumerationAccess> xEnAc( xMSF, uno::UNO_QUERY );
if ( xCtx.is() && xEnAc.is() )
if ( xEnAc.is() )
{
uno::Reference<container::XEnumeration> xEnum =
xEnAc->createContentEnumeration( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SCSOLVER_SERVICE)) );

View File

@ -118,10 +118,10 @@ private:
bool bInitialWarningState;
static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException )
{
static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
static uno::Reference<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
static uno::Reference<uno::XComponentContext > xContext(
comphelper::getProcessComponentContext() );
static uno::Reference<lang::XMultiComponentFactory > xServiceManager(
xContext->getServiceManager(), uno::UNO_QUERY_THROW );
xContext->getServiceManager() );
static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW );
return xProps;
}

View File

@ -124,10 +124,10 @@ private:
bool bInitialWarningState;
static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException )
{
static uno::Reference< beans::XPropertySet > xTmpProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
static uno::Reference<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( "DefaultContext" )), uno::UNO_QUERY_THROW );
static uno::Reference<uno::XComponentContext > xContext(
comphelper::getProcessComponentContext() );
static uno::Reference<lang::XMultiComponentFactory > xServiceManager(
xContext->getServiceManager(), uno::UNO_QUERY_THROW );
xContext->getServiceManager() );
static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( "com.sun.star.sheet.GlobalSheetSettings" ) ,xContext ), uno::UNO_QUERY_THROW );
return xProps;
}
@ -279,11 +279,10 @@ getCurrentDocument() throw (uno::RuntimeException)
if ( false == ( aModel >>= xModel ) ||
!xModel.is() )
{
// trying last gasp try the current component
uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
// test if vba service is present
uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( "DefaultContext" )), uno::UNO_QUERY_THROW );
uno::Reference<lang::XMultiComponentFactory > xSMgr( xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
uno::Reference< uno::XComponentContext > xCtx(
comphelper::getProcessComponentContext() );
uno::Reference<lang::XMultiComponentFactory > xSMgr(
xCtx->getServiceManager() );
uno::Reference< frame::XDesktop > xDesktop (xSMgr->createInstanceWithContext(::rtl::OUString("com.sun.star.frame.Desktop"), xCtx), uno::UNO_QUERY_THROW );
xModel.set( xDesktop->getCurrentComponent(), uno::UNO_QUERY );
if ( !xModel.is() )

View File

@ -167,10 +167,10 @@ openNewDoc(rtl::OUString aSheetName )
uno::Reference<frame::XModel> xModel;
try
{
uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
uno::Reference< uno::XComponentContext > xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
uno::Reference< uno::XComponentContext > xContext(
comphelper::getProcessComponentContext() );
uno::Reference<lang::XMultiComponentFactory > xServiceManager(
xContext->getServiceManager(), uno::UNO_QUERY_THROW );
xContext->getServiceManager() );
uno::Reference <frame::XComponentLoader > xComponentLoader(
xServiceManager->createInstanceWithContext(

View File

@ -38,6 +38,7 @@ $(eval $(call gb_Library_set_include,protocolhandler,\
$(eval $(call gb_Library_use_sdk_api,protocolhandler))
$(eval $(call gb_Library_use_libraries,protocolhandler,\
comphelper \
cppu \
cppuhelper \
fwe \

View File

@ -41,6 +41,7 @@
#include <vcl/abstdlg.hxx>
#include <tools/diagnose_ex.h>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <util/util.hxx>
@ -50,7 +51,6 @@
#include "com/sun/star/uri/XUriReference.hpp"
#include "com/sun/star/uri/XUriReferenceFactory.hpp"
#include "com/sun/star/uri/XVndSunStarScriptUrl.hpp"
#include "com/sun/star/beans/XPropertySet.hpp"
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@ -383,13 +383,8 @@ void ScriptProtocolHandler::createScriptProvider()
// if nothing of this is successful, use the master script provider
if ( !m_xScriptProvider.is() )
{
Reference< XPropertySet > xProps( m_xFactory, UNO_QUERY_THROW );
::rtl::OUString dc(
"DefaultContext" );
Reference< XComponentContext > xCtx(
xProps->getPropertyValue( dc ), UNO_QUERY_THROW );
comphelper::getComponentContext( m_xFactory ) );
::rtl::OUString tmspf(
"/singletons/com.sun.star.script.provider.theMasterScriptProviderFactory");

View File

@ -368,14 +368,10 @@ eventMethodToDescriptor( const ::rtl::OUString& rEventMethod, ScriptEventDescrip
}
ScriptEventHelper::ScriptEventHelper( const Reference< XInterface >& xControl ) : m_xControl( xControl )
{
Reference < beans::XPropertySet > xProps(
::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
m_xCtx.set( xProps->getPropertyValue( rtl::OUString(
"DefaultContext" )),
uno::UNO_QUERY_THROW );
}
ScriptEventHelper::ScriptEventHelper( const Reference< XInterface >& xControl ):
m_xCtx( comphelper::getProcessComponentContext() ),
m_xControl( xControl )
{}
Sequence< rtl::OUString >
ScriptEventHelper::getEventListeners()

View File

@ -34,7 +34,6 @@
#include <com/sun/star/xml/sax/XParser.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/presentation/EffectPresetClass.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <unotools/streamwrap.hxx>
@ -316,19 +315,14 @@ void CustomAnimationPresets::importEffects()
{
try
{
// Get service factory
Reference< XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
DBG_ASSERT( xServiceFactory.is(), "sd::CustomAnimationPresets::import(), got no service manager" );
if( !xServiceFactory.is() )
return;
uno::Reference< uno::XComponentContext > xContext(
comphelper::getProcessComponentContext() );
Reference< XMultiServiceFactory > xServiceFactory(
xContext->getServiceManager(), UNO_QUERY_THROW );
uno::Reference< beans::XPropertySet > xProps( xServiceFactory, UNO_QUERY );
uno::Reference< uno::XComponentContext > xContext;
xProps->getPropertyValue( "DefaultContext" ) >>= xContext;
uno::Reference< util::XMacroExpander > xMacroExpander;
if( xContext.is() )
xMacroExpander.set( xContext->getValueByName("/singletons/com.sun.star.util.theMacroExpander"), UNO_QUERY );
uno::Reference< util::XMacroExpander > xMacroExpander(
xContext->getValueByName("/singletons/com.sun.star.util.theMacroExpander"),
UNO_QUERY );
Reference< XMultiServiceFactory > xConfigProvider(
xServiceFactory->createInstance("com.sun.star.configuration.ConfigurationProvider" ),

View File

@ -31,7 +31,6 @@
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
#include <com/sun/star/animations/AnimationNodeType.hpp>
#include <vcl/svapp.hxx>
@ -152,19 +151,14 @@ bool TransitionPreset::importTransitionPresetList( TransitionPresetList& rList )
try
{
// Get service factory
Reference< XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
DBG_ASSERT( xServiceFactory.is(), "sd::CustomAnimationPresets::import(), got no service manager" );
if( !xServiceFactory.is() )
return false;
uno::Reference< uno::XComponentContext > xContext(
comphelper::getProcessComponentContext() );
Reference< XMultiServiceFactory > xServiceFactory(
xContext->getServiceManager(), UNO_QUERY_THROW );
uno::Reference< beans::XPropertySet > xProps( xServiceFactory, UNO_QUERY );
uno::Reference< uno::XComponentContext > xContext;
xProps->getPropertyValue( "DefaultContext" ) >>= xContext;
uno::Reference< util::XMacroExpander > xMacroExpander;
if( xContext.is() )
xMacroExpander.set( xContext->getValueByName("/singletons/com.sun.star.util.theMacroExpander"), UNO_QUERY );
uno::Reference< util::XMacroExpander > xMacroExpander(
xContext->getValueByName("/singletons/com.sun.star.util.theMacroExpander"),
UNO_QUERY );
// import ui strings
Reference< XMultiServiceFactory > xConfigProvider(

View File

@ -163,17 +163,12 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd ,
uno::Reference< awt::XWindow > xWindow;
try
{
uno::Reference< beans::XPropertySet > xProps( xServiceManager, uno::UNO_QUERY );
uno::Reference< uno::XComponentContext > xContext;
uno::Reference< uno::XComponentContext > xContext(
comphelper::getComponentContext( xServiceManager ) );
if ( xProps.is() )
xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
if ( xContext.is() )
{
xWindow = uno::Reference< awt::XWindow>(
xFactoryMgr->createInstanceWithArgumentsAndContext( aArgs, xContext ),
uno::UNO_QUERY );
}
xWindow = uno::Reference< awt::XWindow>(
xFactoryMgr->createInstanceWithArgumentsAndContext( aArgs, xContext ),
uno::UNO_QUERY );
static uno::WeakReference< frame::XModuleManager2 > m_xModuleManager;

View File

@ -581,29 +581,18 @@ void SfxDocTplService_Impl::getDirList()
maTemplateDirs = Sequence< OUString >( nCount );
uno::Reference< XComponentContext > xCtx;
uno::Reference< XComponentContext > xCtx(
comphelper::getComponentContext( mxFactory ) );
uno::Reference< util::XMacroExpander > xExpander;
uno::Reference< XPropertySet > xPropSet( mxFactory, UNO_QUERY );
const rtl::OUString aPrefix(
"vnd.sun.star.expand:" );
if ( xPropSet.is() )
{
xPropSet->getPropertyValue(
rtl::OUString(
"DefaultContext" ) )
>>= xCtx;
}
xCtx->getValueByName(
rtl::OUString( "/singletons/com.sun.star.util.theMacroExpander" ) )
>>= xExpander;
if ( xCtx.is() )
{
xCtx->getValueByName(
rtl::OUString( "/singletons/com.sun.star.util.theMacroExpander" ) )
>>= xExpander;
OSL_ENSURE( xExpander.is(),
"Unable to obtain macro expander singleton!" );
}
OSL_ENSURE( xExpander.is(),
"Unable to obtain macro expander singleton!" );
for ( sal_uInt16 i=0; i<nCount; i++ )
{
@ -2861,28 +2850,14 @@ void SfxURLRelocator_Impl::initOfficeInstDirs()
{
OSL_ENSURE( mxFactory.is(), "No service manager!" );
uno::Reference< XComponentContext > xCtx;
uno::Reference< XPropertySet > xPropSet( mxFactory, UNO_QUERY );
if ( xPropSet.is() )
{
xPropSet->getPropertyValue(
rtl::OUString(
"DefaultContext" ) )
>>= xCtx;
}
uno::Reference< XComponentContext > xCtx(
comphelper::getComponentContext( mxFactory ) );
OSL_ENSURE( xCtx.is(),
"Unable to obtain component context from "
"service manager!" );
if ( xCtx.is() )
{
xCtx->getValueByName(
rtl::OUString(
"/singletons/"
"com.sun.star.util.theOfficeInstallationDirectories" ) )
xCtx->getValueByName(
rtl::OUString(
"/singletons/"
"com.sun.star.util.theOfficeInstallationDirectories" ) )
>>= mxOfficeInstDirs;
}
OSL_ENSURE( mxOfficeInstDirs.is(),
"Unable to obtain office installation directory "

View File

@ -18,8 +18,6 @@
*/
#include <svl/urihelper.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include "com/sun/star/lang/XMultiComponentFactory.hpp"
#include "com/sun/star/ucb/Command.hpp"
#include "com/sun/star/ucb/IllegalIdentifierException.hpp"
#include "com/sun/star/ucb/UniversalContentBroker.hpp"
@ -291,15 +289,8 @@ rtl::OUString URIHelper::simpleNormalizedMakeRelative(
{
com::sun::star::uno::Reference< com::sun::star::uri::XUriReference > rel(
URIHelper::normalizedMakeRelative(
com::sun::star::uno::Reference<
com::sun::star::uno::XComponentContext >(
(com::sun::star::uno::Reference<
com::sun::star::beans::XPropertySet >(
comphelper::getProcessServiceFactory(),
com::sun::star::uno::UNO_QUERY_THROW)->
getPropertyValue("DefaultContext")),
com::sun::star::uno::UNO_QUERY_THROW),
baseUriReference, uriReference));
comphelper::getProcessComponentContext(), baseUriReference,
uriReference));
return rel.is() ? rel->getUriReference() : uriReference;
}

View File

@ -38,6 +38,7 @@ $(eval $(call gb_Library_set_include,hatchwindowfactory,\
$(eval $(call gb_Library_use_sdk_api,hatchwindowfactory))
$(eval $(call gb_Library_use_libraries,hatchwindowfactory,\
comphelper \
cppu \
cppuhelper \
sal \

View File

@ -22,9 +22,8 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/frame/DoubleInitializationException.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/awt/XVclWindowPeer.hpp>
#include <comphelper/processfactory.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/dialog.hxx>
@ -267,18 +266,8 @@ uno::Sequence< ::rtl::OUString > SAL_CALL ODocumentCloser::impl_staticGetSupport
uno::Reference< uno::XInterface > SAL_CALL ODocumentCloser::impl_staticCreateSelfInstance(
const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
{
uno::Reference< uno::XComponentContext > xContext;
uno::Reference< beans::XPropertySet > xPropSet( xServiceManager, uno::UNO_QUERY );
if ( xPropSet.is() )
xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ) >>= xContext;
if ( !xContext.is() )
{
throw uno::RuntimeException(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unable to obtain component context from service manager!" ) ),
uno::Reference< uno::XInterface >() );
}
uno::Reference< uno::XComponentContext > xContext(
comphelper::getComponentContext( xServiceManager ) );
return static_cast< cppu::OWeakObject * >( new ODocumentCloser( xContext ) );
}

View File

@ -29,7 +29,6 @@
#include <svtools/templatefoldercache.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/localfilehelper.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/ucb/XDynamicResultSet.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
@ -837,36 +836,15 @@ namespace svt
osl::MutexGuard aGuard( m_aMutex );
if ( !m_xOfficeInstDirs.is() )
{
// @@@ This is bad!
uno::Reference< lang::XMultiServiceFactory > xSMgr
= comphelper::getProcessServiceFactory();
OSL_ENSURE( xSMgr.is(), "No service manager!" );
uno::Reference< beans::XPropertySet > xPropSet(
xSMgr, uno::UNO_QUERY );
if ( xPropSet.is() )
{
uno::Reference< uno::XComponentContext > xCtx;
xPropSet->getPropertyValue(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) )
>>= xCtx;
OSL_ENSURE( xCtx.is(),
"Unable to obtain component context from service manager!" );
if ( xCtx.is() )
{
xCtx->getValueByName(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
uno::Reference< uno::XComponentContext > xCtx(
comphelper::getProcessComponentContext() );
xCtx->getValueByName(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"/singletons/com.sun.star.util.theOfficeInstallationDirectories" ) ) )
>>= m_xOfficeInstDirs;
}
>>= m_xOfficeInstDirs;
OSL_ENSURE( m_xOfficeInstDirs.is(),
"Unable to obtain office directories singleton!" );
}
OSL_ENSURE( m_xOfficeInstDirs.is(),
"Unable to obtain office directories singleton!" );
}
}
return m_xOfficeInstDirs;

View File

@ -570,10 +570,8 @@ void FmPropBrw::impl_createPropertyBrowser_throw( FmFormShell* _pFormShell )
xControlMap = pFormPage->GetImpl().getControlToShapeMap();
// our own component context
Reference< XPropertySet > xFactoryProperties( m_xORB, UNO_QUERY_THROW );
Reference< XComponentContext > xOwnContext(
xFactoryProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ),
UNO_QUERY_THROW );
comphelper::getComponentContext( m_xORB ) );
// a ComponentContext for the
::cppu::ContextEntry_Init aHandlerContextInfo[] =

View File

@ -370,8 +370,8 @@ bool Customization::ImportMenu( CTBWrapper& rWrapper, CustomToolBarImportHelper&
}
uno::Reference< lang::XSingleComponentFactory > xSCF( xIndexContainer, uno::UNO_QUERY_THROW );
uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
uno::Reference< uno::XComponentContext > xContext( xProps->getPropertyValue( "DefaultContext" ), uno::UNO_QUERY_THROW );
uno::Reference< uno::XComponentContext > xContext(
comphelper::getProcessComponentContext() );
// create the popup menu
uno::Sequence< beans::PropertyValue > aPopupMenu( 4 );
aPopupMenu[0].Name = "CommandURL";

View File

@ -339,8 +339,9 @@ void SwTestAccountSettingsDialog::Test()
try
{
uno::Reference< mail::XMailService > xInMailService;
uno::Reference< mail::XMailServiceProvider > xMailServiceProvider =
mail::MailServiceProvider::create(getCurrentCmpCtx(rMgr));
uno::Reference< mail::XMailServiceProvider > xMailServiceProvider(
mail::MailServiceProvider::create(
comphelper::getComponentContext(rMgr)));
uno::Reference< mail::XMailService > xMailService =
xMailServiceProvider->create(
mail::MailServiceType_SMTP);

View File

@ -110,8 +110,9 @@ uno::Reference< mail::XSmtpService > ConnectToSmtpServer(
if (rMgr.is())
try
{
uno::Reference< mail::XMailServiceProvider > xMailServiceProvider =
mail::MailServiceProvider::create(getCurrentCmpCtx(rMgr));
uno::Reference< mail::XMailServiceProvider > xMailServiceProvider(
mail::MailServiceProvider::create(
comphelper::getComponentContext(rMgr)));
xSmtpServer = uno::Reference< mail::XSmtpService > (
xMailServiceProvider->create(
mail::MailServiceType_SMTP
@ -673,17 +674,6 @@ void SwConnectionListener::disposing(const lang::EventObject& /*aEvent*/)
{
}
uno::Reference< uno::XComponentContext> getCurrentCmpCtx(
uno::Reference<lang::XMultiServiceFactory> rSrvMgr)
{
uno::Reference< beans::XPropertySet > xPropSet =
uno::Reference< beans::XPropertySet>(rSrvMgr, uno::UNO_QUERY);
Any aAny = xPropSet->getPropertyValue( ::rtl::OUString("DefaultContext"));
uno::Reference< uno::XComponentContext> rCmpCtx;
aAny >>= rCmpCtx;
return rCmpCtx;
}
SwMailTransferable::SwMailTransferable(const rtl::OUString& rBody, const rtl::OUString& rMimeType) :
cppu::WeakComponentImplHelper2< datatransfer::XTransferable, beans::XPropertySet >(m_aMutex),
m_aMimeType( rMimeType ),

View File

@ -45,18 +45,10 @@
class SwMailMergeConfigItem;
namespace com{ namespace sun{ namespace star{
namespace uno{
class XComponentContext;
}
namespace lang{
class XMultiServiceFactory;
}
namespace mail{
class XSmtpService;
class XMailService;
}
}}}
namespace com { namespace sun { namespace star { namespace mail {
class XMailService;
class XSmtpService;
} } } }
namespace SwMailMergeHelper
{
@ -317,10 +309,6 @@ public:
{m_sSenderAddress = rSenderAddress;}
};
SW_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>
getCurrentCmpCtx(
::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory> rSrvMgr);
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -32,6 +32,7 @@ $(eval $(call gb_Library_set_componentfile,ucphier1,ucb/source/ucp/hierarchy/ucp
$(eval $(call gb_Library_use_sdk_api,ucphier1))
$(eval $(call gb_Library_use_libraries,ucphier1,\
comphelper \
cppu \
cppuhelper \
sal \

View File

@ -41,7 +41,6 @@
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/io/Pipe.hpp>
@ -1705,12 +1704,8 @@ void UniversalContentBroker::globalTransfer(
uno::Reference< ucb::XCommandEnvironment > xLocalEnv;
if (xEnv.is())
{
uno::Reference< beans::XPropertySet > const xProps(
m_xSMgr, uno::UNO_QUERY_THROW );
uno::Reference< uno::XComponentContext > xCtx;
xCtx.set( xProps->getPropertyValue(
rtl::OUString( "DefaultContext" ) ),
uno::UNO_QUERY_THROW );
uno::Reference< uno::XComponentContext > xCtx(
comphelper::getComponentContext( m_xSMgr ) );
xLocalEnv.set( ucb::CommandEnvironment::create(
xCtx,

View File

@ -36,9 +36,9 @@
*************************************************************************/
#include <osl/diagnose.h>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/util/XOfficeInstallationDirectories.hpp>
#include <comphelper/processfactory.hxx>
#include <ucbhelper/contentidentifier.hxx>
#include "hierarchyprovider.hxx"
#include "hierarchycontent.hxx"
@ -279,30 +279,16 @@ HierarchyContentProvider::getOfficeInstallationDirectories()
{
OSL_ENSURE( m_xSMgr.is(), "No service manager!" );
uno::Reference< uno::XComponentContext > xCtx;
uno::Reference< beans::XPropertySet > xPropSet(
m_xSMgr, uno::UNO_QUERY );
if ( xPropSet.is() )
{
xPropSet->getPropertyValue(
rtl::OUString( "DefaultContext" ) )
>>= xCtx;
}
uno::Reference< uno::XComponentContext > xCtx(
comphelper::getComponentContext( m_xSMgr ) );
OSL_ENSURE( xCtx.is(),
"Unable to obtain component context from "
"service manager!" );
if ( xCtx.is() )
{
xCtx->getValueByName(
rtl::OUString( "/singletons/com.sun.star.util.theOfficeInstallationDirectories" ) )
xCtx->getValueByName(
rtl::OUString( "/singletons/com.sun.star.util.theOfficeInstallationDirectories" ) )
>>= m_xOfficeInstDirs;
// Be silent. singleton only available in an Office environment.
// OSL_ENSURE( m_xOfficeInstDirs.is(),
// "Unable to obtain office directories singleton!" );
}
// OSL_ENSURE( m_xOfficeInstDirs.is(),
// "Unable to obtain office directories singleton!" );
}
}
return m_xOfficeInstDirs;

View File

@ -33,6 +33,7 @@
*************************************************************************/
#include <comphelper/processfactory.hxx>
#include <osl/diagnose.h>
#include "osl/doublecheckedlocking.h"
#include <rtl/uri.hxx>
@ -199,12 +200,8 @@ uno::Any SAL_CALL Content::queryInterface( const uno::Type & rType )
{
try
{
uno::Reference< beans::XPropertySet > const xProps(
m_xSMgr, uno::UNO_QUERY_THROW );
uno::Reference< uno::XComponentContext > xCtx;
xCtx.set( xProps->getPropertyValue(
rtl::OUString( "DefaultContext" ) ),
uno::UNO_QUERY_THROW );
uno::Reference< uno::XComponentContext > xCtx(
comphelper::getComponentContext( m_xSMgr ) );
uno::Reference< task::XInteractionHandler > xIH(
task::PasswordContainerInteractionHandler::create( xCtx ) );

View File

@ -24,7 +24,6 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
#include "com/sun/star/util/XMacroExpander.hpp"
#include "com/sun/star/beans/XPropertySet.hpp"
#include <rtl/uri.hxx>
#include <rtl/instance.hxx>
#include <osl/mutex.hxx>
@ -939,16 +938,12 @@ static uno::Reference< util::XMacroExpander > lcl_GetMacroExpander()
{
if ( !xMacroExpander.is() )
{
uno::Reference< uno::XComponentContext > xContext;
uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext"))) >>= xContext;
if ( xContext.is() )
{
aG_xMacroExpander = uno::Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName(
uno::Reference< uno::XComponentContext > xContext(
comphelper::getProcessComponentContext() );
aG_xMacroExpander = uno::Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName(
OUString(RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.util.theMacroExpander"))),
uno::UNO_QUERY );
xMacroExpander = aG_xMacroExpander;
}
xMacroExpander = aG_xMacroExpander;
}
}

View File

@ -29,7 +29,6 @@
#include <com/sun/star/script/XDefaultProperty.hpp>
#include <com/sun/star/script/Converter.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XIntrospection.hpp>
@ -155,15 +154,8 @@ dispatchRequests (const uno::Reference< frame::XModel>& xModel, const OUString &
uno::Reference<frame::XDispatchProvider> xDispatchProvider (xFrame,uno::UNO_QUERY_THROW);
try
{
uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
uno::Reference<uno::XComponentContext > xContext( xProps->getPropertyValue( "DefaultContext" ), uno::UNO_QUERY_THROW );
if ( !xContext.is() )
return;
uno::Reference<lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
if ( !xServiceManager.is() )
return;
uno::Reference<uno::XComponentContext > xContext(
comphelper::getProcessComponentContext() );
uno::Reference<util::XURLTransformer> xParser( util::URLTransformer::create(xContext) );
xParser->parseStrict (url);
}

View File

@ -59,8 +59,6 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp>
#include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
@ -1083,23 +1081,9 @@ void* AquaSalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rRetur
// to UTF-8 before encoding non ascii characters, which is not what other apps expect.
static rtl::OUString translateToExternalUrl(const rtl::OUString& internalUrl)
{
rtl::OUString extUrl;
uno::Reference< lang::XMultiServiceFactory > sm = comphelper::getProcessServiceFactory();
if (sm.is())
{
uno::Reference< beans::XPropertySet > pset;
sm->queryInterface( getCppuType( &pset )) >>= pset;
if (pset.is())
{
uno::Reference< uno::XComponentContext > context;
static const rtl::OUString DEFAULT_CONTEXT( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) );
pset->getPropertyValue(DEFAULT_CONTEXT) >>= context;
if (context.is())
extUrl = uri::ExternalUriReferenceTranslator::create(context)->translateToExternal(internalUrl);
}
}
return extUrl;
uno::Reference< uno::XComponentContext > context(
comphelper::getProcessComponentContext());
return uri::ExternalUriReferenceTranslator::create(context)->translateToExternal(internalUrl);
}
// #i104525# many versions of OSX have problems with some URLs:

View File

@ -36,6 +36,7 @@
#include <rtl/ustrbuf.hxx>
#include "inputstream.hxx"
#include <algorithm>
#include <cassert>
#include <string.h>
#include <helpcompiler/HelpIndexer.hxx>
@ -44,7 +45,6 @@
#include "com/sun/star/deployment/ExtensionManager.hpp"
#include "com/sun/star/deployment/thePackageManagerFactory.hpp"
#include <comphelper/processfactory.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/beans/Optional.hpp>
@ -1406,12 +1406,14 @@ ExtensionIteratorBase::ExtensionIteratorBase( Reference< XComponentContext > xCo
, m_aInitialModule( aInitialModule )
, m_aLanguage( aLanguage )
{
assert( m_xContext.is() );
init();
}
ExtensionIteratorBase::ExtensionIteratorBase( Databases& rDatabases,
const rtl::OUString& aInitialModule, const rtl::OUString& aLanguage )
: m_rDatabases( rDatabases )
: m_xContext( comphelper::getProcessComponentContext() )
, m_rDatabases( rDatabases )
, m_eState( INITIAL_MODULE )
, m_aInitialModule( aInitialModule )
, m_aLanguage( aLanguage )
@ -1421,25 +1423,6 @@ ExtensionIteratorBase::ExtensionIteratorBase( Databases& rDatabases,
void ExtensionIteratorBase::init()
{
if( !m_xContext.is() )
{
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
Reference< XPropertySet > xProps( xFactory, UNO_QUERY );
OSL_ASSERT( xProps.is() );
if (xProps.is())
{
xProps->getPropertyValue(
::rtl::OUString( "DefaultContext" ) ) >>= m_xContext;
OSL_ASSERT( m_xContext.is() );
}
}
if( !m_xContext.is() )
{
throw RuntimeException(
::rtl::OUString( "ExtensionIteratorBase::init(), no XComponentContext" ),
Reference< XInterface >() );
}
m_xSFA = ucb::SimpleFileAccess::create(m_xContext);
m_bUserPackagesLoaded = false;

View File

@ -44,7 +44,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <comphelper/processfactory.hxx>
#include <unotools/configmgr.hxx>
#include <rtl/bootstrap.hxx>
@ -345,15 +345,8 @@ void ContentProvider::init()
rtl::Bootstrap::expandMacros(aPath);
aImagesZipPaths[ 1 ] = aPath;
uno::Reference< uno::XComponentContext > xContext;
uno::Reference< beans::XPropertySet > xProps( m_xSMgr, uno::UNO_QUERY );
OSL_ASSERT( xProps.is() );
if (xProps.is())
{
xProps->getPropertyValue(
::rtl::OUString( "DefaultContext" ) ) >>= xContext;
OSL_ASSERT( xContext.is() );
}
uno::Reference< uno::XComponentContext > xContext(
comphelper::getComponentContext( m_xSMgr ) );
sal_Bool showBasic = getBooleanKey(xHierAccess,"Help/ShowBasic");
m_pDatabases = new Databases( showBasic,

View File

@ -53,7 +53,6 @@
#include <com/sun/star/ucb/XContentProvider.hpp>
#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include "urlparameter.hxx"
#include "databases.hxx"
@ -993,21 +992,8 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam,
if( bAddExtensionPath )
{
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
Reference< XPropertySet > xProps( xFactory, UNO_QUERY );
OSL_ASSERT( xProps.is() );
Reference< XComponentContext > xContext;
if (xProps.is())
{
xProps->getPropertyValue(
::rtl::OUString( "DefaultContext" ) ) >>= xContext;
}
if( !xContext.is() )
{
throw RuntimeException(
::rtl::OUString( "InputStreamTransformer::InputStreamTransformer(), no XComponentContext" ),
Reference< XInterface >() );
}
Reference< XComponentContext > xContext(
comphelper::getProcessComponentContext() );
rtl::OUString aOUExpandedExtensionPath = Databases::expandURL( aExtensionRegistryPath, xContext );
rtl::OString aExpandedExtensionPath = rtl::OUStringToOString( aOUExpandedExtensionPath, osl_getThreadTextEncoding() );

View File

@ -296,21 +296,6 @@ public:
namespace
{
Reference< uno::XComponentContext > lcl_getComponentContext()
{
Reference< uno::XComponentContext > xContext;
try
{
Reference< beans::XPropertySet > xFactProp( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
if( xFactProp.is())
xFactProp->getPropertyValue(OUString( "DefaultContext" )) >>= xContext;
}
catch( const uno::Exception& )
{
}
return xContext;
}
class lcl_MatchesRole : public ::std::unary_function< Reference< chart2::data::XLabeledDataSequence >, bool >
{
@ -400,15 +385,13 @@ Reference< chart2::data::XLabeledDataSequence > lcl_getCategories( const Referen
Reference< chart2::data::XDataSource > lcl_createDataSource(
const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aData )
{
Reference< chart2::data::XDataSink > xSink;
Reference< uno::XComponentContext > xContext( lcl_getComponentContext());
if( xContext.is() )
xSink.set(
xContext->getServiceManager()->createInstanceWithContext(
OUString( "com.sun.star.chart2.data.DataSource" ),
xContext ), uno::UNO_QUERY_THROW );
if( xSink.is())
xSink->setData( aData );
Reference< uno::XComponentContext > xContext(
comphelper::getProcessComponentContext() );
Reference< chart2::data::XDataSink > xSink(
xContext->getServiceManager()->createInstanceWithContext(
"com.sun.star.chart2.data.DataSource", xContext ),
uno::UNO_QUERY_THROW );
xSink->setData( aData );
return Reference< chart2::data::XDataSource >( xSink, uno::UNO_QUERY );
}

View File

@ -70,21 +70,6 @@ using ::com::sun::star::uno::Sequence;
namespace
{
Reference< uno::XComponentContext > lcl_getComponentContext()
{
Reference< uno::XComponentContext > xContext;
try
{
Reference< beans::XPropertySet > xFactProp( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
if( xFactProp.is())
xFactProp->getPropertyValue(OUString( "DefaultContext" )) >>= xContext;
}
catch( uno::Exception& )
{}
return xContext;
}
class lcl_MatchesChartType : public ::std::unary_function< Reference< chart2::XChartType >, bool >
{
public:
@ -489,7 +474,8 @@ Reference< chart2::XDataSeries > SchXMLImportHelper::GetNewDataSeries(
xDoc->getFirstDiagram(), uno::UNO_QUERY_THROW );
Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq(
xCooSysCnt->getCoordinateSystems());
Reference< uno::XComponentContext > xContext( lcl_getComponentContext());
Reference< uno::XComponentContext > xContext(
comphelper::getProcessComponentContext() );
if( nCoordinateSystemIndex < aCooSysSeq.getLength())
{

View File

@ -72,20 +72,6 @@ using ::com::sun::star::uno::Sequence;
namespace
{
Reference< uno::XComponentContext > lcl_getComponentContext()
{
Reference< uno::XComponentContext > xContext;
try
{
Reference< beans::XPropertySet > xFactProp( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
if( xFactProp.is())
xFactProp->getPropertyValue(OUString( "DefaultContext" )) >>= xContext;
}
catch( uno::Exception& )
{}
return xContext;
}
rtl::OUString lcl_getGeneratorFromModel( const uno::Reference< frame::XModel >& xChartModel )
{
@ -375,13 +361,12 @@ XMLTokenEnum getTokenByChartType(
Reference< chart2::data::XLabeledDataSequence > GetNewLabeledDataSequence()
{
Reference< chart2::data::XLabeledDataSequence > xResult;
Reference< uno::XComponentContext > xContext( lcl_getComponentContext());
if( xContext.is() )
xResult.set(
xContext->getServiceManager()->createInstanceWithContext(
OUString( "com.sun.star.chart2.data.LabeledDataSequence" ),
xContext ), uno::UNO_QUERY_THROW );
Reference< uno::XComponentContext > xContext(
comphelper::getProcessComponentContext() );
Reference< chart2::data::XLabeledDataSequence > xResult(
xContext->getServiceManager()->createInstanceWithContext(
"com.sun.star.chart2.data.LabeledDataSequence", xContext ),
uno::UNO_QUERY_THROW );
return xResult;
}