summaryrefslogtreecommitdiff
path: root/cui/source
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-05-13 08:20:58 +0200
committerNoel Grandin <noel@peralex.com>2013-05-13 09:38:03 +0200
commit49e422e58e3193f1614298eb61c756abb299330f (patch)
treeb228a5d379cbf6c5c9a3422d484d96c010d3447f /cui/source
parent088e86b865062dd4cc5ba0c85c6068dea62238db (diff)
fdo#46808, Convert ui::UICategoryDescripion to new style
Change-Id: I4fbba222b8429b5935c8e15c74d1670edd4fb303
Diffstat (limited to 'cui/source')
-rw-r--r--cui/source/customize/acccfg.cxx29
-rw-r--r--cui/source/customize/cfgutil.cxx39
-rw-r--r--cui/source/customize/selector.cxx54
-rw-r--r--cui/source/inc/acccfg.hxx2
-rw-r--r--cui/source/inc/cfgutil.hxx6
-rw-r--r--cui/source/tabpages/macroass.cxx2
6 files changed, 60 insertions, 72 deletions
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index fd8a03bcfbb4..a5770f11edf1 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -822,47 +822,46 @@ SfxAcceleratorConfigPage::~SfxAcceleratorConfigPage()
void SfxAcceleratorConfigPage::InitAccCfg()
{
// already initialized ?
- if (m_xSMGR.is())
+ if (m_xContext.is())
return; // yes -> do nothing
try
{
// no - initialize this instance
- m_xSMGR = ::comphelper::getProcessServiceFactory();
+ m_xContext = ::comphelper::getProcessComponentContext();
- m_xUICmdDescription = css::frame::UICommandDescription::create(
- comphelper::getComponentContext(m_xSMGR));
+ m_xUICmdDescription = css::frame::UICommandDescription::create(m_xContext);
// get the current active frame, which should be our "parent"
// for this session
m_xFrame = GetFrame();
if ( !m_xFrame.is() )
{
- css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( comphelper::getComponentContext(m_xSMGR) );
+ css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( m_xContext );
m_xFrame = xDesktop->getActiveFrame();
}
// identify module
- css::uno::Reference< css::frame::XModuleManager2 > xModuleManager(
- css::frame::ModuleManager::create(comphelper::getComponentContext(m_xSMGR)));
+ css::uno::Reference< css::frame::XModuleManager2 > xModuleManager =
+ css::frame::ModuleManager::create(m_xContext);
m_sModuleLongName = xModuleManager->identify(m_xFrame);
::comphelper::SequenceAsHashMap lModuleProps(xModuleManager->getByName(m_sModuleLongName));
m_sModuleShortName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_SHORTNAME, OUString());
m_sModuleUIName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_UINAME , OUString());
// get global accelerator configuration
- m_xGlobal = css::ui::GlobalAcceleratorConfiguration::create(comphelper::getComponentContext(m_xSMGR));
+ m_xGlobal = css::ui::GlobalAcceleratorConfiguration::create(m_xContext);
// get module accelerator configuration
- css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier(css::ui::ModuleUIConfigurationManagerSupplier::create(comphelper::getComponentContext(m_xSMGR)));
+ css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier( css::ui::ModuleUIConfigurationManagerSupplier::create(m_xContext) );
css::uno::Reference< css::ui::XUIConfigurationManager > xUICfgManager = xModuleCfgSupplier->getUIConfigurationManager(m_sModuleLongName);
m_xModule = css::uno::Reference< css::ui::XAcceleratorConfiguration >(xUICfgManager->getShortCutManager(), css::uno::UNO_QUERY_THROW);
}
catch(const css::uno::RuntimeException&)
{ throw; }
catch(const css::uno::Exception&)
- { m_xSMGR.clear(); }
+ { m_xContext.clear(); }
}
//-----------------------------------------------
@@ -1185,7 +1184,7 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, RadioHdl)
aEntriesBox.SetUpdateMode( sal_True );
aEntriesBox.Invalidate();
- pGroupLBox->Init(m_xSMGR, m_xFrame, m_sModuleLongName);
+ pGroupLBox->Init(m_xContext, m_xFrame, m_sModuleLongName);
// pb: #133213# do not select NULL entries
SvTreeListEntry* pEntry = aEntriesBox.GetEntry( 0, 0 );
@@ -1231,7 +1230,7 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, LoadHdl)
{
// URL doesn't point to a loaded document, try to access it as a single storage
// dont forget to release the storage afterwards!
- css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory( css::embed::StorageFactory::create( comphelper::getComponentContext(m_xSMGR) ) );
+ css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory( css::embed::StorageFactory::create( m_xContext ) );
css::uno::Sequence< css::uno::Any > lArgs(2);
lArgs[0] <<= sCfgName;
lArgs[1] <<= css::embed::ElementModes::READ;
@@ -1240,7 +1239,7 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, LoadHdl)
css::uno::Reference< css::embed::XStorage > xUIConfig = xRootStorage->openStorageElement(FOLDERNAME_UICONFIG, css::embed::ElementModes::READ);
if (xUIConfig.is())
{
- css::uno::Reference< css::ui::XUIConfigurationManager2 > xCfgMgr2 = css::ui::UIConfigurationManager::create( comphelper::getComponentContext(m_xSMGR) );
+ css::uno::Reference< css::ui::XUIConfigurationManager2 > xCfgMgr2 = css::ui::UIConfigurationManager::create( m_xContext );
xCfgMgr2->setStorage(xUIConfig);
xCfgMgr.set( xCfgMgr2, css::uno::UNO_QUERY_THROW );
}
@@ -1314,7 +1313,7 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, SaveHdl)
else
{
// URL doesn't point to a loaded document, try to access it as a single storage
- css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory( css::embed::StorageFactory::create( comphelper::getComponentContext(m_xSMGR) ) );
+ css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory( css::embed::StorageFactory::create( m_xContext ) );
css::uno::Sequence< css::uno::Any > lArgs(2);
lArgs[0] <<= sCfgName;
lArgs[1] <<= css::embed::ElementModes::WRITE;
@@ -1336,7 +1335,7 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, SaveHdl)
if (sMediaType.isEmpty())
xUIConfigProps->setPropertyValue(MEDIATYPE_PROPNAME, css::uno::makeAny(MEDIATYPE_UICONFIG));
- css::uno::Reference< css::ui::XUIConfigurationManager2 > xCfgMgr2 = css::ui::UIConfigurationManager::create( comphelper::getComponentContext(m_xSMGR) );
+ css::uno::Reference< css::ui::XUIConfigurationManager2 > xCfgMgr2 = css::ui::UIConfigurationManager::create( m_xContext );
xCfgMgr2->setStorage(xUIConfig);
xCfgMgr.set( xCfgMgr2, css::uno::UNO_QUERY_THROW );
}
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 2fce78c05b1e..98bec2a3ca23 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -20,22 +20,22 @@
#include "cfgutil.hxx"
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/document/XScriptInvocationContext.hpp>
+#include <com/sun/star/frame/ModuleManager.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/frame/UICommandDescription.hpp>
#include <com/sun/star/frame/XDispatchInformationProvider.hpp>
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
-#include <com/sun/star/script/provider/XScriptProvider.hpp>
#include <com/sun/star/script/browse/XBrowseNode.hpp>
#include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
-
#include <com/sun/star/script/browse/XBrowseNodeFactory.hpp>
#include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp>
-#include <com/sun/star/frame/ModuleManager.hpp>
-#include <com/sun/star/frame/Desktop.hpp>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/container/XEnumeration.hpp>
-#include <com/sun/star/document/XScriptInvocationContext.hpp>
+#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
+#include <com/sun/star/script/provider/XScriptProvider.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-#include <com/sun/star/frame/UICommandDescription.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/ui/UICategoryDescription.hpp>
#include "acccfg.hrc"
#include "helpid.hrc"
@@ -66,8 +66,6 @@ using namespace ::com::sun::star::script;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::document;
-static OUString SERVICE_UICATEGORYDESCRIPTION ("com.sun.star.ui.UICategoryDescription");
-
SfxStylesInfo_Impl::SfxStylesInfo_Impl()
{}
@@ -540,23 +538,22 @@ namespace
}
//-----------------------------------------------
-void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
- const css::uno::Reference< css::frame::XFrame >& xFrame ,
+void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::frame::XFrame >& xFrame,
const OUString& sModuleLongName)
{
SetUpdateMode(sal_False);
ClearAll(); // Remove all old entries from treelist box
m_xFrame = xFrame;
- if ( xSMGR.is())
+ if( xContext.is() )
{
- m_xSMGR = xSMGR;
+ m_xContext = xContext;
m_sModuleLongName = sModuleLongName;
- m_xGlobalCategoryInfo = css::uno::Reference< css::container::XNameAccess >(m_xSMGR->createInstance(SERVICE_UICATEGORYDESCRIPTION), css::uno::UNO_QUERY_THROW);
- m_xModuleCategoryInfo = css::uno::Reference< css::container::XNameAccess >(m_xGlobalCategoryInfo->getByName(m_sModuleLongName) , css::uno::UNO_QUERY_THROW);
- m_xUICmdDescription = css::frame::UICommandDescription::create(
- ::comphelper::getComponentContext(m_xSMGR));
+ m_xGlobalCategoryInfo = css::ui::UICategoryDescription::create( m_xContext );
+ m_xModuleCategoryInfo = css::uno::Reference< css::container::XNameAccess >(m_xGlobalCategoryInfo->getByName(m_sModuleLongName), css::uno::UNO_QUERY_THROW);
+ m_xUICmdDescription = css::frame::UICommandDescription::create( m_xContext );
InitModule();
InitBasic();
@@ -699,7 +696,7 @@ void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::lang::XMul
}
// add styles
- if ( m_xSMGR.is() )
+ if ( m_xContext.is() )
{
String sStyle( pImp->m_aStrGroupStyles );
SvTreeListEntry *pEntry = InsertEntry( sStyle, 0 );
diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx
index 9a8e5d026847..89d0a7627efe 100644
--- a/cui/source/customize/selector.cxx
+++ b/cui/source/customize/selector.cxx
@@ -37,22 +37,24 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
-#include <com/sun/star/script/provider/XScriptProvider.hpp>
-#include <com/sun/star/script/browse/XBrowseNode.hpp>
-#include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
-#include <com/sun/star/script/browse/XBrowseNodeFactory.hpp>
-#include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp>
-#include <com/sun/star/frame/ModuleManager.hpp>
-#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XEnumeration.hpp>
#include <com/sun/star/document/XEmbeddedScripts.hpp>
#include <com/sun/star/document/XScriptInvocationContext.hpp>
+#include <com/sun/star/frame/ModuleManager.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XDispatchInformationProvider.hpp>
#include <com/sun/star/frame/DispatchInformation.hpp>
-#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/frame/UICommandDescription.hpp>
+#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
+#include <com/sun/star/script/provider/XScriptProvider.hpp>
+#include <com/sun/star/script/browse/XBrowseNode.hpp>
+#include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
+#include <com/sun/star/script/browse/XBrowseNodeFactory.hpp>
+#include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp>
+#include <com/sun/star/ui/UICategoryDescription.hpp>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -396,9 +398,6 @@ void SvxConfigGroupListBox::Init(bool bShowSlots, const Reference< frame::XFrame
// are we showing builtin commands?
if ( m_bShowSlots && m_xFrame.is() )
{
- Reference< lang::XMultiComponentFactory > xMCF =
- xContext->getServiceManager();
-
Reference< frame::XDispatchInformationProvider > xDIP(
m_xFrame, UNO_QUERY );
@@ -414,34 +413,27 @@ void SvxConfigGroupListBox::Init(bool bShowSlots, const Reference< frame::XFrame
frame::UICommandDescription::create(xContext) );
xNameAccess->getByName( aModuleId ) >>= m_xModuleCommands;
- Reference< container::XNameAccess > xAllCategories(
- xMCF->createInstanceWithContext(
- OUString(
- "com.sun.star.ui.UICategoryDescription" ),
- xContext ),
- UNO_QUERY );
+ Reference< container::XNameAccess > xAllCategories =
+ ui::UICategoryDescription::create( xContext );
Reference< container::XNameAccess > xModuleCategories;
- if ( xAllCategories.is() )
+ if ( !aModuleId.isEmpty() )
{
- if ( !aModuleId.isEmpty() )
+ try
{
- try
- {
- xModuleCategories = Reference< container::XNameAccess >(
- xAllCategories->getByName( aModuleId ), UNO_QUERY );
- }
- catch ( container::NoSuchElementException& )
- {
- }
+ xModuleCategories = Reference< container::XNameAccess >(
+ xAllCategories->getByName( aModuleId ), UNO_QUERY );
}
-
- if ( !xModuleCategories.is() )
+ catch ( container::NoSuchElementException& )
{
- xModuleCategories = xAllCategories;
}
}
+ if ( !xModuleCategories.is() )
+ {
+ xModuleCategories = xAllCategories;
+ }
+
if ( xModuleCategories.is() )
{
Sequence< sal_Int16 > gids =
diff --git a/cui/source/inc/acccfg.hxx b/cui/source/inc/acccfg.hxx
index 235499896f69..417a456cdc0c 100644
--- a/cui/source/inc/acccfg.hxx
+++ b/cui/source/inc/acccfg.hxx
@@ -138,7 +138,7 @@ private:
SfxStylesInfo_Impl m_aStylesInfo;
sal_Bool m_bStylesInfoInitialized;
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobal;
css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModule;
css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xAct;
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index 66ea8dbed5e2..609ef3440d3a 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -134,7 +134,7 @@ class SfxConfigGroupListBox_Impl : public SvTreeListBox
sal_uLong nMode;
OUString m_sModuleLongName;
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::uno::Reference< css::frame::XFrame > m_xFrame;
css::uno::Reference< css::container::XNameAccess > m_xGlobalCategoryInfo;
css::uno::Reference< css::container::XNameAccess > m_xModuleCategoryInfo;
@@ -172,8 +172,8 @@ public:
~SfxConfigGroupListBox_Impl();
void ClearAll();
- void Init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
- const css::uno::Reference< css::frame::XFrame >& xFrame ,
+ void Init(const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::frame::XFrame >& xFrame,
const OUString& sModuleLongName);
void SetFunctionListBox( SfxConfigFunctionListBox_Impl *pBox )
{ pFunctionListBox = pBox; }
diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx
index 92db6ddac044..084a17198290 100644
--- a/cui/source/tabpages/macroass.cxx
+++ b/cui/source/tabpages/macroass.cxx
@@ -424,7 +424,7 @@ void _SfxMacroTabPage::FillMacroList()
{
mpImpl->pGroupLB->Init(
::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory >(),
+ ::com::sun::star::uno::XComponentContext >(),
GetFrame(),
OUString() );
}