diff options
Diffstat (limited to 'framework/source/dispatch/menudispatcher.cxx')
-rw-r--r-- | framework/source/dispatch/menudispatcher.cxx | 252 |
1 files changed, 1 insertions, 251 deletions
diff --git a/framework/source/dispatch/menudispatcher.cxx b/framework/source/dispatch/menudispatcher.cxx index 717f2bb159..43c0da312d 100644 --- a/framework/source/dispatch/menudispatcher.cxx +++ b/framework/source/dispatch/menudispatcher.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: menudispatcher.cxx,v $ - * $Revision: 1.23 $ + * $Revision: 1.23.82.1 $ * * This file is part of OpenOffice.org. * @@ -161,219 +161,6 @@ DEFINE_XTYPEPROVIDER_4 ( MenuDispatcher , void SAL_CALL MenuDispatcher::dispatch( const URL& /*aURL*/ , const Sequence< PropertyValue >& /*seqProperties*/ ) throw( RuntimeException ) { - // PL: according to CD this is dead code - #if 0 - const char RESOURCE_URL[] = "private:resource/"; - const char ACCEL_PARAM[] = "?accel="; - - // Ready for multithreading - ResetableGuard aGuard( m_aLock ); - // Safe impossible cases - // Method not defined for all incoming parameter - LOG_ASSERT( impldbg_checkParameter_dispatch( aURL, seqProperties ), "MenuDispatcher::dispatch()\nInvalid parameter detected.\n" ) - - Reference< XFrame > xFrame( m_xOwnerWeak.get(), UNO_QUERY ); - LOG_ASSERT( !(xFrame.is()==sal_False), "MenuDispatcher::dispatch()\nDispatch failed ... can't get reference to owner!\n" ) - if( xFrame.is() == sal_True ) - { - OUString aResourceURLCommand( RTL_CONSTASCII_USTRINGPARAM( RESOURCE_URL )); - - if ( aURL.Complete.compareTo( aResourceURLCommand, aResourceURLCommand.getLength() ) == 0 ) - { - // check for the right url syntax - OUString aResourceString = aURL.Complete.copy( aResourceURLCommand.getLength() ); - - int nResIdIndex = aResourceString.indexOf( '/' ); - int nResAccIndex = aResourceString.indexOf( OUString( RTL_CONSTASCII_USTRINGPARAM( ACCEL_PARAM ))); - int nResId = 0; - MenuBar* pMenuBar = NULL; - ResMgr* pResManager = NULL; - ResMgr* pAccResManager= NULL; - ResMgr* pGlobalResMgr = NULL; - Accelerator* pAccel = NULL; - - aGuard.unlock(); - OGuard aSolarGuard( Application::GetSolarMutex() ); - { - // execute not thread safe VCL code - if ( nResIdIndex >= 0 ) - { - OUString aResourceFileName( aResourceString.copy( 0, nResIdIndex ) ); - pResManager = new ResMgr( aResourceFileName ); - } - - nResId = aResourceString.copy( nResIdIndex+1 ).toInt32(); - ResId aMenuBarResId( nResId, pResManager ); - aMenuBarResId.SetRT( RSC_MENU ); - - sal_Bool bAvailable = sal_False; - if (pResManager) - bAvailable = pResManager->IsAvailable(aMenuBarResId ); - else - { - pGlobalResMgr = Resource::GetResManager(); - if (!pGlobalResMgr) - { - LOG_WARNING("MenuDispatcher::dispatch()", "global res manager not set. break operation.") - return; - } - bAvailable = pGlobalResMgr->IsAvailable(aMenuBarResId ); - } - - if (bAvailable) - { - ResId* pAccResId = NULL; - - if (( nResAccIndex > 0 ) && (( nResAccIndex + sizeof( ACCEL_PARAM )) < aResourceString.getLength() )) - { - int index = nResAccIndex + sizeof( ACCEL_PARAM )-1; - OUString aAccResString = aResourceString.copy( index, aResourceString.getLength()-index ); - int nResIdIndex = aAccResString.indexOf( '/' )+1; - int nAccResId = 0; - - if ( nResIdIndex < aAccResString.getLength() ) - { - nAccResId = aAccResString.copy( nResIdIndex ).toInt32(); - aAccResString = aAccResString.copy( 0, nResIdIndex-1 ); - } - - if ( nAccResId > 0 && aAccResString.getLength() > 0 ) - { - pAccResManager = new ResMgr( aAccResString ); - if ( pAccResManager ) - { - pAccResId = new ResId( nAccResId, pAccResManager ); - pAccResId->SetRT( RSC_ACCEL ); - if ( !pAccResManager->IsAvailable( *pAccResId )) - { - delete pAccResId; - pAccResId = NULL; - } - } - } - } - - pMenuBar = new MenuBar( aMenuBarResId ); - pMenuBar->SetCloserHdl( LINK( this, MenuDispatcher, Close_Impl ) ); - - if ( pAccResId ) - { - pAccel = new Accelerator( *pAccResId ); - delete pAccResId; - } - } - - if (pResManager) - { - delete pResManager; - pResManager = NULL; - } - if (pAccResManager) - { - delete pAccResManager; - pAccResManager = NULL; - } - pGlobalResMgr = NULL; - } - - if ( pMenuBar ) - { - // set new menu bar if there is an old one delete it before! - if ( !impl_setMenuBar( pMenuBar, sal_True )) - { - delete pMenuBar; - } - else if ( pAccel ) - { - // set accelerators from resource - impl_setAccelerators( (Menu *)pMenuBar, *pAccel ); - delete pAccel; - } - } - } - else if ( aURL.Complete.compareToAscii( ".uno:load" ) == 0 ) - { -/* - aGuard.unlock(); - - // load menu from xml stream - Reference< ::com::sun::star::io::XInputStream > xInputStream; - int nPropertyCount = seqProperties.getLength(); - - for( int nProperty = 0; nProperty < nPropertyCount; ++nProperty ) - { - if( seqProperties[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream")) ) - seqProperties[nProperty].Value >>= xInputStream; - } - - MenuBar* pNewMenuBar = NULL; - - if ( xInputStream.is() ) - { - MenuConfiguration aMenuConfiguration( m_xFactory ); - - try - { - OGuard aSolarGuard( Application::GetSolarMutex() ); - { - pNewMenuBar = aMenuConfiguration.CreateMenuBarFromConfiguration( xInputStream ); - } - - if ( pNewMenuBar ) - impl_setMenuBar( pNewMenuBar ); - } - catch ( WrappedTargetException& ) - { - } - } - - impl_sendStatusEvent( xFrame, aURL.Complete, ( pNewMenuBar != 0 )); -*/ - } - else if ( aURL.Complete.compareToAscii( ".uno:save" ) == 0 ) - { -/* - // save menu to xml stream - int nPropertyCount = seqProperties.getLength(); - sal_Bool bStoreSuccessfull = sal_False; - Reference< ::com::sun::star::io::XOutputStream > xOutputStream; - - for( int nProperty = 0; nProperty < nPropertyCount; ++nProperty ) - { - if( seqProperties[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("OutputStream")) ) - seqProperties[nProperty].Value >>= xOutputStream; - } - - MenuConfiguration aMenuConfiguration( m_xFactory ); - MenuBar* pMenuBar = (MenuBar *)m_pMenuManager->GetMenu(); - aGuard.unlock(); - - if ( xOutputStream.is() && m_pMenuManager ) - { - OGuard aSolarGuard( Application::GetSolarMutex() ); - { - try - { - aMenuConfiguration.StoreMenuBar( pMenuBar, xOutputStream ); - bStoreSuccessfull = sal_True; - xOutputStream->flush(); - } - catch ( WrappedTargetException& ) - { - } - } - } - impl_sendStatusEvent( xFrame, aURL.Complete, bStoreSuccessfull ); -*/ - } - else if ( aURL.Complete.compareToAscii( ".uno:close" ) == 0 ) - { - // close menu - impl_setMenuBar( NULL ); - aGuard.unlock(); - } - } - #endif } //***************************************************************************************************************** @@ -486,43 +273,6 @@ void SAL_CALL MenuDispatcher::disposing( const EventObject& ) throw( RuntimeExce //***************************************************************************************************************** // private method -//***************************************************************************************************************** -void MenuDispatcher::impl_sendStatusEvent( const uno::Reference< XFrame >& xEventSource , - const OUString& sURL , - sal_Bool bLoadState ) -{ - // Get listener for given URL! - OInterfaceContainerHelper* pListenerForURL = m_aListenerContainer.getContainer( sURL ); - // Send messages to all listener. - // Do nothing, if there no listener or "getContainer()" works not correct! - if( pListenerForURL != NULL ) - { - // Build event for send to listener. - FeatureStateEvent aEvent; - aEvent.FeatureURL.Complete = sURL ; - aEvent.FeatureDescriptor = FEATUREDESCRIPTOR_LOADSTATE ; - aEvent.IsEnabled = bLoadState ; - aEvent.Requery = sal_False ; - aEvent.State <<= xEventSource ; - - // Send message to all listener on this URL. - OInterfaceIteratorHelper aIterator(*pListenerForURL); - while( aIterator.hasMoreElements() ) - { - try - { - ((XStatusListener*)aIterator.next())->statusChanged( aEvent ); - } - catch( RuntimeException& ) - { - aIterator.remove(); - } - } - } -} - -//***************************************************************************************************************** -// private method // // //***************************************************************************************************************** |