diff options
author | Mathias Bauer <mba@openoffice.org> | 2010-07-10 18:21:24 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2010-07-10 18:21:24 +0200 |
commit | f24b1da07ebfbc95e76af93fc9c7133f7d52daa5 (patch) | |
tree | 1d666fcdca0e60613c321b05a1371ab53fdb6e88 /framework | |
parent | f8a801d058e39e89a71c85afdb0b1c1718f36b45 (diff) |
CWS changehid: #i111874#: change code to support HelpIds as byte strings
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/helpid.hrc | 16 | ||||
-rw-r--r-- | framework/inc/uielement/commandinfo.hxx | 2 | ||||
-rw-r--r-- | framework/inc/uielement/toolbarmerger.hxx | 1 | ||||
-rw-r--r-- | framework/inc/uielement/toolbarsmenucontroller.hxx | 2 | ||||
-rw-r--r-- | framework/source/services/backingcomp.cxx | 3 | ||||
-rw-r--r-- | framework/source/services/menudocumenthandler.cxx | 903 | ||||
-rw-r--r-- | framework/source/uielement/macrosmenucontroller.cxx | 9 | ||||
-rw-r--r-- | framework/source/uielement/menubarmanager.cxx | 5 | ||||
-rw-r--r-- | framework/source/uielement/statusbarmanager.cxx | 11 | ||||
-rw-r--r-- | framework/source/uielement/statusbarwrapper.cxx | 3 | ||||
-rw-r--r-- | framework/source/uielement/toolbarmanager.cxx | 13 | ||||
-rw-r--r-- | framework/source/uielement/toolbarmerger.cxx | 12 | ||||
-rw-r--r-- | framework/source/uielement/toolbarsmenucontroller.cxx | 18 |
13 files changed, 32 insertions, 966 deletions
diff --git a/framework/inc/helpid.hrc b/framework/inc/helpid.hrc index f40d5fcaaa2d..3f9068e65d26 100644 --- a/framework/inc/helpid.hrc +++ b/framework/inc/helpid.hrc @@ -33,17 +33,11 @@ // Help-Ids ----------------------------------------------------------------- -#define HID_BACKINGWINDOW (HID_FRAMEWORK_START + 0) -#define HID_LICENSEDIALOG (HID_FRAMEWORK_START + 1) -#define HID_STATUSBAR (HID_FRAMEWORK_START + 2) - -#define ACT_FRAMEWORK_HID_END HID_BACKINGWINDOW - -// "Uberlaufpr"ufung -------------------------------------------------------- - -#if ACT_FRAMEWORK_HID_END > HID_FRAMEWORK_END -#error Resource-Ueberlauf in #line, #file -#endif +#define HID_BACKINGWINDOW "FWK_HID_BACKINGWINDOW" +#define HID_LICENSEDIALOG "FWK_HID_LICENSEDIALOG" +#define HID_STATUSBAR "FWK_HID_STATUSBAR" +#define HID_SVX_COMMON_MACRO_ORGANIZER "FWK_HID_SVX_COMMON_MACRO_ORGANIZER" +#define HID_SVX_BASIC_MACRO_ORGANIZER "FWK_HID_SVX_BASIC_MACRO_ORGANIZER" #endif // #ifndef _FRAMEWORK_HELPID_HRC diff --git a/framework/inc/uielement/commandinfo.hxx b/framework/inc/uielement/commandinfo.hxx index d33ab0d7baad..5b9822af86e6 100644 --- a/framework/inc/uielement/commandinfo.hxx +++ b/framework/inc/uielement/commandinfo.hxx @@ -47,11 +47,13 @@ namespace framework struct CommandInfo { CommandInfo() : nId( 0 ), + nWidth( 0 ), nImageInfo( 0 ), bMirrored( false ), bRotated( false ) {} USHORT nId; + sal_uInt32 nWidth; ::std::vector< USHORT > aIds; sal_Int16 nImageInfo; sal_Bool bMirrored : 1, diff --git a/framework/inc/uielement/toolbarmerger.hxx b/framework/inc/uielement/toolbarmerger.hxx index 8016bbb620b8..12301f170f26 100644 --- a/framework/inc/uielement/toolbarmerger.hxx +++ b/framework/inc/uielement/toolbarmerger.hxx @@ -145,6 +145,7 @@ class ToolBarMerger const ::rtl::OUString& rControlType ); static void CreateToolbarItem( ToolBox* pToolbox, + CommandToInfoMap& rCommandMap, sal_uInt16 nPos, sal_uInt16 nItemId, const AddonToolbarItem& rAddonToolbarItem ); diff --git a/framework/inc/uielement/toolbarsmenucontroller.hxx b/framework/inc/uielement/toolbarsmenucontroller.hxx index dcb0b57182df..5ffc014d1771 100644 --- a/framework/inc/uielement/toolbarsmenucontroller.hxx +++ b/framework/inc/uielement/toolbarsmenucontroller.hxx @@ -102,7 +102,7 @@ namespace framework ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > getLayoutManagerToolbars( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& rLayoutManager ); rtl::OUString getUINameFromCommand( const rtl::OUString& rCommandURL ); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > getDispatchFromCommandURL( const rtl::OUString& rCommandURL ); - void addCommand( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu, const rtl::OUString& rCommandURL, USHORT nHelpId, const rtl::OUString& aLabel ); + void addCommand( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu, const rtl::OUString& rCommandURL, const rtl::OString& sHelpId, const rtl::OUString& aLabel ); sal_Bool isContextSensitiveToolbarNonVisible(); ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState; diff --git a/framework/source/services/backingcomp.cxx b/framework/source/services/backingcomp.cxx index c8cf5249dd9a..13c5647341e6 100644 --- a/framework/source/services/backingcomp.cxx +++ b/framework/source/services/backingcomp.cxx @@ -528,8 +528,7 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f } // set help ID for our canvas - // FIXME: HELPID - pWindow->SetHelpId(""/*HID_BACKINGWINDOW*/); + pWindow->SetHelpId(HID_BACKINGWINDOW); // inform BackingWindow about frame BackingWindow* pBack = dynamic_cast<BackingWindow*>(pWindow ); diff --git a/framework/source/services/menudocumenthandler.cxx b/framework/source/services/menudocumenthandler.cxx deleted file mode 100644 index 8741fff39320..000000000000 --- a/framework/source/services/menudocumenthandler.cxx +++ /dev/null @@ -1,903 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -#include <stdio.h> -#include <services/menudocumenthandler.hxx> -#include <classes/menuconfiguration.hxx> -#include <classes/addonmenu.hxx> - -#ifndef __FRAMEWORK_SERVICES_ATTRIBUTELIST_HXX_ -#include <services/attributelist.hxx> -#endif - -#ifndef __COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HPP_ -#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> -#endif - - -using namespace ::rtl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::xml::sax; - -const int ITEMID_START_VALUE = 1000; - -#define XMLNS_MENU "http://openoffice.org/2001/menu" -#define XMLNS_PREFIX "menu:" - -#define ELEMENT_MENUBAR "http://openoffice.org/2001/menu^menubar" -#define ELEMENT_MENU "http://openoffice.org/2001/menu^menu" -#define ELEMENT_MENUPOPUP "http://openoffice.org/2001/menu^menupopup" -#define ELEMENT_MENUITEM "http://openoffice.org/2001/menu^menuitem" -#define ELEMENT_MENUSEPARATOR "http://openoffice.org/2001/menu^menuseparator" - -#define ELEMENT_NS_MENUBAR "menu:menubar" -#define ELEMENT_NS_MENU "menu:menu" -#define ELEMENT_NS_MENUPOPUP "menu:menupopup" -#define ELEMENT_NS_MENUITEM "menu:menuitem" -#define ELEMENT_NS_MENUSEPARATOR "menu:menuseparator" - -#define ATTRIBUTE_ID "http://openoffice.org/2001/menu^id" -#define ATTRIBUTE_LABEL "http://openoffice.org/2001/menu^label" -#define ATTRIBUTE_HELPID "http://openoffice.org/2001/menu^helpid" -#define ATTRIBUTE_LINEBREAK "http://openoffice.org/2001/menu^linebreak" - -#define ATTRIBUTE_NS_ID "menu:id" -#define ATTRIBUTE_NS_LABEL "menu:label" -#define ATTRIBUTE_NS_HELPID "menu:helpid" -#define ATTRIBUTE_NS_LINEBREAK "menu:linebreak" - -#define ATTRIBUTE_XMLNS_MENU "xmlns:menu" - -#define ATTRIBUTE_TYPE_CDATA "CDATA" - -#define MENUBAR_DOCTYPE "<!DOCTYPE menu:menubar PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"menubar.dtd\">" - - -// special popup menus (filled during runtime) must be saved as a menuitem!!! -// same as in menumanager.cxx - you have to change both files!!! -#define SID_SFX_START 5000 -#define SID_NEWDOCDIRECT (SID_SFX_START + 537) -#define SID_AUTOPILOTMENU (SID_SFX_START + 1381) -#define SID_FORMATMENU (SID_SFX_START + 780) - -const ::rtl::OUString aSlotProtocol( RTL_CONSTASCII_USTRINGPARAM( "slot:" )); -const ::rtl::OUString aSlotNewDocDirect( RTL_CONSTASCII_USTRINGPARAM( "slot:5537" )); -const ::rtl::OUString aSlotAutoPilot( RTL_CONSTASCII_USTRINGPARAM( "slot:6381" )); - -const ::rtl::OUString aSpecialFileMenu( RTL_CONSTASCII_USTRINGPARAM( "file" )); -const ::rtl::OUString aSpecialWindowMenu( RTL_CONSTASCII_USTRINGPARAM( "window" )); - -const ULONG MENU_SAVE_LABEL = 0x00000001; - -namespace framework -{ - -// ----------------------------------------------------------------------------- -// Base class implementation - -ReadMenuDocumentHandlerBase::ReadMenuDocumentHandlerBase() : - m_xLocator( 0 ), - m_xReader( 0 ) -{ -} - -ReadMenuDocumentHandlerBase::~ReadMenuDocumentHandlerBase() -{ -} - -Any SAL_CALL ReadMenuDocumentHandlerBase::queryInterface( - const Type & rType ) -throw( RuntimeException ) -{ - Any a = ::cppu::queryInterface( - rType , - SAL_STATIC_CAST( XDocumentHandler*, this )); - if ( a.hasValue() ) - return a; - - return OWeakObject::queryInterface( rType ); -} - -void SAL_CALL ReadMenuDocumentHandlerBase::ignorableWhitespace( - const OUString& aWhitespaces ) -throw( SAXException, RuntimeException ) -{ -} - -void SAL_CALL ReadMenuDocumentHandlerBase::processingInstruction( - const OUString& aTarget, const OUString& aData ) -throw( SAXException, RuntimeException ) -{ -} - -void SAL_CALL ReadMenuDocumentHandlerBase::setDocumentLocator( - const Reference< XLocator > &xLocator) -throw( SAXException, RuntimeException ) -{ - m_xLocator = xLocator; -} - -::rtl::OUString ReadMenuDocumentHandlerBase::getErrorLineString() -{ - char buffer[32]; - - if ( m_xLocator.is() ) - { - snprintf( buffer, sizeof(buffer), "Line: %ld - ", static_cast<long>( m_xLocator->getLineNumber() )); - return OUString::createFromAscii( buffer ); - } - else - return OUString(); -} - -// ----------------------------------------------------------------------------- - -// #110897# -OReadMenuDocumentHandler::OReadMenuDocumentHandler( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, - MenuBar* pMenuBar ) -: // #110897# - mxServiceFactory(xServiceFactory), - m_pMenuBar( pMenuBar ), - m_nElementDepth( 0 ), - m_bMenuBarMode( sal_False ), - m_nItemId( ITEMID_START_VALUE ) -{ -} - -// #110897# -const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& OReadMenuDocumentHandler::getServiceFactory() -{ - // #110897# - return mxServiceFactory; -} - -OReadMenuDocumentHandler::~OReadMenuDocumentHandler() -{ -} - - -void SAL_CALL OReadMenuDocumentHandler::startDocument(void) - throw ( SAXException, RuntimeException ) -{ -} - - -void SAL_CALL OReadMenuDocumentHandler::endDocument(void) - throw( SAXException, RuntimeException ) -{ - if ( m_nElementDepth > 0 ) - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "A closing element is missing!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } -} - - -void SAL_CALL OReadMenuDocumentHandler::startElement( - const OUString& aName, const Reference< XAttributeList > &xAttrList ) -throw( SAXException, RuntimeException ) -{ - if ( m_bMenuBarMode ) - { - ++m_nElementDepth; - m_xReader->startElement( aName, xAttrList ); - } - else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_MENUBAR ))) - { - ++m_nElementDepth; - m_bMenuBarMode = sal_True; - - // #110897# m_xReader = Reference< XDocumentHandler >( new OReadMenuBarHandler( m_pMenuBar, &m_nItemId )); - m_xReader = Reference< XDocumentHandler >( new OReadMenuBarHandler( getServiceFactory(), m_pMenuBar, &m_nItemId )); - - m_xReader->startDocument(); - } -} - - -void SAL_CALL OReadMenuDocumentHandler::characters(const rtl::OUString& aChars) -throw( SAXException, RuntimeException ) -{ -} - - -void SAL_CALL OReadMenuDocumentHandler::endElement( const OUString& aName ) - throw( SAXException, RuntimeException ) -{ - if ( m_bMenuBarMode ) - { - --m_nElementDepth; - m_xReader->endElement( aName ); - if ( 0 == m_nElementDepth ) - { - m_xReader->endDocument(); - m_xReader = Reference< XDocumentHandler >(); - m_bMenuBarMode = sal_False; - if ( !aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_MENUBAR ))) - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "closing element menubar expected!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } - } - } -} - - -// ----------------------------------------------------------------------------- - - -// #110897# -OReadMenuBarHandler::OReadMenuBarHandler( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, - MenuBar* pMenuBar, USHORT* pItemId ) -: // #110897# - mxServiceFactory( xServiceFactory ), - m_pMenuBar( pMenuBar ), - m_nElementDepth( 0 ), - m_bMenuMode( sal_False ), - m_pItemId( pItemId ) -{ -} - -// #110897# -const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& OReadMenuBarHandler::getServiceFactory() -{ - // #110897# - return mxServiceFactory; -} - -OReadMenuBarHandler::~OReadMenuBarHandler() -{ -} - - -void SAL_CALL OReadMenuBarHandler::startDocument(void) - throw ( SAXException, RuntimeException ) -{ -} - - -void SAL_CALL OReadMenuBarHandler::endDocument(void) - throw( SAXException, RuntimeException ) -{ -} - - -void SAL_CALL OReadMenuBarHandler::startElement( - const OUString& aName, const Reference< XAttributeList > &xAttrList ) -throw( SAXException, RuntimeException ) -{ - if ( m_bMenuMode ) - { - ++m_nElementDepth; - m_xReader->startElement( aName, xAttrList ); - } - else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_MENU ))) - { - ++m_nElementDepth; - - ULONG nHelpId = 0; - OUString aCommandId; - OUString aLabel; - - m_bMenuMode = sal_True; - PopupMenu* pMenu = new PopupMenu(); - - // read attributes for menu - for ( int i=0; i< xAttrList->getLength(); i++ ) - { - OUString aName = xAttrList->getNameByIndex( i ); - OUString aValue = xAttrList->getValueByIndex( i ); - if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ID ))) - aCommandId = aValue; - else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_LABEL ))) - aLabel = aValue; - else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_HELPID ))) - nHelpId = aValue.toInt32(); - } - - if ( aCommandId.getLength() > 0 ) - { - USHORT nItemId; - if ( aCommandId.compareTo( aSlotProtocol, aSlotProtocol.getLength() ) == 0 ) - nItemId = (USHORT) aCommandId.copy( aSlotProtocol.getLength() ).toInt32(); - else - nItemId = ++(*m_pItemId); - - m_pMenuBar->InsertItem( nItemId, String() ); - m_pMenuBar->SetPopupMenu( nItemId, pMenu ); - m_pMenuBar->SetItemCommand( nItemId, aCommandId ); - if ( nHelpId > 0 ) - m_pMenuBar->SetHelpId( nItemId, nHelpId ); - if ( aLabel.getLength() > 0 ) - { - m_pMenuBar->SetItemText( nItemId, aLabel ); - m_pMenuBar->SetUserValue( nItemId, MENU_SAVE_LABEL ); - } - else - { - m_pMenuBar->SetUserValue( nItemId, 0 ); - } - } - else - { - delete pMenu; - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "attribute id for element menu required!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } - - m_xReader = Reference< XDocumentHandler >( new OReadMenuHandler( pMenu, m_pItemId )); - m_xReader->startDocument(); - } - else - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "element menu expected!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } -} - - -void SAL_CALL OReadMenuBarHandler::characters(const rtl::OUString& aChars) -throw( SAXException, RuntimeException ) -{ -} - - -void OReadMenuBarHandler::endElement( const OUString& aName ) - throw( SAXException, RuntimeException ) -{ - if ( m_bMenuMode ) - { - --m_nElementDepth; - if ( 0 == m_nElementDepth ) - { - m_xReader->endDocument(); - m_xReader = Reference< XDocumentHandler >(); - m_bMenuMode = sal_False; - if ( !aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_MENU ))) - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "closing element menu expected!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } - } - else - m_xReader->endElement( aName ); - } -} - - -// ----------------------------------------------------------------------------- - - -OReadMenuHandler::OReadMenuHandler( Menu* pMenu, USHORT* pItemId ) : - m_pMenu( pMenu ), - m_nElementDepth( 0 ), - m_bMenuPopupMode( sal_False ), - m_pItemId( pItemId ) -{ -} - - -OReadMenuHandler::~OReadMenuHandler() -{ -} - - -void SAL_CALL OReadMenuHandler::startDocument(void) - throw ( SAXException, RuntimeException ) -{ -} - - -void SAL_CALL OReadMenuHandler::endDocument(void) - throw( SAXException, RuntimeException) -{ -} - - -void SAL_CALL OReadMenuHandler::startElement( - const OUString& aName, const Reference< XAttributeList > &xAttrList ) -throw( SAXException, RuntimeException ) -{ - if ( m_bMenuPopupMode ) - { - ++m_nElementDepth; - m_xReader->startElement( aName, xAttrList ); - } - else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_MENUPOPUP ))) - { - ++m_nElementDepth; - m_bMenuPopupMode = sal_True; - m_xReader = Reference< XDocumentHandler >( new OReadMenuPopupHandler( m_pMenu, m_pItemId )); - m_xReader->startDocument(); - } - else - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "unknown element found!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } -} - - -void SAL_CALL OReadMenuHandler::characters(const rtl::OUString& aChars) -throw( SAXException, RuntimeException ) -{ -} - - -void SAL_CALL OReadMenuHandler::endElement( const OUString& aName ) - throw( SAXException, RuntimeException ) -{ - if ( m_bMenuPopupMode ) - { - --m_nElementDepth; - if ( 0 == m_nElementDepth ) - { - m_xReader->endDocument(); - m_xReader = Reference< XDocumentHandler >(); - m_bMenuPopupMode = sal_False; - if ( !aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_MENUPOPUP ))) - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "closing element menupopup expected!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } - } - else - m_xReader->endElement( aName ); - } -} - - -// ----------------------------------------------------------------------------- - - -OReadMenuPopupHandler::OReadMenuPopupHandler( Menu* pMenu, USHORT* pItemId ) : - m_pMenu( pMenu ), - m_nElementDepth( 0 ), - m_bMenuMode( sal_False ), - m_pItemId( pItemId ), - m_nNextElementExpected( ELEM_CLOSE_NONE ) -{ -} - - -OReadMenuPopupHandler::~OReadMenuPopupHandler() -{ -} - - -void SAL_CALL OReadMenuPopupHandler::startDocument(void) - throw ( SAXException, RuntimeException ) -{ -} - - -void SAL_CALL OReadMenuPopupHandler::endDocument(void) - throw( SAXException, RuntimeException) -{ -} - - -void SAL_CALL OReadMenuPopupHandler::startElement( - const OUString& aName, const Reference< XAttributeList > &xAttrList ) -throw( SAXException, RuntimeException ) -{ - ++m_nElementDepth; - - if ( m_bMenuMode ) - m_xReader->startElement( aName, xAttrList ); - else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_MENU ))) - { - ULONG nHelpId = 0; - OUString aCommandId; - OUString aLabel; - - m_bMenuMode = sal_True; - PopupMenu* pMenu = new PopupMenu(); - - // read attributes for menu - for ( int i=0; i< xAttrList->getLength(); i++ ) - { - OUString aName = xAttrList->getNameByIndex( i ); - OUString aValue = xAttrList->getValueByIndex( i ); - if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ID ))) - aCommandId = aValue; - else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_LABEL ))) - aLabel = aValue; - else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_HELPID ))) - nHelpId = aValue.toInt32(); - } - - if ( aCommandId.getLength() > 0 ) - { - USHORT nItemId; - if ( aCommandId.compareTo( aSlotProtocol, aSlotProtocol.getLength() ) == 0 ) - nItemId = (USHORT) aCommandId.copy( aSlotProtocol.getLength() ).toInt32(); - else - nItemId = ++(*m_pItemId); - - m_pMenu->InsertItem( nItemId, String() ); - m_pMenu->SetPopupMenu( nItemId, pMenu ); - m_pMenu->SetItemCommand( nItemId, aCommandId ); - if ( nHelpId > 0 ) - m_pMenu->SetHelpId( nItemId, nHelpId ); - if ( aLabel.getLength() > 0 ) - { - m_pMenu->SetItemText( nItemId, aLabel ); - m_pMenu->SetUserValue( nItemId, MENU_SAVE_LABEL ); - } - else - { - m_pMenu->SetUserValue( nItemId, 0 ); - } - } - else - { - delete pMenu; - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "attribute id for element menu required!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } - - m_xReader = Reference< XDocumentHandler >( new OReadMenuHandler( pMenu, m_pItemId )); - m_xReader->startDocument(); - } - else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_MENUITEM ))) - { - ULONG nHelpId = 0; - OUString aCommandId; - OUString aLabel; - - // read attributes for menu item - for ( int i=0; i< xAttrList->getLength(); i++ ) - { - OUString aName = xAttrList->getNameByIndex( i ); - OUString aValue = xAttrList->getValueByIndex( i ); - if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_ID ))) - aCommandId = aValue; - else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_LABEL ))) - aLabel = aValue; - else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_HELPID ))) - nHelpId = aValue.toInt32(); - } - - if ( aCommandId.getLength() > 0 ) - { - USHORT nItemId; - if ( aCommandId.compareTo( aSlotProtocol, aSlotProtocol.getLength() ) == 0 ) - nItemId = (USHORT) aCommandId.copy( aSlotProtocol.getLength() ).toInt32(); - else - nItemId = ++(*m_pItemId); - - m_pMenu->InsertItem( nItemId, String() ); - m_pMenu->SetItemCommand( nItemId, aCommandId ); - if ( nHelpId > 0 ) - m_pMenu->SetHelpId( nItemId, nHelpId ); - if ( aLabel.getLength() > 0 ) - { - m_pMenu->SetItemText( nItemId, aLabel ); - m_pMenu->SetUserValue( nItemId, MENU_SAVE_LABEL ); - } - else - { - m_pMenu->SetUserValue( nItemId, 0 ); - } - } - - m_nNextElementExpected = ELEM_CLOSE_MENUITEM; - } - else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_MENUSEPARATOR ))) - { - m_pMenu->InsertSeparator(); - m_nNextElementExpected = ELEM_CLOSE_MENUSEPARATOR; - } - else - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "unknown element found!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } -} - - -void SAL_CALL OReadMenuPopupHandler::characters(const rtl::OUString& aChars) -throw( SAXException, RuntimeException ) -{ -} - - -void SAL_CALL OReadMenuPopupHandler::endElement( const OUString& aName ) - throw( SAXException, RuntimeException ) -{ - --m_nElementDepth; - if ( m_bMenuMode ) - { - if ( 0 == m_nElementDepth ) - { - m_xReader->endDocument(); - m_xReader = Reference< XDocumentHandler >(); - m_bMenuMode = sal_False; - if ( !aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_MENU ))) - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "closing element menu expected!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } - } - else - m_xReader->endElement( aName ); - } - else - { - if ( m_nNextElementExpected == ELEM_CLOSE_MENUITEM ) - { - if ( !aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_MENUITEM ))) - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "closing element menuitem expected!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } - } - else if ( m_nNextElementExpected == ELEM_CLOSE_MENUSEPARATOR ) - { - if ( !aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_MENUSEPARATOR ))) - { - OUString aErrorMessage = getErrorLineString(); - aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "closing element menuseparator expected!" )); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); - } - } - - m_nNextElementExpected = ELEM_CLOSE_NONE; - } -} - - -// --------------------------------- Write XML --------------------------------- - - -OWriteMenuDocumentHandler::OWriteMenuDocumentHandler( MenuBar* pMenu, Reference< XDocumentHandler > rxWriteDocumentHandler ) : - m_pMenuBar( pMenu ), - m_xWriteDocumentHandler( rxWriteDocumentHandler ) -{ - m_xEmptyList = Reference< XAttributeList >( (XAttributeList *)new AttributeListImpl, UNO_QUERY ); - m_aAttributeType = OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_TYPE_CDATA )); -} - - -OWriteMenuDocumentHandler::~OWriteMenuDocumentHandler() -{ -} - - -void OWriteMenuDocumentHandler::WriteMenuDocument() -throw ( SAXException, RuntimeException ) -{ - AttributeListImpl* pList = new AttributeListImpl; - Reference< XAttributeList > rList( (XAttributeList *) pList , UNO_QUERY ); - - m_xWriteDocumentHandler->startDocument(); - - // write DOCTYPE line! - Reference< XExtendedDocumentHandler > xExtendedDocHandler( m_xWriteDocumentHandler, UNO_QUERY ); - if ( xExtendedDocHandler.is() ) - { - xExtendedDocHandler->unknown( OUString( RTL_CONSTASCII_USTRINGPARAM( MENUBAR_DOCTYPE )) ); - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - } - - pList->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_XMLNS_MENU )), - m_aAttributeType, - OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_MENU )) ); - - pList->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_NS_ID )), - m_aAttributeType, - OUString( RTL_CONSTASCII_USTRINGPARAM( "menubar" )) ); - - m_xWriteDocumentHandler->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_MENUBAR )), pList ); - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - - WriteMenu( m_pMenuBar ); - - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_MENUBAR )) ); - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->endDocument(); -} - - -void OWriteMenuDocumentHandler::WriteMenu( Menu* pMenu ) -throw ( SAXException, RuntimeException ) -{ - USHORT nItemCount = pMenu->GetItemCount(); - BOOL bSeparator = FALSE; - - for ( USHORT nItemPos = 0; nItemPos < nItemCount; nItemPos++ ) - { - USHORT nItemId = pMenu->GetItemId( nItemPos ); - - PopupMenu* pPopupMenu = pMenu->GetPopupMenu( nItemId ); - if ( pPopupMenu ) - { - OUString aItemCommand = pMenu->GetItemCommand( nItemId ); - - if ( nItemId == SID_NEWDOCDIRECT || - nItemId == SID_AUTOPILOTMENU ) - { - // special popup menus (filled during runtime) must be saved as a menuitem!!! - WriteMenuItem( pMenu, nItemId ); - bSeparator = FALSE; - } - else if ( nItemId == SID_FORMATMENU ) - { - // special popup menu - must be written as empty popup! - AttributeListImpl* pListMenu = new AttributeListImpl; - Reference< XAttributeList > xListMenu( (XAttributeList *)pListMenu , UNO_QUERY ); - - String aCommand( pMenu->GetItemCommand( nItemId ) ); - if ( !aCommand.Len() ) - { - aCommand = String::CreateFromAscii("slot:"); - aCommand += String::CreateFromInt32( nItemId ); - } - - pListMenu->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_NS_ID )), - m_aAttributeType, - aCommand ); - -// if ( pMenu->GetUserValue( nItemId ) & MENU_SAVE_LABEL ) - pListMenu->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_NS_LABEL )), - m_aAttributeType, - pMenu->GetItemText( nItemId ) ); - - m_xWriteDocumentHandler->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_MENU )), xListMenu ); - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_MENUPOPUP )), m_xEmptyList ); - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_MENUPOPUP )) ); - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_MENU )) ); - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - bSeparator = FALSE; - } - else if ( !AddonPopupMenu::IsCommandURLPrefix ( aItemCommand )) - { - AttributeListImpl* pListMenu = new AttributeListImpl; - Reference< XAttributeList > xListMenu( (XAttributeList *)pListMenu , UNO_QUERY ); - - String aCommand( pMenu->GetItemCommand( nItemId ) ); - if ( !aCommand.Len() ) - { - aCommand = String::CreateFromAscii("slot:"); - aCommand += String::CreateFromInt32( nItemId ); - } - - pListMenu->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_NS_ID )), - m_aAttributeType, - aCommand ); - -// if ( pMenu->GetUserValue( nItemId ) & MENU_SAVE_LABEL ) - pListMenu->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_NS_LABEL )), - m_aAttributeType, - pMenu->GetItemText( nItemId ) ); - - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_MENU )), xListMenu ); - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_MENUPOPUP )), m_xEmptyList ); - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - - WriteMenu( pPopupMenu ); - - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_MENUPOPUP )) ); - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_MENU )) ); - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - bSeparator = FALSE; - } - } - else - { - if ( pMenu->GetItemType( nItemPos ) != MENUITEM_SEPARATOR ) - { - // don't save special menu items for (window list and pickup list, add-ons ) - if ( !MenuConfiguration::IsPickListItemId( nItemId ) && - !MenuConfiguration::IsWindowListItemId( nItemId ) && - !AddonMenuManager::IsAddonMenuId( nItemId )) - { - bSeparator = FALSE; - WriteMenuItem( pMenu, nItemId ); - } - } - else if ( !bSeparator ) - { - // Don't write two separators together - WriteMenuSeparator(); - bSeparator = TRUE; - } - } - } -} - - -void OWriteMenuDocumentHandler::WriteMenuItem( Menu* pMenu, USHORT nItemId ) -{ - AttributeListImpl* pList = new AttributeListImpl; - Reference< XAttributeList > xList( (XAttributeList *) pList , UNO_QUERY ); - - String aCommand( pMenu->GetItemCommand( nItemId ) ); - if ( !aCommand.Len() ) - { - aCommand = String::CreateFromAscii("slot:"); - aCommand += String::CreateFromInt32( nItemId ); - } - - pList->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_NS_ID )), - m_aAttributeType, - aCommand ); - - ULONG nHelpId = pMenu->GetHelpId( nItemId ); - if ( nHelpId > 0 ) - { - pList->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_NS_HELPID )), - m_aAttributeType, - OUString::valueOf( sal_Int64( nHelpId )) ); - } - -// if ( pMenu->GetUserValue( nItemId ) & MENU_SAVE_LABEL ) - pList->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_NS_LABEL )), - m_aAttributeType, - pMenu->GetItemText( nItemId )); - - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_MENUITEM )), xList ); - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_MENUITEM )) ); -} - - -void OWriteMenuDocumentHandler::WriteMenuSeparator() -{ - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_MENUSEPARATOR )), m_xEmptyList ); - m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - m_xWriteDocumentHandler->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_MENUSEPARATOR )) ); -} - -} // namespace framework diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx index 7be1516f1331..34579e903d6a 100644 --- a/framework/source/uielement/macrosmenucontroller.cxx +++ b/framework/source/uielement/macrosmenucontroller.cxx @@ -48,6 +48,7 @@ #include <rtl/ustrbuf.hxx> #include <dispatch/uieventloghelper.hxx> #include "helper/mischelper.hxx" +#include "helpid.hrc" using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -97,9 +98,7 @@ void MacrosMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPo String aDisplayName = RetrieveLabelFromCommand( aCommand ); pPopupMenu->InsertItem( 2, aDisplayName ); pPopupMenu->SetItemCommand( 2, aCommand ); - //pPopupMenu->SetHelpId( 2, HID_SVX_BASIC_MACRO_ORGANIZER ); - // FIXME: HELPID - pPopupMenu->SetHelpId( 2, ""/*40012*/ ); + pPopupMenu->SetHelpId( 2, ".uno:MacroDialog" ); // insert providers but not basic or java addScriptItems( pPopupMenu, 4); @@ -219,9 +218,7 @@ void MacrosMenuController::addScriptItems( PopupMenu* pPopupMenu, USHORT startIt aDisplayName.Append( ellipsis ); pPopupMenu->InsertItem( itemId, aDisplayName ); pPopupMenu->SetItemCommand( itemId, aCommand ); - //pPopupMenu->SetHelpId( itemId, HID_SVX_COMMON_MACRO_ORGANIZER ); - // FIXME: HELPID - pPopupMenu->SetHelpId( itemId, ""/*40014*/ ); + pPopupMenu->SetHelpId( itemId, rtl::OString( aCommand.GetBuffer(), aCommand.Len(), RTL_TEXTENCODING_UTF8 ) ); itemId++; break; } diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 0a3295c1395e..58c1c8782f9e 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -1795,11 +1795,6 @@ void MenuBarManager::FillMenu( pMenu->InsertItem( nId, aLabel ); pMenu->SetItemCommand( nId, aCommandURL ); - sal_Int32 nHelpId = aHelpURL.toInt32(); - if ( nHelpId > 0 ) - // FIXME: HELPID - // (should set aHelpURL ? - pMenu->SetHelpId( nId, ""/*(USHORT)nHelpId*/ ); if ( nStyle ) { MenuItemBits nBits = pMenu->GetItemBits( nId ); diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx index d143b717366c..553026827524 100644 --- a/framework/source/uielement/statusbarmanager.cxx +++ b/framework/source/uielement/statusbarmanager.cxx @@ -530,17 +530,6 @@ void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAcc m_pStatusBar->InsertItem( nId, nWidth, nItemBits, nOffset ); m_pStatusBar->SetItemCommand( nId, aCommandURL ); m_pStatusBar->SetAccessibleName( nId, aString ); -// m_pStatusBar->SetHelpText( nId, aString ); - - if ( aHelpURL.indexOf( aHelpIdPrefix ) == 0 ) - { - rtl::OUString aId( aHelpURL.copy( HELPID_PREFIX_LENGTH )); - sal_uInt16 nHelpId = (sal_uInt16)(aId.toInt32()); - if ( nHelpId > 0 ) - // FIXME: HELPID - m_pStatusBar->SetHelpId( nId, ""/*nHelpId*/ ); - } - ++nId; } } diff --git a/framework/source/uielement/statusbarwrapper.cxx b/framework/source/uielement/statusbarwrapper.cxx index ed506f5345e3..030a790b35e3 100644 --- a/framework/source/uielement/statusbarwrapper.cxx +++ b/framework/source/uielement/statusbarwrapper.cxx @@ -137,8 +137,7 @@ void SAL_CALL StatusBarWrapper::initialize( const Sequence< Any >& aArguments ) pStatusBarManager = new StatusBarManager( m_xServiceFactory, xFrame, m_aResourceURL, pStatusBar ); ((FrameworkStatusBar*)pStatusBar)->SetStatusBarManager( pStatusBarManager ); m_xStatusBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pStatusBarManager ), UNO_QUERY ); - // FIXME: HELPID - pStatusBar->SetUniqueId( ""/*HID_STATUSBAR*/ ); + pStatusBar->SetUniqueId( HID_STATUSBAR ); } } diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 19625d5e198b..3cf90b1867f5 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -883,15 +883,13 @@ void ToolBarManager::CreateControllers() if ( nId == 0 ) continue; - // FIXME: HELPID - // What ? A width initalized with a help id ? Should we perhaps add two bananas and a coconut to it ? - // sal_Int16 nWidth( sal_Int16( m_pToolBar->GetHelpId( nId ))); - sal_Int16 nWidth( nId ); rtl::OUString aLoadURL( RTL_CONSTASCII_USTRINGPARAM( ".uno:OpenUrl" )); rtl::OUString aCommandURL( m_pToolBar->GetItemCommand( nId )); sal_Bool bInit( sal_True ); sal_Bool bCreate( sal_True ); Reference< XStatusListener > xController; + CommandToInfoMap::iterator pCommandIter = m_aCommandMap.find( aCommandURL ); + sal_Int32 nWidth = ( pCommandIter != m_aCommandMap.end() ? pCommandIter->second.nWidth : 0 ); svt::ToolboxController* pController( 0 ); @@ -1188,7 +1186,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine rtl::OUString aHelpURL; rtl::OUString aTooltip; sal_uInt16 nType( ::com::sun::star::ui::ItemType::DEFAULT ); - sal_uInt16 nWidth( 0 ); + sal_uInt32 nWidth( 0 ); sal_Bool bIsVisible( sal_True ); sal_uInt32 nStyle( 0 ); @@ -1277,6 +1275,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine if ( pIter == m_aCommandMap.end()) { aCmdInfo.nId = nId; + aCmdInfo.nWidth = nWidth; m_aCommandMap.insert( CommandToInfoMap::value_type( aCommandURL, aCmdInfo )); } else @@ -1284,10 +1283,6 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine pIter->second.aIds.push_back( nId ); } - // Add additional information for the controller to the obsolete help id - // FIXME: HELPID - m_pToolBar->SetHelpId( ""/*ULONG( nWidth )*/); - if ( !bIsVisible ) m_pToolBar->HideItem( nId ); diff --git a/framework/source/uielement/toolbarmerger.cxx b/framework/source/uielement/toolbarmerger.cxx index 025ebea06a19..aca62a8b44ef 100644 --- a/framework/source/uielement/toolbarmerger.cxx +++ b/framework/source/uielement/toolbarmerger.cxx @@ -512,7 +512,6 @@ bool ToolBarMerger::MergeItems( pToolbar->InsertSeparator( sal_uInt16( nInsPos )); else { - ToolBarMerger::CreateToolbarItem( pToolbar, sal_uInt16( nInsPos ), rItemId, rItem ); CommandToInfoMap::iterator pIter = rCommandMap.find( rItem.aCommandURL ); if ( pIter == rCommandMap.end()) { @@ -524,6 +523,8 @@ bool ToolBarMerger::MergeItems( { pIter->second.aIds.push_back( rItemId ); } + + ToolBarMerger::CreateToolbarItem( pToolbar, rCommandMap, sal_uInt16( nInsPos ), rItemId, rItem ); } ++nIndex; @@ -691,7 +692,7 @@ bool ToolBarMerger::RemoveItems( return pResult; } -void ToolBarMerger::CreateToolbarItem( ToolBox* pToolbar, sal_uInt16 nPos, sal_uInt16 nItemId, const AddonToolbarItem& rItem ) +void ToolBarMerger::CreateToolbarItem( ToolBox* pToolbar, CommandToInfoMap& rCommandMap, sal_uInt16 nPos, sal_uInt16 nItemId, const AddonToolbarItem& rItem ) { pToolbar->InsertItem( nItemId, rItem.aLabel, 0, nPos ); pToolbar->SetItemCommand( nItemId, rItem.aCommandURL ); @@ -700,10 +701,9 @@ void ToolBarMerger::CreateToolbarItem( ToolBox* pToolbar, sal_uInt16 nPos, sal_u pToolbar->EnableItem( nItemId, sal_True ); pToolbar->SetItemState( nItemId, STATE_NOCHECK ); - // Use obsolete help id to transport the width of the item - // FIXME: HELPID - // this looks broken - pToolbar->SetHelpId( nItemId, ""/*rItem.nWidth*/ ); + CommandToInfoMap::iterator pIter = rCommandMap.find( rItem.aCommandURL ); + if ( pIter != rCommandMap.end() ) + pIter->second.nWidth = rItem.nWidth; // Use the user data to store add-on specific data with the toolbar item AddonsParams* pAddonParams = new AddonsParams; diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index d3a616a76629..6ed3e7233a77 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -181,7 +181,7 @@ ToolbarsMenuController::~ToolbarsMenuController() } void ToolbarsMenuController::addCommand( - Reference< css::awt::XPopupMenu >& rPopupMenu, const rtl::OUString& rCommandURL, USHORT nHelpId, const rtl::OUString& rLabel ) + Reference< css::awt::XPopupMenu >& rPopupMenu, const rtl::OUString& rCommandURL, const rtl::OString& sHelpId, const rtl::OUString& rLabel ) { USHORT nItemId = m_xPopupMenu->getItemCount()+1; @@ -216,9 +216,7 @@ void ToolbarsMenuController::addCommand( PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu(); if ( !!aImage ) pVCLPopupMenu->SetItemImage( nItemId, aImage ); - // FIXME: HELPID - pVCLPopupMenu->SetHelpId( nItemId, ""/*nHelpId*/ ); - (void)nHelpId; + pVCLPopupMenu->SetHelpId( nItemId, sHelpId ); } m_aCommandVector.push_back( rCommandURL ); @@ -510,14 +508,14 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r m_aModuleIdentifier.equalsAscii( "com.sun.star.presentation.PresentationDocument" ) || m_aModuleIdentifier.equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" )) { - addCommand( m_xPopupMenu, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CMD_HYPERLINKBAR )), 10360, aEmptyString ); + addCommand( m_xPopupMenu, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CMD_HYPERLINKBAR )), CMD_HYPERLINKBAR, aEmptyString ); if ( m_aModuleIdentifier.equalsAscii( "com.sun.star.drawing.DrawingDocument" ) || m_aModuleIdentifier.equalsAscii( "com.sun.star.presentation.PresentationDocument" )) - addCommand( m_xPopupMenu, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CMD_COLORBAR )), 10417, aEmptyString ); + addCommand( m_xPopupMenu, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CMD_COLORBAR )), CMD_COLORBAR, aEmptyString ); else if ( m_aModuleIdentifier.equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" )) - addCommand( m_xPopupMenu, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CMD_INPUTLINEBAR )), 26241, aEmptyString ); + addCommand( m_xPopupMenu, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CMD_INPUTLINEBAR )), CMD_INPUTLINEBAR, aEmptyString ); else - addCommand( m_xPopupMenu, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CMD_FORMULABAR )), 20128, aEmptyString ); + addCommand( m_xPopupMenu, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CMD_FORMULABAR )), CMD_FORMULABAR, aEmptyString ); } sal_Bool bAddCommand( sal_True ); @@ -540,7 +538,7 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r m_xPopupMenu->insertSeparator( nItemCount+1 ); } - addCommand( m_xPopupMenu, aConfigureToolbar, 5904, aEmptyString ); + addCommand( m_xPopupMenu, aConfigureToolbar, CONFIGURE_TOOLBARS, aEmptyString ); } // Add separator if no configure has been added @@ -556,7 +554,7 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r String aLabelStr = String( FwkResId( STR_RESTORE_TOOLBARS )); rtl::OUString aRestoreCmd( RTL_CONSTASCII_USTRINGPARAM( CMD_RESTOREVISIBILITY )); - addCommand( m_xPopupMenu, aRestoreCmd, 9999, aLabelStr ); + addCommand( m_xPopupMenu, aRestoreCmd, CMD_RESTOREVISIBILITY, aLabelStr ); } } |