diff options
author | Antonio Fernandez <antonio.fernandez@aentos.es> | 2012-07-30 13:11:09 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2012-11-14 13:52:39 +0100 |
commit | 818acaaa0d77e363c74112c435ab8bea425f34ae (patch) | |
tree | 9c204378f89a0951f8bf18284ffb1241c79114c5 /framework | |
parent | Added a "freeze" method to Menu. Menus are now displayed on console. (diff) | |
download | core-818acaaa0d77e363c74112c435ab8bea425f34ae.tar.gz core-818acaaa0d77e363c74112c435ab8bea425f34ae.zip |
Menubar hierarchy fully generated. Native GTK menu is published on DBus.
Change-Id: I340d3e14b590b4a694082cfb3e2200d6ad8ef39a
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/uielement/menubarmanager.hxx | 2 | ||||
-rw-r--r-- | framework/inc/uielement/menubarwrapper.hxx | 1 | ||||
-rw-r--r-- | framework/source/uielement/menubarmanager.cxx | 29 | ||||
-rw-r--r-- | framework/source/uielement/menubarwrapper.cxx | 20 |
4 files changed, 47 insertions, 5 deletions
diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx index 07f352bf3bad..10ca227885a6 100644 --- a/framework/inc/uielement/menubarmanager.hxx +++ b/framework/inc/uielement/menubarmanager.hxx @@ -170,6 +170,8 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener void SetItemContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rItemContainer ); void GetPopupController( PopupControllerCache& rPopupController ); + void GenerateFullMenuHierarchy( AbstractMenu* pMenu ); + protected: DECL_LINK(Highlight, void *); DECL_LINK( Activate, AbstractMenu * ); diff --git a/framework/inc/uielement/menubarwrapper.hxx b/framework/inc/uielement/menubarwrapper.hxx index 47bfcce26d02..10ef7991e651 100644 --- a/framework/inc/uielement/menubarwrapper.hxx +++ b/framework/inc/uielement/menubarwrapper.hxx @@ -76,6 +76,7 @@ class MenuBarWrapper : public UIConfigElementWrapperBase, private: virtual void impl_fillNewData(); void fillPopupControllerCache(); +// void GenerateFullMenuBar( MenuBar *pMenuBar ); sal_Bool m_bRefreshPopupControllerCache : 1; com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xMenuBarManager; diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 66a34671fae3..33912f35862e 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -885,8 +885,9 @@ IMPL_LINK( MenuBarManager, Activate, AbstractMenu *, pMenu ) ( pMenu->GetItemText( nItemId ).Len() == 0 )) { String aCommand = pMenu->GetItemCommand( nItemId ); - if ( aCommand.Len() > 0 ) + if ( aCommand.Len() > 0 ) { pMenu->SetItemText( nItemId, RetrieveLabelFromCommand( aCommand )); + } } } @@ -1026,6 +1027,9 @@ IMPL_LINK( MenuBarManager, Activate, AbstractMenu *, pMenu ) } } + // Freeze the menu +// m_pVCLMenu->Freeze(); + return 1; } @@ -2122,6 +2126,29 @@ void MenuBarManager::SetHdl() ::comphelper::getComponentContext(mxServiceFactory)) ); } +void MenuBarManager::GenerateFullMenuHierarchy( AbstractMenu* pMenu ) +{ + if (pMenu) { + for (int i=0; i < pMenu->GetItemCount(); i++) + { + sal_Int16 nId = pMenu->GetItemId( i ); + +// this->Activate( pMenu->GetPopupMenu( nId ) ); +// this->Activate(pMenu); +// this->Deactivate(pMenu); + + String aCommandLabel = pMenu->GetItemCommand( nId ); + ::rtl::OUString aCommand( aCommandLabel ); + + String label = RetrieveLabelFromCommand( aCommandLabel ); + pMenu->SetItemText( nId, label ); + + AddMenu( this, aCommand, nId ); + GenerateFullMenuHierarchy( pMenu->GetPopupMenu( nId ) ); + } + } +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx index 302ab7200412..b1f781d1fddf 100644 --- a/framework/source/uielement/menubarwrapper.cxx +++ b/framework/source/uielement/menubarwrapper.cxx @@ -121,6 +121,19 @@ void SAL_CALL MenuBarWrapper::dispose() throw (::com::sun::star::uno::RuntimeExc m_bDisposed = sal_True; } +//void generateFullMenuBar( MenuBarManager *pMenuBarManager, MenuBar *pMenuBar ) +//{ +// for (int i=0; i < pMenuBar->GetItemCount(); i++) +// { +// sal_Int16 nId = pMenuBar->GetItemId( i ); + +// String aCommandLabel = pMenuBar->GetItemCommand( nId ); + +// String label = pMenuBarManager->RetrieveLabelFromCommand( aCommandLabel ); +// pMenuBar->SetItemText( nId, label ); +// } +//} + // XInitialization void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) { @@ -167,7 +180,6 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th // Fill menubar with container contents sal_uInt16 nId = 1; MenuBarManager::FillMenuWithConfiguration( nId, pVCLMenuBar, aModuleIdentifier, m_xConfigData, xTrans ); -// pVCLMenuBar->Freeze(); } } catch ( const NoSuchElementException& ) @@ -203,15 +215,15 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th sal_True ); m_xMenuBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pMenuBarManager ), UNO_QUERY ); + +// pMenuBarManager->GenerateFullMenuHierarchy( pVCLMenuBar ); + pVCLMenuBar->Freeze(); } // Initialize toolkit menu bar implementation to have awt::XMenuBar for data exchange. // Don't use this toolkit menu bar or one of its functions. It is only used as a data container! pAwtMenuBar = new VCLXMenuBar( pVCLMenuBar ); m_xMenuBar = Reference< XMenuBar >( static_cast< OWeakObject *>( pAwtMenuBar ), UNO_QUERY ); - - // Freeze the menubar - pVCLMenuBar->Freeze(); } } } |