summaryrefslogtreecommitdiff
path: root/framework/source/uielement
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2006-12-13 14:08:40 +0000
committerKurt Zenker <kz@openoffice.org>2006-12-13 14:08:40 +0000
commitc9f36dbf17dc7270bc10df43b9baa7d9107f551a (patch)
tree4998aa6a8dc6c8f448b74ec194766a0d1f89e3a2 /framework/source/uielement
parente27509e48a4d1b252c9e17d627ae5d5becf8101d (diff)
INTEGRATION: CWS fwk54 (1.41.14); FILE MERGED
2006/11/10 14:11:17 cd 1.41.14.2: RESYNC: (1.41-1.44); FILE MERGED 2006/11/10 12:56:39 cd 1.41.14.1: #i65187# Extended base class and adapt popup menu controllers to be testtool compliant
Diffstat (limited to 'framework/source/uielement')
-rw-r--r--framework/source/uielement/menubarmanager.cxx69
1 files changed, 66 insertions, 3 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index d3ec656fc6e3..c1bae8cec3e0 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: menubarmanager.cxx,v $
*
- * $Revision: 1.44 $
+ * $Revision: 1.45 $
*
- * last change: $Author: kz $ $Date: 2006-11-07 14:43:52 $
+ * last change: $Author: kz $ $Date: 2006-12-13 15:08:40 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -878,7 +878,24 @@ void MenuBarManager::RemoveListener()
xEventListener->disposing( aEventObject );
}
- // Release references to destroy controller and popup menu
+ // We now provide a popup menu controller to external code.
+ // Therefore the life-time must be explicitly handled via
+ // dispose!!
+ try
+ {
+ Reference< XComponent > xComponent( pItemHandler->xPopupMenuController, UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ }
+
+ // Release references to controller and popup menu
pItemHandler->xPopupMenuController.clear();
pItemHandler->xPopupMenu.clear();
}
@@ -2204,6 +2221,52 @@ void MenuBarManager::SetItemContainer( const Reference< XIndexAccess >& rItemCon
}
}
+void MenuBarManager::GetPopupController( PopupControllerCache& rPopupController )
+{
+ String aPopupScheme = String::CreateFromAscii( "vnd.sun.star.popup:" );
+
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+
+ std::vector< MenuItemHandler* >::iterator p;
+ for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); p++ )
+ {
+ MenuItemHandler* pItemHandler = *p;
+ if ( pItemHandler->xPopupMenuController.is() )
+ {
+ Reference< XDispatchProvider > xDispatchProvider( pItemHandler->xPopupMenuController, UNO_QUERY );
+
+ PopupControllerEntry aPopupControllerEntry;
+ aPopupControllerEntry.m_xDispatchProvider = xDispatchProvider;
+
+ // Just use the main part of the URL for popup menu controllers
+ sal_Int32 nQueryPart( 0 );
+ sal_Int32 nSchemePart( 0 );
+ rtl::OUString aMainURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.popup:" ));
+ rtl::OUString aMenuURL( pItemHandler->aMenuItemURL );
+
+ nSchemePart = aMenuURL.indexOf( ':' );
+ if (( nSchemePart > 0 ) &&
+ ( aMenuURL.getLength() > ( nSchemePart+1 )))
+ {
+ nQueryPart = aMenuURL.indexOf( '?', nSchemePart );
+ if ( nQueryPart > 0 )
+ aMainURL += aMenuURL.copy( nSchemePart, nQueryPart-nSchemePart );
+ else if ( nQueryPart == -1 )
+ aMainURL += aMenuURL.copy( nSchemePart+1 );
+
+ rPopupController.insert( PopupControllerCache::value_type(
+ aMainURL, aPopupControllerEntry ));
+ }
+ }
+ if ( pItemHandler->xSubMenuManager.is() )
+ {
+ MenuBarManager* pMenuBarManager = (MenuBarManager*)(pItemHandler->xSubMenuManager.get());
+ if ( pMenuBarManager )
+ pMenuBarManager->GetPopupController( rPopupController );
+ }
+ }
+}
+
// #110897#
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& MenuBarManager::getServiceFactory()
{