summaryrefslogtreecommitdiff
path: root/framework/source
diff options
context:
space:
mode:
authorAntonio Fernandez <antonio.fernandez@aentos.es>2012-07-30 13:11:09 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2012-11-14 13:52:39 +0100
commit818acaaa0d77e363c74112c435ab8bea425f34ae (patch)
tree9c204378f89a0951f8bf18284ffb1241c79114c5 /framework/source
parenta09c7f8e2b4d717bb488040ca096ee79c3e07609 (diff)
Menubar hierarchy fully generated. Native GTK menu is published on DBus.
Change-Id: I340d3e14b590b4a694082cfb3e2200d6ad8ef39a
Diffstat (limited to 'framework/source')
-rw-r--r--framework/source/uielement/menubarmanager.cxx29
-rw-r--r--framework/source/uielement/menubarwrapper.cxx20
2 files changed, 44 insertions, 5 deletions
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();
}
}
}