fdo#46808, some simple conversions to XComponentContext

Change-Id: I68e90fde0645d4d1d518d22620d4c28ae91139d4
This commit is contained in:
Noel Grandin
2013-01-31 17:19:17 +02:00
parent 834dcf3acd
commit a9934b36fe
4 changed files with 9 additions and 16 deletions

View File

@@ -137,9 +137,9 @@ namespace bib
if( m_xControlContainer.is())
{
uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory();
uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
if ( m_xGridModel.is() && xMgr.is())
if ( m_xGridModel.is())
{
uno::Reference< XPropertySet > xPropSet( m_xGridModel, UNO_QUERY );
@@ -149,10 +149,8 @@ namespace bib
rtl::OUString aControlName;
aAny >>= aControlName;
m_xControl = Reference< awt::XControl > (xMgr->createInstance( aControlName ), UNO_QUERY );
DBG_ASSERT( m_xControl.is(), "no GridControl created" );
if ( m_xControl.is() )
m_xControl->setModel( m_xGridModel );
m_xControl = Reference< awt::XControl > ( xContext->getServiceManager()->createInstanceWithContext(aControlName, xContext), UNO_QUERY_THROW );
m_xControl->setModel( m_xGridModel );
}
if ( m_xControl.is() )

View File

@@ -564,8 +564,6 @@ DBChangeDialog_Impl::DBChangeDialog_Impl(Window* pParent, BibDataManager* pMan )
aSelectionLB.SetDoubleClickHdl( LINK(this, DBChangeDialog_Impl, DoubleClickHdl));
try
{
Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory();
::Size aSize = aSelectionHB.GetSizePixel();
long nTabs[2];
nTabs[0] = 1;// Number of Tabs
@@ -1403,8 +1401,8 @@ Reference< awt::XControlModel > BibDataManager::loadControlModel(
else
aInstanceName += getControlName(nFormatKey);
Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory();
Reference< XInterface > xObject = xMgr->createInstance(aInstanceName);
Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
Reference< XInterface > xObject = xContext->getServiceManager()->createInstanceWithContext(aInstanceName, xContext);
xModel=Reference< awt::XControlModel > ( xObject, UNO_QUERY );
Reference< XPropertySet > xPropSet( xModel, UNO_QUERY );
Any aFieldName; aFieldName <<= aName;

View File

@@ -279,7 +279,6 @@ BibGeneralPage::BibGeneralPage(Window* pParent, BibDataManager* pMan):
xCtrlContnr = VCLUnoHelper::CreateControlContainer(&aControlParentWin);
xMgr = comphelper::getProcessServiceFactory();
// the control should be a bit smaller than the fixed text
Size aControlSize(aIdentifierFT.GetSizePixel());
aControlSize.Width() = aControlSize.Width() * 8 / 10;
@@ -464,7 +463,7 @@ uno::Reference< awt::XControlModel > BibGeneralPage::AddXControl(
{
sal_Bool bTypeListBox = sTypeColumnName == rName;
xCtrModel = pDatMan->loadControlModel(rName, bTypeListBox);
if ( xCtrModel.is() && xMgr.is())
if ( xCtrModel.is() )
{
uno::Reference< beans::XPropertySet > xPropSet( xCtrModel, UNO_QUERY );
@@ -523,7 +522,8 @@ uno::Reference< awt::XControlModel > BibGeneralPage::AddXControl(
}
uno::Reference< awt::XControl > xControl(xMgr->createInstance( aControlName ), UNO_QUERY );
uno::Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
uno::Reference< awt::XControl > xControl( xContext->getServiceManager()->createInstanceWithContext(aControlName, xContext), UNO_QUERY);
if ( xControl.is() )
{
xControl->setModel( xCtrModel);

View File

@@ -111,9 +111,6 @@ class BibGeneralPage: public BibGeneralPageBaseClass, public BibTabPage
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
xCtrlContnr;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
xMgr;
::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent >
xCurrentBoundComponent;