tdf#107847 Make sure m_xContext is not empty

Change-Id: I21d87b3a3d9732266e8c7d18cc07924700aaaafc
This commit is contained in:
Maxim Monastirsky
2017-05-14 23:49:52 +03:00
parent b08e9f0807
commit a4f512d09f
2 changed files with 6 additions and 10 deletions

View File

@@ -676,28 +676,24 @@ void SfxConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
SetUpdateMode(false); SetUpdateMode(false);
ClearAll(); // Remove all old entries from treelist box ClearAll(); // Remove all old entries from treelist box
m_xContext = xContext;
m_xFrame = xFrame; m_xFrame = xFrame;
if( xContext.is() ) if( bEventMode )
{ {
m_xContext = xContext;
m_sModuleLongName = sModuleLongName; m_sModuleLongName = sModuleLongName;
m_xGlobalCategoryInfo = css::ui::theUICategoryDescription::get( m_xContext ); m_xGlobalCategoryInfo = css::ui::theUICategoryDescription::get( m_xContext );
m_xModuleCategoryInfo.set(m_xGlobalCategoryInfo->getByName(m_sModuleLongName), css::uno::UNO_QUERY_THROW); m_xModuleCategoryInfo.set(m_xGlobalCategoryInfo->getByName(m_sModuleLongName), css::uno::UNO_QUERY_THROW);
m_xUICmdDescription = css::frame::theUICommandDescription::get( m_xContext ); m_xUICmdDescription = css::frame::theUICommandDescription::get( m_xContext );
if ( bEventMode ) InitModule();
InitModule();
} }
SAL_INFO("cui.customize", "** ** About to initialise SF Scripts"); SAL_INFO("cui.customize", "** ** About to initialise SF Scripts");
// Add Scripting Framework entries // Add Scripting Framework entries
Reference< browse::XBrowseNode > rootNode; Reference< browse::XBrowseNode > rootNode;
Reference< XComponentContext > xCtx(
comphelper::getProcessComponentContext() );
try try
{ {
Reference< browse::XBrowseNodeFactory > xFac = browse::theBrowseNodeFactory::get( xCtx ); Reference< browse::XBrowseNodeFactory > xFac = browse::theBrowseNodeFactory::get( m_xContext );
rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) ); rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) );
} }
catch( Exception& e ) catch( Exception& e )
@@ -731,7 +727,7 @@ void SfxConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
} }
// add styles // add styles
if ( bEventMode && m_xContext.is() ) if ( bEventMode )
{ {
OUString sStyle(xImp->m_aStrGroupStyles); OUString sStyle(xImp->m_aStrGroupStyles);
SvTreeListEntry *pEntry = InsertEntry( sStyle ); SvTreeListEntry *pEntry = InsertEntry( sStyle );

View File

@@ -375,7 +375,7 @@ IMPL_LINK( SfxMacroTabPage, TimeOut_Impl, Timer*,, void )
} }
// fill macro list // fill macro list
mpImpl->pGroupLB->Init( mpImpl->pGroupLB->Init(
css::uno::Reference<css::uno::XComponentContext >(), comphelper::getProcessComponentContext(),
GetFrame(), GetFrame(),
OUString(), false); OUString(), false);
if ( pTabDlg ) if ( pTabDlg )