Kaydet (Commit) 5e9a7f19 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Related fdo#46808: Improve previous commit slightly

Change-Id: Ib4f44f745f7e3e2e1403d905cc16bee4c487b0b4
üst 432c0f49
...@@ -1183,12 +1183,11 @@ void AutoRecovery::implts_specifyAppModuleAndFactory(AutoRecovery::TDocumentInfo ...@@ -1183,12 +1183,11 @@ void AutoRecovery::implts_specifyAppModuleAndFactory(AutoRecovery::TDocumentInfo
// <- SAFE ---------------------------------- // <- SAFE ----------------------------------
css::uno::Reference< css::frame::XModuleManager2 > xManager = ModuleManager::create( comphelper::getComponentContext(xSMGR) ); css::uno::Reference< css::frame::XModuleManager2 > xManager = ModuleManager::create( comphelper::getComponentContext(xSMGR) );
css::uno::Reference< css::container::XNameAccess > xModuleConfig(xManager, css::uno::UNO_QUERY_THROW);
if (rInfo.AppModule.isEmpty()) if (rInfo.AppModule.isEmpty())
rInfo.AppModule = xManager->identify(rInfo.Document); rInfo.AppModule = xManager->identify(rInfo.Document);
::comphelper::SequenceAsHashMap lModuleDescription(xModuleConfig->getByName(rInfo.AppModule)); ::comphelper::SequenceAsHashMap lModuleDescription(xManager->getByName(rInfo.AppModule));
lModuleDescription[rtl::OUString(CFG_ENTRY_PROP_EMPTYDOCUMENTURL)] >>= rInfo.FactoryURL; lModuleDescription[rtl::OUString(CFG_ENTRY_PROP_EMPTYDOCUMENTURL)] >>= rInfo.FactoryURL;
lModuleDescription[rtl::OUString(CFG_ENTRY_PROP_FACTORYSERVICE)] >>= rInfo.FactoryService; lModuleDescription[rtl::OUString(CFG_ENTRY_PROP_FACTORYSERVICE)] >>= rInfo.FactoryService;
} }
......
...@@ -67,7 +67,7 @@ ModuleManager::impl_createFactory( ...@@ -67,7 +67,7 @@ ModuleManager::impl_createFactory(
css::uno::Sequence< rtl::OUString > css::uno::Sequence< rtl::OUString >
ModuleManager::impl_getSupportedServiceNames() { ModuleManager::impl_getSupportedServiceNames() {
css::uno::Sequence< rtl::OUString > s(1); css::uno::Sequence< rtl::OUString > s(1);
s[0] = DECLARE_ASCII("com.sun.star.frame.ModuleManager"); s[0] = "com.sun.star.frame.ModuleManager";
return s; return s;
} }
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/i18nhelp.hxx> #include <vcl/i18nhelp.hxx>
...@@ -493,12 +492,11 @@ void NewMenuController::impl_setPopupMenu() ...@@ -493,12 +492,11 @@ void NewMenuController::impl_setPopupMenu()
m_aModuleIdentifier = xModuleManager->identify( m_xFrame ); m_aModuleIdentifier = xModuleManager->identify( m_xFrame );
m_bModuleIdentified = sal_True; m_bModuleIdentified = sal_True;
Reference< XNameAccess > xNameAccess( xModuleManager, UNO_QUERY ); if ( !m_aModuleIdentifier.isEmpty() )
if ( !m_aModuleIdentifier.isEmpty() && xNameAccess.is() )
{ {
Sequence< PropertyValue > aSeq; Sequence< PropertyValue > aSeq;
if ( xNameAccess->getByName( m_aModuleIdentifier ) >>= aSeq ) if ( xModuleManager->getByName( m_aModuleIdentifier ) >>= aSeq )
{ {
for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ ) for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ )
{ {
......
...@@ -664,15 +664,14 @@ UICommandDescription::~UICommandDescription() ...@@ -664,15 +664,14 @@ UICommandDescription::~UICommandDescription()
void UICommandDescription::impl_fillElements(const sal_Char* _pName) void UICommandDescription::impl_fillElements(const sal_Char* _pName)
{ {
m_xModuleManager.set( ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ) ); m_xModuleManager.set( ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ) );
Reference< XNameAccess > xNameAccess( m_xModuleManager, UNO_QUERY_THROW ); Sequence< rtl::OUString > aElementNames = m_xModuleManager->getElementNames();
Sequence< rtl::OUString > aElementNames = xNameAccess->getElementNames();
Sequence< PropertyValue > aSeq; Sequence< PropertyValue > aSeq;
::rtl::OUString aModuleIdentifier; ::rtl::OUString aModuleIdentifier;
for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ ) for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ )
{ {
aModuleIdentifier = aElementNames[i]; aModuleIdentifier = aElementNames[i];
if ( xNameAccess->getByName( aModuleIdentifier ) >>= aSeq ) if ( m_xModuleManager->getByName( aModuleIdentifier ) >>= aSeq )
{ {
::rtl::OUString aCommandStr; ::rtl::OUString aCommandStr;
for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ ) for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment