diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-06-24 15:54:04 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-06-24 15:54:04 +0000 |
commit | 29bf88a63131eb789307585707c5e3e1b245cf09 (patch) | |
tree | 554bc2affcc6b8b24194645078024638f09dba51 /framework | |
parent | 52e97c22a488c11497f9a73eb4c5c9f0044c1717 (diff) |
INTEGRATION: CWS obo30 (1.14.40); FILE MERGED
2008/06/06 06:06:45 obo 1.14.40.2: #i90100# EOL missing
2008/05/29 14:43:43 obo 1.14.40.1: #i90100# ambigous Reference during ENABLE_PCH build
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/classes/addonmenu.cxx | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/framework/source/classes/addonmenu.cxx b/framework/source/classes/addonmenu.cxx index c413943e18..aac8ba9489 100644 --- a/framework/source/classes/addonmenu.cxx +++ b/framework/source/classes/addonmenu.cxx @@ -1,13 +1,13 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: addonmenu.cxx,v $ - * $Revision: 1.14 $ + * $Revision: 1.15 $ * * This file is part of OpenOffice.org. * @@ -60,7 +60,6 @@ // namespace //_________________________________________________________________________________________________________________ -using namespace ::rtl; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::frame; @@ -99,7 +98,7 @@ AddonMenu::~AddonMenu() // ------------------------------------------------------------------------ // Check if command URL string has the unique prefix to identify addon popup menus -sal_Bool AddonPopupMenu::IsCommandURLPrefix( const OUString& aCmdURL ) +sal_Bool AddonPopupMenu::IsCommandURLPrefix( const ::rtl::OUString& aCmdURL ) { const char aPrefixCharBuf[] = ADDONSPOPUPMENU_URL_PREFIX_STR; @@ -137,7 +136,7 @@ static Reference< XModel > GetModelFromFrame( const Reference< XFrame >& rFrame Reference< XController > xController( rFrame->getController(), UNO_QUERY ); if ( xController.is() ) xModel = xController->getModel(); - } + } return xModel; } @@ -153,7 +152,7 @@ sal_Bool AddonMenuManager::HasAddonHelpMenuElements() { return AddonsOptions().HasAddonsHelpMenu(); } - + // Factory method to create different Add-On menu types PopupMenu* AddonMenuManager::CreatePopupMenuType( MenuType eMenuType, const Reference< XFrame >& rFrame ) { @@ -171,14 +170,14 @@ AddonMenu* AddonMenuManager::CreateAddonMenu( const Reference< XFrame >& rFrame AddonsOptions aOptions; AddonMenu* pAddonMenu = NULL; USHORT nUniqueMenuId = ADDONMENU_ITEMID_START; - + const Sequence< Sequence< PropertyValue > >& rAddonMenuEntries = aOptions.GetAddonsMenu(); if ( rAddonMenuEntries.getLength() > 0 ) { pAddonMenu = (AddonMenu *)AddonMenuManager::CreatePopupMenuType( ADDON_MENU, rFrame ); Reference< XModel > xModel = GetModelFromFrame( rFrame ); AddonMenuManager::BuildMenu( pAddonMenu, ADDON_MENU, MENU_APPEND, nUniqueMenuId, rAddonMenuEntries, rFrame, xModel ); - + // Don't return an empty Add-On menu if ( pAddonMenu->GetItemCount() == 0 ) { @@ -186,10 +185,10 @@ AddonMenu* AddonMenuManager::CreateAddonMenu( const Reference< XFrame >& rFrame pAddonMenu = NULL; } } - + return pAddonMenu; } - + // Returns the next insert position from nPos. USHORT AddonMenuManager::GetNextPos( USHORT nPos ) { @@ -230,7 +229,7 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me { static const char REFERENCECOMMAND_AFTER[] = ".uno:OnlineRegistrationDlg"; static const char REFERENCECOMMAND_BEFORE[] = ".uno:About"; - + // Add-Ons help menu items should be inserted after the "registration" menu item bool bAddAfter = true; USHORT nItemCount = pHelpMenu->GetItemCount(); @@ -250,7 +249,7 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me if ( nRegPos == USHRT_MAX ) { - // second try: + // second try: // try to detect the about menu item with the command URL USHORT nId = FindMenuId( pHelpMenu, String::CreateFromAscii( REFERENCECOMMAND_BEFORE )); nRegPos = pHelpMenu->GetItemPos( nId ); @@ -260,14 +259,14 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me Sequence< Sequence< PropertyValue > > aAddonSubMenu; const Sequence< Sequence< PropertyValue > >& rAddonHelpMenuEntries = aOptions.GetAddonsHelpMenu(); - + nInsPos = bAddAfter ? AddonMenuManager::GetNextPos( nInsPos ) : nInsPos; if ( nInsPos < nItemCount && pHelpMenu->GetItemType( nInsPos ) != MENUITEM_SEPARATOR ) nInsSepAfterPos = nInsPos; - + Reference< XModel > xModel = GetModelFromFrame( rFrame ); AddonMenuManager::BuildMenu( pHelpMenu, ADDON_MENU, nInsPos, nUniqueMenuId, rAddonHelpMenuEntries, rFrame, xModel ); - + if ( pHelpMenu->GetItemCount() > nItemCount ) { if ( nInsSepAfterPos < MENU_APPEND ) @@ -280,7 +279,7 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me pHelpMenu->InsertSeparator( nRegPos+1 ); else pHelpMenu->InsertSeparator( nItemCount ); - } + } } } } @@ -296,19 +295,19 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame, AddonsOptions aAddonsOptions; USHORT nInsertPos = nMergeAtPos; - OUString aTitle; - OUString aURL; - OUString aTarget; - OUString aImageId; - OUString aContext; + ::rtl::OUString aTitle; + ::rtl::OUString aURL; + ::rtl::OUString aTarget; + ::rtl::OUString aImageId; + ::rtl::OUString aContext; Sequence< Sequence< PropertyValue > > aAddonSubMenu; USHORT nUniqueMenuId = ADDONMENU_ITEMID_START; const Sequence< Sequence< PropertyValue > >& rAddonMenuEntries = aAddonsOptions.GetAddonsMenuBarPart(); for ( sal_Int32 i = 0; i < rAddonMenuEntries.getLength(); i++ ) { - AddonMenuManager::GetMenuEntry( rAddonMenuEntries[i], - aTitle, + AddonMenuManager::GetMenuEntry( rAddonMenuEntries[i], + aTitle, aURL, aTarget, aImageId, @@ -321,15 +320,15 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame, { USHORT nId = nUniqueMenuId++; AddonPopupMenu* pAddonPopupMenu = (AddonPopupMenu *)AddonMenuManager::CreatePopupMenuType( ADDON_POPUPMENU, rFrame ); - + AddonMenuManager::BuildMenu( pAddonPopupMenu, ADDON_MENU, MENU_APPEND, nUniqueMenuId, aAddonSubMenu, rFrame, rModel ); - + if ( pAddonPopupMenu->GetItemCount() > 0 ) { pAddonPopupMenu->SetCommandURL( aURL ); pMergeMenuBar->InsertItem( nId, aTitle, 0, nInsertPos++ ); pMergeMenuBar->SetPopupMenu( nId, pAddonPopupMenu ); - + // Store the command URL into the VCL menu bar for later identification pMergeMenuBar->SetItemCommand( nId, aURL ); } @@ -339,13 +338,13 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame, } } } - + // Insert the menu and sub menu entries into pCurrentMenu with the aAddonMenuDefinition provided void AddonMenuManager::BuildMenu( PopupMenu* pCurrentMenu, MenuType nSubMenuType, USHORT nInsPos, USHORT& nUniqueMenuId, - Sequence< Sequence< PropertyValue > > aAddonMenuDefinition, + Sequence< Sequence< PropertyValue > > aAddonMenuDefinition, const Reference< XFrame >& rFrame, const Reference< XModel >& rModel ) { @@ -355,7 +354,7 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent UINT32 nElements = 0; UINT32 nCount = aAddonMenuDefinition.getLength(); AddonsOptions aAddonsOptions; - + ::rtl::OUString aTitle; ::rtl::OUString aURL; ::rtl::OUString aTarget; @@ -378,7 +377,7 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent { pSubMenu = AddonMenuManager::CreatePopupMenuType( nSubMenuType, rFrame ); AddonMenuManager::BuildMenu( pSubMenu, nSubMenuType, MENU_APPEND, nUniqueMenuId, aAddonSubMenu, rFrame, rModel ); - + // Don't create a menu item for an empty sub menu if ( pSubMenu->GetItemCount() == 0 ) { @@ -401,14 +400,14 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent USHORT nId = nUniqueMenuId++; pCurrentMenu->InsertItem( nId, aTitle, 0, nInsPos ); nInsPos = AddonMenuManager::GetNextPos( nInsPos ); - + ++nElements; // Store values from configuration to the New and Wizard menu entries to enable // sfx2 based code to support high contrast mode correctly! pCurrentMenu->SetUserValue( nId, ULONG( new MenuConfiguration::Attributes( aTarget, aImageId )) ); pCurrentMenu->SetItemCommand( nId, aURL ); - + if ( pSubMenu ) pCurrentMenu->SetPopupMenu( nId, pSubMenu ); } @@ -417,19 +416,19 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent // Retrieve the menu entry property values from a sequence void AddonMenuManager::GetMenuEntry( const Sequence< PropertyValue >& rAddonMenuEntry, - OUString& rTitle, - OUString& rURL, - OUString& rTarget, - OUString& rImageId, - OUString& rContext, + ::rtl::OUString& rTitle, + ::rtl::OUString& rURL, + ::rtl::OUString& rTarget, + ::rtl::OUString& rImageId, + ::rtl::OUString& rContext, Sequence< Sequence< PropertyValue > >& rAddonSubMenu ) { // Reset submenu parameter rAddonSubMenu = Sequence< Sequence< PropertyValue > >(); - + for ( int i = 0; i < rAddonMenuEntry.getLength(); i++ ) { - OUString aMenuEntryPropName = rAddonMenuEntry[i].Name; + ::rtl::OUString aMenuEntryPropName = rAddonMenuEntry[i].Name; if ( aMenuEntryPropName == ADDONSMENUITEM_PROPERTYNAME_URL ) rAddonMenuEntry[i].Value >>= rURL; else if ( aMenuEntryPropName == ADDONSMENUITEM_PROPERTYNAME_TITLE ) @@ -446,7 +445,7 @@ void AddonMenuManager::GetMenuEntry( const Sequence< PropertyValue >& rAddonMenu } // Check if the context string matches the provided xModel context -sal_Bool AddonMenuManager::IsCorrectContext( const Reference< XModel >& rModel, const OUString& aContext ) +sal_Bool AddonMenuManager::IsCorrectContext( const Reference< XModel >& rModel, const ::rtl::OUString& aContext ) { if ( rModel.is() ) { @@ -456,16 +455,17 @@ sal_Bool AddonMenuManager::IsCorrectContext( const Reference< XModel >& rModel, sal_Int32 nIndex = 0; do { - OUString aToken = aContext.getToken( 0, ',', nIndex ); - + ::rtl::OUString aToken = aContext.getToken( 0, ',', nIndex ); + if ( xServiceInfo->supportsService( aToken )) return sal_True; } while ( nIndex >= 0 ); } } - + return ( aContext.getLength() == 0 ); } } + |