1*6d739b60SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*6d739b60SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*6d739b60SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*6d739b60SAndrew Rist * distributed with this work for additional information 6*6d739b60SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*6d739b60SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*6d739b60SAndrew Rist * "License"); you may not use this file except in compliance 9*6d739b60SAndrew Rist * with the License. You may obtain a copy of the License at 10*6d739b60SAndrew Rist * 11*6d739b60SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*6d739b60SAndrew Rist * 13*6d739b60SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*6d739b60SAndrew Rist * software distributed under the License is distributed on an 15*6d739b60SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*6d739b60SAndrew Rist * KIND, either express or implied. See the License for the 17*6d739b60SAndrew Rist * specific language governing permissions and limitations 18*6d739b60SAndrew Rist * under the License. 19*6d739b60SAndrew Rist * 20*6d739b60SAndrew Rist *************************************************************/ 21*6d739b60SAndrew Rist 22*6d739b60SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_framework.hxx" 26cdf0e10cSrcweir #include <uiconfiguration/moduleuicfgsupplier.hxx> 27cdf0e10cSrcweir #include <threadhelp/resetableguard.hxx> 28cdf0e10cSrcweir #include <services.h> 29cdf0e10cSrcweir 30cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 31cdf0e10cSrcweir // interface includes 32cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 33cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp> 34cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 35cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 36cdf0e10cSrcweir #include <com/sun/star/embed/ElementModes.hpp> 37cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp> 38cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp> 39cdf0e10cSrcweir #include <com/sun/star/io/XSeekable.hpp> 40cdf0e10cSrcweir #include <com/sun/star/embed/XPackageStructureCreator.hpp> 41cdf0e10cSrcweir 42cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 43cdf0e10cSrcweir // other includes 44cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 45cdf0e10cSrcweir #include <rtl/logfile.hxx> 46cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 47cdf0e10cSrcweir #include <vcl/svapp.hxx> 48cdf0e10cSrcweir 49cdf0e10cSrcweir using namespace com::sun::star::uno; 50cdf0e10cSrcweir using namespace com::sun::star::io; 51cdf0e10cSrcweir using namespace com::sun::star::lang; 52cdf0e10cSrcweir using namespace com::sun::star::container; 53cdf0e10cSrcweir using namespace com::sun::star::beans; 54cdf0e10cSrcweir using namespace com::sun::star::embed; 55cdf0e10cSrcweir using namespace ::com::sun::star::ui; 56cdf0e10cSrcweir using namespace ::com::sun::star::frame; 57cdf0e10cSrcweir 58cdf0e10cSrcweir namespace framework 59cdf0e10cSrcweir { 60cdf0e10cSrcweir 61cdf0e10cSrcweir class RootStorageWrapper : public ::cppu::WeakImplHelper1< com::sun::star::embed::XTransactedObject > 62cdf0e10cSrcweir { 63cdf0e10cSrcweir public: 64cdf0e10cSrcweir // XInterface, XTypeProvider 65cdf0e10cSrcweir RootStorageWrapper( const Reference< XTransactedObject >& xRootCommit ) : m_xRootCommit( xRootCommit ) {} 66cdf0e10cSrcweir virtual ~RootStorageWrapper() {} 67cdf0e10cSrcweir 68cdf0e10cSrcweir // XTransactedObject 69cdf0e10cSrcweir virtual void SAL_CALL commit() throw ( com::sun::star::io::IOException, com::sun::star::lang::WrappedTargetException ) 70cdf0e10cSrcweir { 71cdf0e10cSrcweir m_xRootCommit->commit(); 72cdf0e10cSrcweir } 73cdf0e10cSrcweir 74cdf0e10cSrcweir virtual void SAL_CALL revert() throw ( com::sun::star::io::IOException, com::sun::star::lang::WrappedTargetException ) 75cdf0e10cSrcweir { 76cdf0e10cSrcweir m_xRootCommit->revert(); 77cdf0e10cSrcweir } 78cdf0e10cSrcweir 79cdf0e10cSrcweir private: 80cdf0e10cSrcweir Reference< XTransactedObject > m_xRootCommit; 81cdf0e10cSrcweir }; 82cdf0e10cSrcweir 83cdf0e10cSrcweir //***************************************************************************************************************** 84cdf0e10cSrcweir // XInterface, XTypeProvider, XServiceInfo 85cdf0e10cSrcweir //***************************************************************************************************************** 86cdf0e10cSrcweir DEFINE_XINTERFACE_4 ( ModuleUIConfigurationManagerSupplier , 87cdf0e10cSrcweir OWeakObject , 88cdf0e10cSrcweir DIRECT_INTERFACE( css::lang::XTypeProvider ), 89cdf0e10cSrcweir DIRECT_INTERFACE( css::lang::XServiceInfo ), 90cdf0e10cSrcweir DIRECT_INTERFACE( css::lang::XComponent ), 91cdf0e10cSrcweir DIRECT_INTERFACE( ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier ) 92cdf0e10cSrcweir ) 93cdf0e10cSrcweir 94cdf0e10cSrcweir DEFINE_XTYPEPROVIDER_4 ( ModuleUIConfigurationManagerSupplier , 95cdf0e10cSrcweir css::lang::XTypeProvider , 96cdf0e10cSrcweir css::lang::XServiceInfo , 97cdf0e10cSrcweir css::lang::XComponent , 98cdf0e10cSrcweir ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier 99cdf0e10cSrcweir ) 100cdf0e10cSrcweir 101cdf0e10cSrcweir DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( ModuleUIConfigurationManagerSupplier , 102cdf0e10cSrcweir ::cppu::OWeakObject , 103cdf0e10cSrcweir SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER , 104cdf0e10cSrcweir IMPLEMENTATIONNAME_MODULEUICONFIGURATIONMANAGERSUPPLIER 105cdf0e10cSrcweir ) 106cdf0e10cSrcweir 107cdf0e10cSrcweir DEFINE_INIT_SERVICE ( ModuleUIConfigurationManagerSupplier, {} ) 108cdf0e10cSrcweir 109cdf0e10cSrcweir 110cdf0e10cSrcweir /*TODO_AS 111cdf0e10cSrcweir void ModuleUIConfigurationManagerSupplier::impl_initStorages() 112cdf0e10cSrcweir { 113cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManagerSupplier::impl_initStorages" ); 114cdf0e10cSrcweir if ( !m_bInit ) 115cdf0e10cSrcweir { 116cdf0e10cSrcweir RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::ModuleUIConfigurationManagerSupplier::impl_initStorages" ); 117cdf0e10cSrcweir 118cdf0e10cSrcweir rtl::OUString aFinalSlash( RTL_CONSTASCII_USTRINGPARAM( "/" )); 119cdf0e10cSrcweir rtl::OUString aConfigRootFolder( RTL_CONSTASCII_USTRINGPARAM( "soffice.cfg/modules" )); 120cdf0e10cSrcweir rtl::OUString aConfigSubFolder( RTL_CONSTASCII_USTRINGPARAM( "soffice.cfg/modules/soffice.cfg" )); 121cdf0e10cSrcweir rtl::OUString aConfigRootFolder( RTL_CONSTASCII_USTRINGPARAM( "soffice.cfg" )); 122cdf0e10cSrcweir rtl::OUString aConfigSubFolder( RTL_CONSTASCII_USTRINGPARAM( "soffice.cfg/soffice.cfg" )); 123cdf0e10cSrcweir rtl::OUString aConfigFileName( RTL_CONSTASCII_USTRINGPARAM( "soffice.cfg/uiconfig.zip" )); 124cdf0e10cSrcweir 125cdf0e10cSrcweir Reference< XPropertySet > xPathSettings( m_xServiceManager->createInstance( 126cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.PathSettings" ))), 127cdf0e10cSrcweir UNO_QUERY_THROW ); 128cdf0e10cSrcweir 129cdf0e10cSrcweir Any a = xPathSettings->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UIConfig" ))); 130cdf0e10cSrcweir a >>= m_aDefaultConfigURL; 131cdf0e10cSrcweir a = xPathSettings->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserConfig" ))); 132cdf0e10cSrcweir a >>= m_aUserConfigURL; 133cdf0e10cSrcweir 134cdf0e10cSrcweir // Use only the first entry from "UIConfig" 135cdf0e10cSrcweir sal_Int32 nIndex = m_aDefaultConfigURL.indexOf( ';' ); 136cdf0e10cSrcweir if ( nIndex > 0 ) 137cdf0e10cSrcweir m_aDefaultConfigURL = m_aDefaultConfigURL.copy( 0, nIndex ); 138cdf0e10cSrcweir 139cdf0e10cSrcweir rtl::OUString aDefaultConfigFolderURL( m_aDefaultConfigURL ); 140cdf0e10cSrcweir 141cdf0e10cSrcweir nIndex = m_aDefaultConfigURL.lastIndexOf( '/' ); 142cdf0e10cSrcweir if (( nIndex > 0 ) && ( nIndex != ( m_aDefaultConfigURL.getLength()-1 ))) 143cdf0e10cSrcweir { 144cdf0e10cSrcweir m_aDefaultConfigURL += aFinalSlash; 145cdf0e10cSrcweir aDefaultConfigFolderURL += aFinalSlash; 146cdf0e10cSrcweir } 147cdf0e10cSrcweir 148cdf0e10cSrcweir nIndex = m_aUserConfigURL.lastIndexOf( '/' ); 149cdf0e10cSrcweir if (( nIndex > 0 ) && ( nIndex != ( m_aUserConfigURL.getLength()-1 ))) 150cdf0e10cSrcweir m_aUserConfigURL += aFinalSlash; 151cdf0e10cSrcweir 152cdf0e10cSrcweir // aDefaultConfigFolderURL += aConfigRootFolder; 153cdf0e10cSrcweir 154cdf0e10cSrcweir // Create root storages for user interface configuration data (default and customizable) 155cdf0e10cSrcweir Reference< XSingleServiceFactory > xStorageFactory( m_xServiceManager->createInstance( 156cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.StorageFactory" ))), 157cdf0e10cSrcweir UNO_QUERY_THROW ); 158cdf0e10cSrcweir 159cdf0e10cSrcweir Sequence< Any > aArgs( 2 ); 160cdf0e10cSrcweir 161cdf0e10cSrcweir // Default root storage (READ-ACCESS) 162cdf0e10cSrcweir aArgs[0] <<= m_aDefaultConfigURL + aConfigFileName; //aConfigSubFolder; 163cdf0e10cSrcweir aArgs[1] <<= ElementModes::READ; 164cdf0e10cSrcweir m_xDefaultCfgRootStorage = Reference< XStorage >( xStorageFactory->createInstanceWithArguments( aArgs ), UNO_QUERY_THROW ); 165cdf0e10cSrcweir 166cdf0e10cSrcweir Reference < XOutputStream > xTempOut( m_xServiceManager->createInstance ( 167cdf0e10cSrcweir ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ), 168cdf0e10cSrcweir UNO_QUERY ); 169cdf0e10cSrcweir 170cdf0e10cSrcweir Reference< XPackageStructureCreator > xPackageStructCreator( m_xServiceManager->createInstance( 171cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.PackageStructureCreator" ))), 172cdf0e10cSrcweir UNO_QUERY_THROW ); 173cdf0e10cSrcweir 174cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ convertToPackage" ); 175cdf0e10cSrcweir xPackageStructCreator->convertToPackage( aDefaultConfigFolderURL, xTempOut ); 176cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_TRACE( aLog, "} convertToPackage" ); 177cdf0e10cSrcweir 178cdf0e10cSrcweir xTempOut->closeOutput(); 179cdf0e10cSrcweir Reference< XInputStream > xTempIn( xTempOut, UNO_QUERY ); 180cdf0e10cSrcweir Reference< XSeekable > xTempSeek( xTempOut, UNO_QUERY ); 181cdf0e10cSrcweir 182cdf0e10cSrcweir // Default root storage (READ-ACCESS) 183cdf0e10cSrcweir xTempSeek->seek( 0 ); 184cdf0e10cSrcweir 185cdf0e10cSrcweir aArgs[0] <<= xTempIn; 186cdf0e10cSrcweir aArgs[1] <<= ElementModes::READ; 187cdf0e10cSrcweir m_xDefaultCfgRootStorage = Reference< XStorage >( xStorageFactory->createInstanceWithArguments( aArgs ), UNO_QUERY_THROW ); 188cdf0e10cSrcweir 189cdf0e10cSrcweir // Customizable root storage (READWRITE-ACCESS) 190cdf0e10cSrcweir aArgs[0] <<= m_aUserConfigURL + aConfigSubFolder; 191cdf0e10cSrcweir aArgs[1] <<= ElementModes::READWRITE; 192cdf0e10cSrcweir m_xUserCfgRootStorage = Reference< XStorage >( xStorageFactory->createInstanceWithArguments( aArgs ), UNO_QUERY ); 193cdf0e10cSrcweir 194cdf0e10cSrcweir // Create wrapper object for module user interface configuration managers, so they are able to call commit/revert on 195cdf0e10cSrcweir // root storage and nothing more (saftey)! 196cdf0e10cSrcweir RootStorageWrapper* pUserRootStorageWrapper = new RootStorageWrapper( Reference< XTransactedObject >( m_xUserCfgRootStorage, UNO_QUERY )); 197cdf0e10cSrcweir m_xUserRootCommit = Reference< XTransactedObject>( static_cast< OWeakObject *>( pUserRootStorageWrapper ), UNO_QUERY ); 198cdf0e10cSrcweir } 199cdf0e10cSrcweir 200cdf0e10cSrcweir m_bInit = true; 201cdf0e10cSrcweir } 202cdf0e10cSrcweir */ 203cdf0e10cSrcweir 204cdf0e10cSrcweir 205cdf0e10cSrcweir ModuleUIConfigurationManagerSupplier::ModuleUIConfigurationManagerSupplier( const Reference< XMultiServiceFactory >& xServiceManager ) : 206cdf0e10cSrcweir ThreadHelpBase( &Application::GetSolarMutex() ) 207cdf0e10cSrcweir , m_bDisposed( false ) 208cdf0e10cSrcweir //TODO_AS , m_bInit( false ) 209cdf0e10cSrcweir , m_xModuleMgr( Reference< XModuleManager >( xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY )) 210cdf0e10cSrcweir , m_xServiceManager( xServiceManager ) 211cdf0e10cSrcweir , m_aListenerContainer( m_aLock.getShareableOslMutex() ) 212cdf0e10cSrcweir { 213cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManagerSupplier::ModuleUIConfigurationManagerSupplier" ); 214cdf0e10cSrcweir // Retrieve known modules and insert them into our hash_map to speed-up access time. 215cdf0e10cSrcweir Reference< XNameAccess > xNameAccess( m_xModuleMgr, UNO_QUERY ); 216cdf0e10cSrcweir const Sequence< ::rtl::OUString > aNameSeq = xNameAccess->getElementNames(); 217cdf0e10cSrcweir const ::rtl::OUString* pNameSeq = aNameSeq.getConstArray(); 218cdf0e10cSrcweir for ( sal_Int32 n = 0; n < aNameSeq.getLength(); n++ ) 219cdf0e10cSrcweir m_aModuleToModuleUICfgMgrMap.insert( ModuleToModuleCfgMgr::value_type( pNameSeq[n], Reference< XUIConfigurationManager >() )); 220cdf0e10cSrcweir } 221cdf0e10cSrcweir 222cdf0e10cSrcweir ModuleUIConfigurationManagerSupplier::~ModuleUIConfigurationManagerSupplier() 223cdf0e10cSrcweir { 224cdf0e10cSrcweir m_xUserRootCommit.clear(); 225cdf0e10cSrcweir 226cdf0e10cSrcweir // dispose all our module user interface configuration managers 227cdf0e10cSrcweir ModuleToModuleCfgMgr::iterator pIter = m_aModuleToModuleUICfgMgrMap.begin(); 228cdf0e10cSrcweir while ( pIter != m_aModuleToModuleUICfgMgrMap.end() ) 229cdf0e10cSrcweir { 230cdf0e10cSrcweir Reference< XComponent > xComponent( pIter->second, UNO_QUERY ); 231cdf0e10cSrcweir if ( xComponent.is() ) 232cdf0e10cSrcweir xComponent->dispose(); 233cdf0e10cSrcweir ++pIter; 234cdf0e10cSrcweir } 235cdf0e10cSrcweir /*TODO_AS 236cdf0e10cSrcweir // Dispose our root configuration storages 237cdf0e10cSrcweir if ( m_xDefaultCfgRootStorage.is() ) 238cdf0e10cSrcweir { 239cdf0e10cSrcweir Reference< XComponent > xComponent( m_xDefaultCfgRootStorage, UNO_QUERY ); 240cdf0e10cSrcweir xComponent->dispose(); 241cdf0e10cSrcweir } 242cdf0e10cSrcweir 243cdf0e10cSrcweir if ( m_xUserCfgRootStorage.is() ) 244cdf0e10cSrcweir { 245cdf0e10cSrcweir Reference< XComponent > xComponent( m_xUserCfgRootStorage, UNO_QUERY ); 246cdf0e10cSrcweir xComponent->dispose(); 247cdf0e10cSrcweir } 248cdf0e10cSrcweir */ 249cdf0e10cSrcweir } 250cdf0e10cSrcweir 251cdf0e10cSrcweir // XComponent 252cdf0e10cSrcweir void SAL_CALL ModuleUIConfigurationManagerSupplier::dispose() 253cdf0e10cSrcweir throw ( RuntimeException ) 254cdf0e10cSrcweir { 255cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManagerSupplier::dispose" ); 256cdf0e10cSrcweir Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); 257cdf0e10cSrcweir 258cdf0e10cSrcweir css::lang::EventObject aEvent( xThis ); 259cdf0e10cSrcweir m_aListenerContainer.disposeAndClear( aEvent ); 260cdf0e10cSrcweir 261cdf0e10cSrcweir { 262cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 263cdf0e10cSrcweir m_bDisposed = true; 264cdf0e10cSrcweir } 265cdf0e10cSrcweir } 266cdf0e10cSrcweir 267cdf0e10cSrcweir void SAL_CALL ModuleUIConfigurationManagerSupplier::addEventListener( const Reference< XEventListener >& xListener ) 268cdf0e10cSrcweir throw ( RuntimeException ) 269cdf0e10cSrcweir { 270cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManagerSupplier::addEventListener" ); 271cdf0e10cSrcweir { 272cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 273cdf0e10cSrcweir 274cdf0e10cSrcweir /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 275cdf0e10cSrcweir if ( m_bDisposed ) 276cdf0e10cSrcweir throw DisposedException(); 277cdf0e10cSrcweir } 278cdf0e10cSrcweir 279cdf0e10cSrcweir m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener ); 280cdf0e10cSrcweir } 281cdf0e10cSrcweir 282cdf0e10cSrcweir void SAL_CALL ModuleUIConfigurationManagerSupplier::removeEventListener( const Reference< XEventListener >& xListener ) 283cdf0e10cSrcweir throw ( RuntimeException ) 284cdf0e10cSrcweir { 285cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManagerSupplier::removeEventListener" ); 286cdf0e10cSrcweir /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 287cdf0e10cSrcweir m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener ); 288cdf0e10cSrcweir } 289cdf0e10cSrcweir 290cdf0e10cSrcweir // XModuleUIConfigurationManagerSupplier 291cdf0e10cSrcweir Reference< XUIConfigurationManager > SAL_CALL ModuleUIConfigurationManagerSupplier::getUIConfigurationManager( const ::rtl::OUString& ModuleIdentifier ) 292cdf0e10cSrcweir throw ( NoSuchElementException, RuntimeException) 293cdf0e10cSrcweir { 294cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManagerSupplier::getUIConfigurationManager" ); 295cdf0e10cSrcweir ResetableGuard aGuard( m_aLock ); 296cdf0e10cSrcweir 297cdf0e10cSrcweir /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 298cdf0e10cSrcweir if ( m_bDisposed ) 299cdf0e10cSrcweir throw DisposedException(); 300cdf0e10cSrcweir 301cdf0e10cSrcweir ModuleToModuleCfgMgr::iterator pIter = m_aModuleToModuleUICfgMgrMap.find( ModuleIdentifier ); 302cdf0e10cSrcweir if ( pIter == m_aModuleToModuleUICfgMgrMap.end() ) 303cdf0e10cSrcweir throw NoSuchElementException(); 304cdf0e10cSrcweir //TODO_AS impl_initStorages(); 305cdf0e10cSrcweir 306cdf0e10cSrcweir // Create instance on demand 307cdf0e10cSrcweir if ( !pIter->second.is() ) 308cdf0e10cSrcweir { 309cdf0e10cSrcweir /*TODO_AS 310cdf0e10cSrcweir Reference< XStorage > xDefaultConfigModuleStorage; 311cdf0e10cSrcweir Reference< XStorage > xUserConfigModuleStorage; 312cdf0e10cSrcweir 313cdf0e10cSrcweir try 314cdf0e10cSrcweir { 315cdf0e10cSrcweir xDefaultConfigModuleStorage = Reference< XStorage >( m_xDefaultCfgRootStorage->openStorageElement( 316cdf0e10cSrcweir sShort, ElementModes::READ ), UNO_QUERY_THROW ); 317cdf0e10cSrcweir 318cdf0e10cSrcweir if ( m_xUserCfgRootStorage.is() ) 319cdf0e10cSrcweir { 320cdf0e10cSrcweir try 321cdf0e10cSrcweir { 322cdf0e10cSrcweir xUserConfigModuleStorage = Reference< XStorage >( m_xUserCfgRootStorage->openStorageElement( 323cdf0e10cSrcweir sShort, ElementModes::READWRITE ), UNO_QUERY ); 324cdf0e10cSrcweir } 325cdf0e10cSrcweir catch( ::com::sun::star::io::IOException& ) 326cdf0e10cSrcweir { 327cdf0e10cSrcweir try 328cdf0e10cSrcweir { 329cdf0e10cSrcweir xUserConfigModuleStorage = Reference< XStorage >( m_xUserCfgRootStorage->openStorageElement( 330cdf0e10cSrcweir sShort, ElementModes::READ ), UNO_QUERY ); 331cdf0e10cSrcweir } 332cdf0e10cSrcweir catch( com::sun::star::uno::Exception& ) 333cdf0e10cSrcweir { 334cdf0e10cSrcweir } 335cdf0e10cSrcweir } 336cdf0e10cSrcweir } 337cdf0e10cSrcweir } 338cdf0e10cSrcweir catch ( com::sun::star::uno::Exception& ) 339cdf0e10cSrcweir { 340cdf0e10cSrcweir } 341cdf0e10cSrcweir PropertyValue aArg; 342cdf0e10cSrcweir Sequence< Any > aArgs( 5 ); 343cdf0e10cSrcweir aArg.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" )); 344cdf0e10cSrcweir aArg.Value <<= ModuleIdentifier; 345cdf0e10cSrcweir aArgs[0] <<= aArg; 346cdf0e10cSrcweir aArg.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultConfigStorage" )); 347cdf0e10cSrcweir aArg.Value <<= xDefaultConfigModuleStorage; 348cdf0e10cSrcweir aArgs[1] <<= aArg; 349cdf0e10cSrcweir aArg.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserConfigStorage" )); 350cdf0e10cSrcweir aArg.Value <<= xUserConfigModuleStorage; 351cdf0e10cSrcweir aArgs[2] <<= aArg; 352cdf0e10cSrcweir aArg.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserRootCommit" )); 353cdf0e10cSrcweir aArg.Value <<= m_xUserRootCommit; 354cdf0e10cSrcweir aArgs[3] <<= aArg; 355cdf0e10cSrcweir */ 356cdf0e10cSrcweir ::rtl::OUString sShort; 357cdf0e10cSrcweir try 358cdf0e10cSrcweir { 359cdf0e10cSrcweir Sequence< PropertyValue > lProps; 360cdf0e10cSrcweir Reference< XNameAccess > xCont(m_xModuleMgr, UNO_QUERY); 361cdf0e10cSrcweir xCont->getByName(ModuleIdentifier) >>= lProps; 362cdf0e10cSrcweir for (sal_Int32 i=0; i<lProps.getLength(); ++i) 363cdf0e10cSrcweir { 364cdf0e10cSrcweir if (lProps[i].Name.equalsAscii("ooSetupFactoryShortName")) 365cdf0e10cSrcweir { 366cdf0e10cSrcweir lProps[i].Value >>= sShort; 367cdf0e10cSrcweir break; 368cdf0e10cSrcweir } 369cdf0e10cSrcweir } 370cdf0e10cSrcweir } 371cdf0e10cSrcweir catch( Exception& ) 372cdf0e10cSrcweir { 373cdf0e10cSrcweir sShort = ::rtl::OUString(); 374cdf0e10cSrcweir } 375cdf0e10cSrcweir 376cdf0e10cSrcweir if (!sShort.getLength()) 377cdf0e10cSrcweir throw NoSuchElementException(); 378cdf0e10cSrcweir PropertyValue aArg; 379cdf0e10cSrcweir Sequence< Any > aArgs( 2 ); 380cdf0e10cSrcweir aArg.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleShortName" )); 381cdf0e10cSrcweir aArg.Value <<= sShort; 382cdf0e10cSrcweir aArgs[0] <<= aArg; 383cdf0e10cSrcweir aArg.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" )); 384cdf0e10cSrcweir aArg.Value <<= ModuleIdentifier; 385cdf0e10cSrcweir aArgs[1] <<= aArg; 386cdf0e10cSrcweir 387cdf0e10cSrcweir pIter->second.set( m_xServiceManager->createInstanceWithArguments(SERVICENAME_MODULEUICONFIGURATIONMANAGER, aArgs ),UNO_QUERY ); 388cdf0e10cSrcweir } 389cdf0e10cSrcweir 390cdf0e10cSrcweir return pIter->second; 391cdf0e10cSrcweir } 392cdf0e10cSrcweir 393cdf0e10cSrcweir } // namespace framework 394cdf0e10cSrcweir 395