diff options
author | Ariel Constenla-Haile <arielch@apache.org> | 2012-12-23 11:29:21 +0000 |
---|---|---|
committer | Ariel Constenla-Haile <arielch@apache.org> | 2012-12-23 11:29:21 +0000 |
commit | 399946b82f5efec19cd82d1c320d5aa9295d235d (patch) | |
tree | deda9e189523c578be47e9b4f6d44edde5e55a57 /toolkit | |
parent | 9271c50c2d02b708cbe274568c455ff900595884 (diff) |
i121542 - Unify the Menu API
Notes
Notes:
merged as: 9052caae53ef6ec7eeab20f1ac56bd6310b4451b
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/inc/pch/precompiled_toolkit.hxx | 1 | ||||
-rw-r--r-- | toolkit/inc/toolkit/awt/vclxmenu.hxx | 216 | ||||
-rw-r--r-- | toolkit/inc/toolkit/helper/listenermultiplexer.hxx | 8 | ||||
-rw-r--r-- | toolkit/source/awt/vclxmenu.cxx | 574 | ||||
-rw-r--r-- | toolkit/source/helper/listenermultiplexer.cxx | 8 |
5 files changed, 321 insertions, 486 deletions
diff --git a/toolkit/inc/pch/precompiled_toolkit.hxx b/toolkit/inc/pch/precompiled_toolkit.hxx index ac689ee73300..ad2d76b7333b 100644 --- a/toolkit/inc/pch/precompiled_toolkit.hxx +++ b/toolkit/inc/pch/precompiled_toolkit.hxx @@ -110,7 +110,6 @@ #include "com/sun/star/awt/XLayoutConstrains.hpp" #include "com/sun/star/awt/XListBox.hpp" #include "com/sun/star/awt/XMenuBar.hpp" -#include "com/sun/star/awt/XMenuExtended.hpp" #include "com/sun/star/awt/XMenuListener.hpp" #include "com/sun/star/awt/XMessageBox.hpp" #include "com/sun/star/awt/XMouseListener.hpp" diff --git a/toolkit/inc/toolkit/awt/vclxmenu.hxx b/toolkit/inc/toolkit/awt/vclxmenu.hxx index c3599348505c..e8c79b675643 100644 --- a/toolkit/inc/toolkit/awt/vclxmenu.hxx +++ b/toolkit/inc/toolkit/awt/vclxmenu.hxx @@ -19,164 +19,132 @@ * *************************************************************/ - - #ifndef _TOOLKIT_AWT_VCLXMENU_HXX_ #define _TOOLKIT_AWT_VCLXMENU_HXX_ #include <toolkit/dllapi.h> -#include <com/sun/star/awt/XMenuBarExtended.hpp> -#include <com/sun/star/awt/XPopupMenuExtended.hpp> +#include <toolkit/helper/listenermultiplexer.hxx> + +#include <com/sun/star/awt/XMenuBar.hpp> +#include <com/sun/star/awt/XPopupMenu.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> + #include <cppuhelper/weak.hxx> #include <osl/mutex.hxx> - -#include <tools/list.hxx> #include <tools/link.hxx> +#include <tools/list.hxx> -#include <toolkit/helper/listenermultiplexer.hxx> +namespace css = ::com::sun::star; class Menu; class MenuBar; class VclSimpleEvent; -DECLARE_LIST( PopupMenuRefList, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >* ) +DECLARE_LIST( PopupMenuRefList, css::uno::Reference< css::awt::XPopupMenu >* ) -// ---------------------------------------------------- -// class VCLXMenu -// ---------------------------------------------------- - -class TOOLKIT_DLLPUBLIC VCLXMenu : public ::com::sun::star::awt::XMenuBarExtended, - public ::com::sun::star::awt::XPopupMenuExtended, - public ::com::sun::star::lang::XServiceInfo, - public ::com::sun::star::lang::XTypeProvider, - public ::com::sun::star::lang::XUnoTunnel, - public ::cppu::OWeakObject +class TOOLKIT_DLLPUBLIC VCLXMenu : public css::awt::XMenuBar, + public css::awt::XPopupMenu, + public css::lang::XServiceInfo, + public css::lang::XTypeProvider, + public css::lang::XUnoTunnel, + public ::cppu::OWeakObject { private: - ::osl::Mutex maMutex; - Menu* mpMenu; - MenuListenerMultiplexer maMenuListeners; - PopupMenuRefList maPopupMenueRefs; + ::osl::Mutex maMutex; + Menu* mpMenu; + MenuListenerMultiplexer maMenuListeners; + PopupMenuRefList maPopupMenueRefs; protected: - ::osl::Mutex& GetMutex() { return maMutex; } + ::osl::Mutex& GetMutex() { return maMutex; } - DECL_LINK( MenuEventListener, VclSimpleEvent* ); + DECL_LINK( MenuEventListener, VclSimpleEvent* ); - void ImplCreateMenu( sal_Bool bPopup ); + void ImplCreateMenu( sal_Bool bPopup ); public: - VCLXMenu(); - VCLXMenu( Menu* pMenu ); - ~VCLXMenu(); - - - Menu* GetMenu() const { return mpMenu; } - sal_Bool IsPopupMenu() const; - - // ::com::sun::star::uno::XInterface - ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL acquire() throw() { OWeakObject::acquire(); } - void SAL_CALL release() throw() { OWeakObject::release(); } - - // ::com::sun::star::lang::XUnoTunnel - static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); - static VCLXMenu* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); - sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::lang::XTypeProvider - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::awt::XMenu - void SAL_CALL addMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL removeMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException); - sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException); - sal_Int16 SAL_CALL getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); - sal_Int16 SAL_CALL getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException); - sal_Bool SAL_CALL isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException); - ::rtl::OUString SAL_CALL getItemText( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& aPopupMenu ) throw(::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > SAL_CALL getPopupMenu( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::awt::XPopupMenu - void SAL_CALL insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException); - sal_Int16 SAL_CALL getDefaultItem( ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun::star::uno::RuntimeException); - sal_Bool SAL_CALL isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException); - sal_Int16 SAL_CALL execute( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent, const ::com::sun::star::awt::Rectangle& Area, sal_Int16 Direction ) throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::awt::XMenuBar - - // ::com::sun::star::awt::XMenuExtended - virtual void SAL_CALL setCommand( sal_Int16 nItemId, const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setHelpCommand( sal_Int16 nItemId, const ::rtl::OUString& aHelp ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getHelpCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException); - - // ======================================================================== - // ======================================================================== - // ======================================================================== - - // XMenuExtended2 Methods - virtual ::sal_Bool SAL_CALL isPopupMenu( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clear( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::MenuItemType SAL_CALL getItemType( ::sal_Int16 nItemPos ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL hideDisabledEntries( ::sal_Bool bHide ) throw (::com::sun::star::uno::RuntimeException); - - // XMenuBarExtended Methods - - // XPopupMenuExtended Methods - virtual ::sal_Bool SAL_CALL isInExecute( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL endExecute( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setLogo( const ::com::sun::star::awt::MenuLogo& aMenuLogo ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::MenuLogo SAL_CALL getLogo( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL enableAutoMnemonics( ::sal_Bool bEnable ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setAcceleratorKeyEvent( ::sal_Int16 nItemId, const ::com::sun::star::awt::KeyEvent& aKeyEvent ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::KeyEvent SAL_CALL getAcceleratorKeyEvent( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sHelpText ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getHelpText( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setTipHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sTipHelpText ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTipHelpText( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setItemImage( ::sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& xGraphic, ::sal_Bool bScale ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL getItemImage( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setItemImageAngle( ::sal_Int16 nItemId, ::sal_Int32 nAngle ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getItemImageAngle( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setItemImageMirrorMode( ::sal_Int16 nItemId, ::sal_Bool bMirror ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isItemImageInMirrorMode( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::lang::XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); - + VCLXMenu(); + VCLXMenu( Menu* pMenu ); + ~VCLXMenu(); + + Menu* GetMenu() const { return mpMenu; } + sal_Bool IsPopupMenu() const; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) throw(css::uno::RuntimeException); + void SAL_CALL acquire() throw() { OWeakObject::acquire(); } + void SAL_CALL release() throw() { OWeakObject::release(); } + + // css::lang::XUnoTunnel + static const css::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); + static VCLXMenu* GetImplementation( const css::uno::Reference< css::uno::XInterface >& rxIFace ) throw(); + sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) throw(css::uno::RuntimeException); + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw(css::uno::RuntimeException); + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(css::uno::RuntimeException); + + // css::awt::XMenu + virtual void SAL_CALL addMenuListener( const css::uno::Reference< css::awt::XMenuListener >& xListener ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeMenuListener( const css::uno::Reference< css::awt::XMenuListener >& xListener ) throw (css::uno::RuntimeException); + virtual void SAL_CALL insertItem( ::sal_Int16 nItemId, const ::rtl::OUString& aText, ::sal_Int16 nItemStyle, ::sal_Int16 nItemPos ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeItem( ::sal_Int16 nItemPos, ::sal_Int16 nCount ) throw (css::uno::RuntimeException); + virtual void SAL_CALL clear( ) throw (css::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getItemCount( ) throw (css::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getItemId( ::sal_Int16 nItemPos ) throw (css::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getItemPos( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException); + virtual css::awt::MenuItemType SAL_CALL getItemType( ::sal_Int16 nItemPos ) throw (css::uno::RuntimeException); + virtual void SAL_CALL enableItem( ::sal_Int16 nItemId, ::sal_Bool bEnable ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isItemEnabled( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException); + virtual void SAL_CALL hideDisabledEntries( ::sal_Bool bHide ) throw (css::uno::RuntimeException); + virtual void SAL_CALL enableAutoMnemonics( ::sal_Bool bEnable ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setItemText( ::sal_Int16 nItemId, const ::rtl::OUString& aText ) throw (css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getItemText( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setCommand( ::sal_Int16 nItemId, const ::rtl::OUString& aCommand ) throw (css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCommand( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setHelpCommand( ::sal_Int16 nItemId, const ::rtl::OUString& aCommand ) throw (css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getHelpCommand( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sHelpText ) throw (css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getHelpText( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setTipHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sTipHelpText ) throw (css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTipHelpText( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isPopupMenu( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setPopupMenu( ::sal_Int16 nItemId, const css::uno::Reference< css::awt::XPopupMenu >& aPopupMenu ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::awt::XPopupMenu > SAL_CALL getPopupMenu( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException); + + // css::awt::XPopupMenu + virtual void SAL_CALL insertSeparator( ::sal_Int16 nItemPos ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setDefaultItem( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getDefaultItem( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL checkItem( ::sal_Int16 nItemId, ::sal_Bool bCheck ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isItemChecked( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL execute( const css::uno::Reference< css::awt::XWindowPeer >& Parent, const css::awt::Point& Position, ::sal_Int16 Direction ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isInExecute( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL endExecute( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setAcceleratorKeyEvent( ::sal_Int16 nItemId, const css::awt::KeyEvent& aKeyEvent ) throw (css::uno::RuntimeException); + virtual css::awt::KeyEvent SAL_CALL getAcceleratorKeyEvent( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setItemImage( ::sal_Int16 nItemId, const css::uno::Reference< css::graphic::XGraphic >& xGraphic, ::sal_Bool bScale ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getItemImage( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException); + + // css::lang::XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (css::uno::RuntimeException); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException); }; -// ---------------------------------------------------- -// class VCLXMenuBar -// ---------------------------------------------------- class TOOLKIT_DLLPUBLIC VCLXMenuBar : public VCLXMenu { public: - VCLXMenuBar(); - VCLXMenuBar( MenuBar* pMenuBar ); + VCLXMenuBar(); + VCLXMenuBar( MenuBar* pMenuBar ); }; -// ---------------------------------------------------- -// class VCLXPopupMenu -// ---------------------------------------------------- class TOOLKIT_DLLPUBLIC VCLXPopupMenu : public VCLXMenu { public: - VCLXPopupMenu(); + VCLXPopupMenu(); }; -#endif // _TOOLKIT_AWT_VCLXMENU_HXX_ +#endif diff --git a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx index 0d663fb74b81..17bc1dd6bdd2 100644 --- a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx +++ b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx @@ -209,10 +209,10 @@ DECL_LISTENERMULTIPLEXER_END // class MenuListenerMultiplexer // ---------------------------------------------------- DECL_LISTENERMULTIPLEXER_START( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener ) - void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL itemHighlighted( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL itemSelected( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL itemActivated( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL itemDeactivated( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); DECL_LISTENERMULTIPLEXER_END // ---------------------------------------------------- diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx index 3703f874976c..3d6c43aa6fa3 100644 --- a/toolkit/source/awt/vclxmenu.cxx +++ b/toolkit/source/awt/vclxmenu.cxx @@ -24,67 +24,40 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_toolkit.hxx" - #include <toolkit/awt/vclxmenu.hxx> +#include <toolkit/helper/convert.hxx> #include <toolkit/helper/macros.hxx> #include <toolkit/helper/servicenames.hxx> #include <toolkit/helper/vclunohelper.hxx> -#include <toolkit/helper/convert.hxx> + #include <cppuhelper/typeprovider.hxx> #include <rtl/memory.h> +#include <rtl/ustrbuf.hxx> #include <rtl/uuid.h> -#include <vos/mutex.hxx> - -#include <vcl/menu.hxx> -#include <vcl/keycod.hxx> #include <vcl/image.hxx> +#include <vcl/keycod.hxx> +#include <vcl/menu.hxx> #include <vcl/mnemonic.hxx> #include <vcl/svapp.hxx> +#include <vos/mutex.hxx> #include <com/sun/star/awt/KeyModifier.hpp> +using rtl::OUString; +using rtl::OUStringBuffer; -#ifdef DBG_UTIL - #define THROW_MENUITEM_NOT_FOUND( Func, nItemId ) \ - if ( MENU_ITEM_NOTFOUND == mpMenu->GetItemPos( nItemId ) ) \ - throw ::com::sun::star::container::NoSuchElementException( \ - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( Func ) ) \ - += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": There is no menu item with " ) ) \ - += ::rtl::OUString::valueOf( sal_Int32( nItemId ) ) \ - += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " as identifier" ) ), \ - *this \ - ); - #define THROW_MENUPOS_NOT_FOUND( Func, nPos ) \ - if ( MENU_ITEM_NOTFOUND == sal_uInt16( nPos ) ) \ - throw ::com::sun::star::container::NoSuchElementException( \ - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( Func ) ) \ - += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": There is no menu item at position " ) ) \ - += ::rtl::OUString::valueOf( sal_Int32( nPos ) ), \ - *this \ - ); -#else - #define THROW_MENUITEM_NOT_FOUND( Func, nItemId ) \ - if ( MENU_ITEM_NOTFOUND == mpMenu->GetItemPos( nItemId ) ) \ - throw ::com::sun::star::container::NoSuchElementException(); - #define THROW_MENUPOS_NOT_FOUND( Func, nPos ) \ - if ( MENU_ITEM_NOTFOUND == sal_uInt16( nPos ) ) \ - throw ::com::sun::star::container::NoSuchElementException(); -#endif - - -// ---------------------------------------------------- -// class VCLXMenu -// ---------------------------------------------------- DBG_NAME(VCLXMenu) -VCLXMenu::VCLXMenu() : maMenuListeners( *this ) +VCLXMenu::VCLXMenu() + : maMenuListeners( *this ) { DBG_CTOR( VCLXMenu, 0 ); mpMenu = NULL; } -VCLXMenu::VCLXMenu( Menu* pMenu ) : maMenuListeners( *this ) +VCLXMenu::VCLXMenu( Menu* pMenu ) + : maMenuListeners( *this ) { DBG_CTOR( VCLXMenu, 0 ); mpMenu = pMenu; @@ -95,7 +68,7 @@ VCLXMenu::~VCLXMenu() DBG_DTOR( VCLXMenu, 0 ); for ( sal_uInt32 n = maPopupMenueRefs.Count(); n; ) { - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pRef = maPopupMenueRefs.GetObject( --n ); + css::uno::Reference< css::awt::XPopupMenu > * pRef = maPopupMenueRefs.GetObject( --n ); delete pRef; } if ( mpMenu ) @@ -138,10 +111,10 @@ IMPL_LINK( VCLXMenu, MenuEventListener, VclSimpleEvent*, pEvent ) { if ( maMenuListeners.getLength() ) { - ::com::sun::star::awt::MenuEvent aEvent; + css::awt::MenuEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; aEvent.MenuId = mpMenu->GetCurItemId(); - maMenuListeners.select( aEvent ); + maMenuListeners.itemSelected( aEvent ); } } break; @@ -154,10 +127,10 @@ IMPL_LINK( VCLXMenu, MenuEventListener, VclSimpleEvent*, pEvent ) { if ( maMenuListeners.getLength() ) { - ::com::sun::star::awt::MenuEvent aEvent; + css::awt::MenuEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; aEvent.MenuId = mpMenu->GetCurItemId(); - maMenuListeners.highlight( aEvent ); + maMenuListeners.itemHighlighted( aEvent ); } } break; @@ -165,10 +138,10 @@ IMPL_LINK( VCLXMenu, MenuEventListener, VclSimpleEvent*, pEvent ) { if ( maMenuListeners.getLength() ) { - ::com::sun::star::awt::MenuEvent aEvent; + css::awt::MenuEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; aEvent.MenuId = mpMenu->GetCurItemId(); - maMenuListeners.activate( aEvent ); + maMenuListeners.itemActivated( aEvent ); } } break; @@ -176,10 +149,10 @@ IMPL_LINK( VCLXMenu, MenuEventListener, VclSimpleEvent*, pEvent ) { if ( maMenuListeners.getLength() ) { - ::com::sun::star::awt::MenuEvent aEvent; + css::awt::MenuEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; aEvent.MenuId = mpMenu->GetCurItemId(); - maMenuListeners.deactivate( aEvent ); + maMenuListeners.itemDeactivated( aEvent ); } } break; @@ -208,50 +181,46 @@ IMPL_LINK( VCLXMenu, MenuEventListener, VclSimpleEvent*, pEvent ) } -//============================================================================= -//============================================================================= -//============================================================================= - - -// ::com::sun::star::lang::XServiceInfo -::rtl::OUString SAL_CALL VCLXMenu::getImplementationName( ) -throw (::com::sun::star::uno::RuntimeException) +OUString SAL_CALL VCLXMenu::getImplementationName( ) +throw (css::uno::RuntimeException) { ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); const sal_Bool bIsPopupMenu = IsPopupMenu(); aGuard.clear(); - ::rtl::OUString implName( RTL_CONSTASCII_USTRINGPARAM( "stardiv.Toolkit." ) ); + OUStringBuffer implName; + implName.appendAscii( RTL_CONSTASCII_STRINGPARAM( "stardiv.Toolkit." ) ); if ( bIsPopupMenu ) - implName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VCLXPopupMenu" ) ); + implName.appendAscii( RTL_CONSTASCII_STRINGPARAM( "VCLXPopupMenu" ) ); else - implName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VCLXMenuBar" ) ); + implName.appendAscii( RTL_CONSTASCII_STRINGPARAM( "VCLXMenuBar" ) ); - return implName; + return implName.makeStringAndClear(); } -::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL VCLXMenu::getSupportedServiceNames( ) -throw (::com::sun::star::uno::RuntimeException) +css::uno::Sequence< OUString > SAL_CALL VCLXMenu::getSupportedServiceNames( ) +throw (css::uno::RuntimeException) { ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); const sal_Bool bIsPopupMenu = IsPopupMenu(); aGuard.clear(); - ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames( 1 ); + css::uno::Sequence< OUString > aNames( 1 ); if ( bIsPopupMenu ) - aNames[ 0 ] = ::rtl::OUString::createFromAscii( szServiceName2_PopupMenu ); + aNames[ 0 ] = OUString::createFromAscii( szServiceName2_PopupMenu ); else - aNames[ 0 ] = ::rtl::OUString::createFromAscii( szServiceName2_MenuBar ); + aNames[ 0 ] = OUString::createFromAscii( szServiceName2_MenuBar ); return aNames; } -::sal_Bool SAL_CALL VCLXMenu::supportsService( const ::rtl::OUString& rServiceName ) -throw (::com::sun::star::uno::RuntimeException) +::sal_Bool SAL_CALL VCLXMenu::supportsService( + const OUString& rServiceName ) +throw (css::uno::RuntimeException) { - ::com::sun::star::uno::Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() ); + css::uno::Sequence< OUString > aServiceNames( getSupportedServiceNames() ); if ( aServiceNames[ 0 ] == rServiceName ) return sal_True; @@ -260,46 +229,40 @@ throw (::com::sun::star::uno::RuntimeException) } -// ::com::sun::star::uno::XInterface -::com::sun::star::uno::Any VCLXMenu::queryInterface( const ::com::sun::star::uno::Type & rType ) -throw(::com::sun::star::uno::RuntimeException) +css::uno::Any VCLXMenu::queryInterface( + const css::uno::Type & rType ) +throw(css::uno::RuntimeException) { ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); const sal_Bool bIsPopupMenu = IsPopupMenu(); aGuard.clear(); - ::com::sun::star::uno::Any aRet; + css::uno::Any aRet; if ( bIsPopupMenu ) aRet = ::cppu::queryInterface( rType, - SAL_STATIC_CAST( ::com::sun::star::awt::XMenu*, (::com::sun::star::awt::XMenuBar*) this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XPopupMenu*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XPopupMenuExtended*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended*, (::com::sun::star::awt::XPopupMenuExtended*) this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended2*, (::com::sun::star::awt::XPopupMenuExtended*) this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ) ); + SAL_STATIC_CAST( css::awt::XMenu*, (css::awt::XPopupMenu*) this ), + SAL_STATIC_CAST( css::awt::XPopupMenu*, this ), + SAL_STATIC_CAST( css::lang::XTypeProvider*, this ), + SAL_STATIC_CAST( css::lang::XServiceInfo*, this ), + SAL_STATIC_CAST( css::lang::XUnoTunnel*, this ) ); else aRet = ::cppu::queryInterface( rType, - SAL_STATIC_CAST( ::com::sun::star::awt::XMenu*, (::com::sun::star::awt::XMenuBar*) this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XMenuBar*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XMenuBarExtended*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended*, (::com::sun::star::awt::XMenuBarExtended*) this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended2*, (::com::sun::star::awt::XMenuBarExtended*) this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ) ); + SAL_STATIC_CAST( css::awt::XMenu*, (css::awt::XMenuBar*) this ), + SAL_STATIC_CAST( css::awt::XMenuBar*, this ), + SAL_STATIC_CAST( css::lang::XTypeProvider*, this ), + SAL_STATIC_CAST( css::lang::XServiceInfo*, this ), + SAL_STATIC_CAST( css::lang::XUnoTunnel*, this ) ); return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); } -// ::com::sun::star::lang::XUnoTunnel + IMPL_XUNOTUNNEL( VCLXMenu ) -// ::com::sun::star::lang::XTypeProvider -::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > VCLXMenu::getTypes() -throw(::com::sun::star::uno::RuntimeException) + +css::uno::Sequence< css::uno::Type > VCLXMenu::getTypes() +throw(css::uno::RuntimeException) { ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); const sal_Bool bIsPopupMenu = IsPopupMenu(); @@ -316,13 +279,10 @@ throw(::com::sun::star::uno::RuntimeException) if( !pCollectionPopupMenu ) { static ::cppu::OTypeCollection collectionPopupMenu( - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenu>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenuExtended>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended2>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ) ); + getCppuType( ( css::uno::Reference< css::lang::XTypeProvider>* ) NULL ), + getCppuType( ( css::uno::Reference< css::awt::XMenu>* ) NULL ), + getCppuType( ( css::uno::Reference< css::awt::XPopupMenu>* ) NULL ), + getCppuType( ( css::uno::Reference< css::lang::XServiceInfo>* ) NULL ) ); pCollectionPopupMenu = &collectionPopupMenu; } } @@ -337,13 +297,10 @@ throw(::com::sun::star::uno::RuntimeException) if( !pCollectionMenuBar ) { static ::cppu::OTypeCollection collectionMenuBar( - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenu>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBarExtended>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended2>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ) ); + getCppuType( ( css::uno::Reference< css::lang::XTypeProvider>* ) NULL ), + getCppuType( ( css::uno::Reference< css::awt::XMenu>* ) NULL ), + getCppuType( ( css::uno::Reference< css::awt::XMenuBar>* ) NULL ), + getCppuType( ( css::uno::Reference< css::lang::XServiceInfo>* ) NULL ) ); pCollectionMenuBar = &collectionMenuBar; } } @@ -352,8 +309,8 @@ throw(::com::sun::star::uno::RuntimeException) } -::com::sun::star::uno::Sequence< sal_Int8 > VCLXMenu::getImplementationId() -throw(::com::sun::star::uno::RuntimeException) +css::uno::Sequence< sal_Int8 > VCLXMenu::getImplementationId() +throw(css::uno::RuntimeException) { ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); const sal_Bool bIsPopupMenu = IsPopupMenu(); @@ -392,27 +349,30 @@ throw(::com::sun::star::uno::RuntimeException) } } - -//============================================================================= -//============================================================================= -//============================================================================= - - -void VCLXMenu::addMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::addMenuListener( + const css::uno::Reference< css::awt::XMenuListener >& rxListener ) +throw(css::uno::RuntimeException) { ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); maMenuListeners.addInterface( rxListener ); } -void VCLXMenu::removeMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::removeMenuListener( + const css::uno::Reference< css::awt::XMenuListener >& rxListener ) +throw(css::uno::RuntimeException) { ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); maMenuListeners.removeInterface( rxListener ); } -void VCLXMenu::insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::insertItem( + sal_Int16 nItemId, + const OUString& aText, + sal_Int16 nItemStyle, + sal_Int16 nPos ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -421,7 +381,10 @@ void VCLXMenu::insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_ mpMenu->InsertItem( nItemId, aText, (MenuItemBits)nItemStyle, nPos ); } -void VCLXMenu::removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::removeItem( + sal_Int16 nPos, + sal_Int16 nCount ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -436,7 +399,8 @@ void VCLXMenu::removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun:: } } -sal_Int16 VCLXMenu::getItemCount( ) throw(::com::sun::star::uno::RuntimeException) +sal_Int16 VCLXMenu::getItemCount( ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -444,7 +408,9 @@ sal_Int16 VCLXMenu::getItemCount( ) throw(::com::sun::star::uno::RuntimeExcepti return mpMenu ? mpMenu->GetItemCount() : 0; } -sal_Int16 VCLXMenu::getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +sal_Int16 VCLXMenu::getItemId( + sal_Int16 nPos ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -452,7 +418,9 @@ sal_Int16 VCLXMenu::getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::Run return mpMenu ? mpMenu->GetItemId( nPos ) : 0; } -sal_Int16 VCLXMenu::getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::RuntimeException) +sal_Int16 VCLXMenu::getItemPos( + sal_Int16 nId ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -460,7 +428,10 @@ sal_Int16 VCLXMenu::getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::Run return mpMenu ? mpMenu->GetItemPos( nId ) : 0; } -void VCLXMenu::enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::enableItem( + sal_Int16 nItemId, + sal_Bool bEnable ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -469,7 +440,9 @@ void VCLXMenu::enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::su mpMenu->EnableItem( nItemId, bEnable ); } -sal_Bool VCLXMenu::isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) +sal_Bool VCLXMenu::isItemEnabled( + sal_Int16 nItemId ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -477,7 +450,10 @@ sal_Bool VCLXMenu::isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::un return mpMenu ? mpMenu->IsItemEnabled( nItemId ) : sal_False; } -void VCLXMenu::setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::setItemText( + sal_Int16 nItemId, + const OUString& aText ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -486,18 +462,23 @@ void VCLXMenu::setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) th mpMenu->SetItemText( nItemId, aText ); } -::rtl::OUString VCLXMenu::getItemText( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) +OUString VCLXMenu::getItemText( + sal_Int16 nItemId ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - ::rtl::OUString aItemText; + OUString aItemText; if ( mpMenu ) aItemText = mpMenu->GetItemText( nItemId ); return aItemText; } -void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& rxPopupMenu ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::setPopupMenu( + sal_Int16 nItemId, + const css::uno::Reference< css::awt::XPopupMenu >& rxPopupMenu ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -508,7 +489,7 @@ void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Ref if ( mpMenu && pVCLMenu && pVCLMenu->GetMenu() && pVCLMenu->IsPopupMenu() ) { // Selbst eine Ref halten! - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pNewRef = new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > ; + css::uno::Reference< css::awt::XPopupMenu > * pNewRef = new css::uno::Reference< css::awt::XPopupMenu > ; *pNewRef = rxPopupMenu; maPopupMenueRefs.Insert( pNewRef, LIST_APPEND ); @@ -516,18 +497,20 @@ void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Ref } } -::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > VCLXMenu::getPopupMenu( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) +css::uno::Reference< css::awt::XPopupMenu > VCLXMenu::getPopupMenu( + sal_Int16 nItemId ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > aRef; + css::uno::Reference< css::awt::XPopupMenu > aRef; Menu* pMenu = mpMenu ? mpMenu->GetPopupMenu( nItemId ) : NULL; if ( pMenu ) { for ( sal_uInt32 n = maPopupMenueRefs.Count(); n; ) { - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pRef = maPopupMenueRefs.GetObject( --n ); + css::uno::Reference< css::awt::XPopupMenu > * pRef = maPopupMenueRefs.GetObject( --n ); Menu* pM = ((VCLXMenu*)pRef->get())->GetMenu(); if ( pM == pMenu ) { @@ -539,8 +522,10 @@ void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Ref return aRef; } -// ::com::sun::star::awt::XPopupMenu -void VCLXMenu::insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) +// css::awt::XPopupMenu +void VCLXMenu::insertSeparator( + sal_Int16 nPos ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -549,7 +534,9 @@ void VCLXMenu::insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::Ru mpMenu->InsertSeparator( nPos ); } -void VCLXMenu::setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::setDefaultItem( + sal_Int16 nItemId ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -558,7 +545,8 @@ void VCLXMenu::setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno:: mpMenu->SetDefaultItem( nItemId ); } -sal_Int16 VCLXMenu::getDefaultItem( ) throw(::com::sun::star::uno::RuntimeException) +sal_Int16 VCLXMenu::getDefaultItem( ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -566,7 +554,10 @@ sal_Int16 VCLXMenu::getDefaultItem( ) throw(::com::sun::star::uno::RuntimeExcep return mpMenu ? mpMenu->GetDefaultItem() : 0; } -void VCLXMenu::checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun::star::uno::RuntimeException) +void VCLXMenu::checkItem( + sal_Int16 nItemId, + sal_Bool bCheck ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -575,7 +566,9 @@ void VCLXMenu::checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun: mpMenu->CheckItem( nItemId, bCheck ); } -sal_Bool VCLXMenu::isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) +sal_Bool VCLXMenu::isItemChecked( + sal_Int16 nItemId ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -583,19 +576,31 @@ sal_Bool VCLXMenu::isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::un return mpMenu ? mpMenu->IsItemChecked( nItemId ) : sal_False; } -sal_Int16 VCLXMenu::execute( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rxWindowPeer, const ::com::sun::star::awt::Rectangle& rArea, sal_Int16 nFlags ) throw(::com::sun::star::uno::RuntimeException) +sal_Int16 VCLXMenu::execute( + const css::uno::Reference< css::awt::XWindowPeer >& rxWindowPeer, + const css::awt::Point& rPos, + sal_Int16 nFlags ) +throw(css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); sal_Int16 nRet = 0; if ( mpMenu && IsPopupMenu() ) - nRet = ((PopupMenu*)mpMenu)->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ), VCLRectangle(rArea), nFlags | POPUPMENU_NOMOUSEUPCLOSE ); + { + const ::Point aPoint = VCLPoint( rPos ); + nRet = ((PopupMenu*)mpMenu)->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ), + ::Rectangle(aPoint,aPoint), + nFlags | POPUPMENU_NOMOUSEUPCLOSE ); + } return nRet; } -void SAL_CALL VCLXMenu::setCommand( sal_Int16 nItemId, const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXMenu::setCommand( + sal_Int16 nItemId, + const OUString& aCommand ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -604,18 +609,23 @@ void SAL_CALL VCLXMenu::setCommand( sal_Int16 nItemId, const ::rtl::OUString& aC mpMenu->SetItemCommand( nItemId, aCommand ); } -::rtl::OUString SAL_CALL VCLXMenu::getCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException) +OUString SAL_CALL VCLXMenu::getCommand( + sal_Int16 nItemId ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - ::rtl::OUString aItemCommand; + OUString aItemCommand; if ( mpMenu ) aItemCommand = mpMenu->GetItemCommand( nItemId ); return aItemCommand; } -void SAL_CALL VCLXMenu::setHelpCommand( sal_Int16 nItemId, const ::rtl::OUString& aHelp ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXMenu::setHelpCommand( + sal_Int16 nItemId, + const OUString& aHelp ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -624,31 +634,25 @@ void SAL_CALL VCLXMenu::setHelpCommand( sal_Int16 nItemId, const ::rtl::OUString mpMenu->SetHelpCommand( nItemId, aHelp ); } -::rtl::OUString SAL_CALL VCLXMenu::getHelpCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException) +OUString SAL_CALL VCLXMenu::getHelpCommand( + sal_Int16 nItemId ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - ::rtl::OUString aHelpCommand; + OUString aHelpCommand; if ( mpMenu ) aHelpCommand = mpMenu->GetHelpCommand( nItemId ); return aHelpCommand; } -// ============================================================================ -// ============================================================================ -// ============================================================================ - - -// BEGIN ANONYMOUS NAMESPACE namespace { - namespace css = ::com::sun::star; - - Image lcl_XGraphic2VCLImage( - const css::uno::Reference< css::graphic::XGraphic >& xGraphic, - sal_Bool bResize ) + static Image lcl_XGraphic2VCLImage( + const css::uno::Reference< css::graphic::XGraphic >& xGraphic, + sal_Bool bResize ) { Image aImage; if ( !xGraphic.is() ) @@ -680,13 +684,9 @@ namespace return aImage; } - /** - As svtools builds after toolkit, we can not include/use - svtools/inc/acceleratorexecute.hxx - So I just copy here svt::AcceleratorExecute::st_AWTKey2VCLKey - and svt::AcceleratorExecute::st_VCLKey2AWTKey - */ - css::awt::KeyEvent lcl_VCLKey2AWTKey(const KeyCode& aVCLKey) + /** Copied from svtools/inc/acceleratorexecute.hxx */ + static css::awt::KeyEvent lcl_VCLKey2AWTKey( + const KeyCode& aVCLKey) { css::awt::KeyEvent aAWTKey; aAWTKey.Modifiers = 0; @@ -715,24 +715,19 @@ namespace return KeyCode(nKey, bShift, bMod1, bMod2, bMod3); } -} // END ANONYMOUS NAMESPACE - - -// ============================================================================ -// ============================================================================ -// ============================================================================ - +} -// XMenuExtended2 Methods -::sal_Bool SAL_CALL VCLXMenu::isPopupMenu( ) throw (::com::sun::star::uno::RuntimeException) +::sal_Bool SAL_CALL VCLXMenu::isPopupMenu( ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); return IsPopupMenu(); } -void SAL_CALL VCLXMenu::clear( ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXMenu::clear( ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -741,26 +736,26 @@ void SAL_CALL VCLXMenu::clear( ) throw (::com::sun::star::uno::RuntimeException } -::com::sun::star::awt::MenuItemType SAL_CALL VCLXMenu::getItemType( ::sal_Int16 nItemPos ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) +css::awt::MenuItemType SAL_CALL VCLXMenu::getItemType( + ::sal_Int16 nItemPos ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - ::com::sun::star::awt::MenuItemType aMenuItemType = - ::com::sun::star::awt::MenuItemType_DONTKNOW; + css::awt::MenuItemType aMenuItemType = + css::awt::MenuItemType_DONTKNOW; if ( mpMenu ) { - THROW_MENUPOS_NOT_FOUND( "VCLXMenu::getItemType()", nItemPos ) - aMenuItemType = ( (::com::sun::star::awt::MenuItemType) mpMenu->GetItemType( nItemPos ) ); + aMenuItemType = ( (css::awt::MenuItemType) mpMenu->GetItemType( nItemPos ) ); } return aMenuItemType; } -void SAL_CALL VCLXMenu::hideDisabledEntries( ::sal_Bool bHide ) -throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXMenu::hideDisabledEntries( + ::sal_Bool bHide ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -774,15 +769,8 @@ throw (::com::sun::star::uno::RuntimeException) } -// ============================================================================ -// ============================================================================ -// ============================================================================ - - -// XPopupMenuExtended Methods - ::sal_Bool SAL_CALL VCLXMenu::isInExecute( ) -throw (::com::sun::star::uno::RuntimeException) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -795,7 +783,7 @@ throw (::com::sun::star::uno::RuntimeException) void SAL_CALL VCLXMenu::endExecute() -throw (::com::sun::star::uno::RuntimeException) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -805,54 +793,9 @@ throw (::com::sun::star::uno::RuntimeException) } -void SAL_CALL VCLXMenu::setLogo( const ::com::sun::star::awt::MenuLogo& aMenuLogo ) -throw (::com::sun::star::uno::RuntimeException) -{ - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu ) - { - if ( aMenuLogo.Graphic.is() ) - { - Image aImage = lcl_XGraphic2VCLImage( aMenuLogo.Graphic, sal_False ); - MenuLogo aVCLMenuLogo; - - aVCLMenuLogo.aBitmap = aImage.GetBitmapEx(); - aVCLMenuLogo.aStartColor = Color( (sal_uInt32)(aMenuLogo.StartColor) ); - aVCLMenuLogo.aEndColor = Color( (sal_uInt32)(aMenuLogo.EndColor) ); - - mpMenu->SetLogo( aVCLMenuLogo ); - } - else - mpMenu->SetLogo(); - } -} - - -::com::sun::star::awt::MenuLogo SAL_CALL VCLXMenu::getLogo( ) -throw (::com::sun::star::uno::RuntimeException) -{ - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - ::com::sun::star::awt::MenuLogo aAWTMenuLogo; - if ( mpMenu ) - { - if ( mpMenu->HasLogo() ) - { - MenuLogo aVCLMenuLogo = mpMenu->GetLogo(); - aAWTMenuLogo.Graphic = Image(aVCLMenuLogo.aBitmap).GetXGraphic(); - aAWTMenuLogo.StartColor = aVCLMenuLogo.aStartColor.GetColor(); - aAWTMenuLogo.EndColor = aVCLMenuLogo.aEndColor.GetColor(); - } - } - return aAWTMenuLogo; -} - - -void SAL_CALL VCLXMenu::enableAutoMnemonics( ::sal_Bool bEnable ) -throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXMenu::enableAutoMnemonics( + ::sal_Bool bEnable ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -866,34 +809,32 @@ throw (::com::sun::star::uno::RuntimeException) } -void SAL_CALL VCLXMenu::setAcceleratorKeyEvent( ::sal_Int16 nItemId, - const ::com::sun::star::awt::KeyEvent& aKeyEvent ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXMenu::setAcceleratorKeyEvent( + ::sal_Int16 nItemId, + const css::awt::KeyEvent& aKeyEvent ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - if ( mpMenu && IsPopupMenu() ) + if ( mpMenu && IsPopupMenu() && MENU_ITEM_NOTFOUND != mpMenu->GetItemPos( nItemId ) ) { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setAcceleratorKeyEvent()", nItemId ) KeyCode aVCLKeyCode = lcl_AWTKey2VCLKey( aKeyEvent ); mpMenu->SetAccelKey( nItemId, aVCLKeyCode ); } } -::com::sun::star::awt::KeyEvent SAL_CALL VCLXMenu::getAcceleratorKeyEvent( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) +css::awt::KeyEvent SAL_CALL VCLXMenu::getAcceleratorKeyEvent( + ::sal_Int16 nItemId ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - ::com::sun::star::awt::KeyEvent aKeyEvent; - if ( mpMenu && IsPopupMenu() ) + css::awt::KeyEvent aKeyEvent; + if ( mpMenu && IsPopupMenu() && MENU_ITEM_NOTFOUND != mpMenu->GetItemPos( nItemId ) ) { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getAcceleratorKeyEvent()", nItemId ) KeyCode nKeyCode = mpMenu->GetAccelKey( nItemId ); aKeyEvent = lcl_VCLKey2AWTKey( nKeyCode ); } @@ -902,32 +843,31 @@ throw ( ::com::sun::star::container::NoSuchElementException, } -void SAL_CALL VCLXMenu::setHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sHelpText ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXMenu::setHelpText( + ::sal_Int16 nItemId, + const OUString& sHelpText ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - if ( mpMenu && IsPopupMenu() ) + if ( mpMenu && MENU_ITEM_NOTFOUND != mpMenu->GetItemPos( nItemId ) ) { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setHelpText()", nItemId ) mpMenu->SetHelpText( nItemId, sHelpText ); } } -::rtl::OUString SAL_CALL VCLXMenu::getHelpText( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) +OUString SAL_CALL VCLXMenu::getHelpText( + ::sal_Int16 nItemId ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); rtl::OUString sHelpText; - if ( mpMenu && IsPopupMenu() ) + if ( mpMenu && MENU_ITEM_NOTFOUND != mpMenu->GetItemPos( nItemId ) ) { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getHelpText()", nItemId ) sHelpText = mpMenu->GetHelpText( nItemId ); } @@ -935,32 +875,31 @@ throw ( ::com::sun::star::container::NoSuchElementException, } -void SAL_CALL VCLXMenu::setTipHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sTipHelpText ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) +void SAL_CALL VCLXMenu::setTipHelpText( + ::sal_Int16 nItemId, + const OUString& sTipHelpText ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - if ( mpMenu && IsPopupMenu() ) + if ( mpMenu && MENU_ITEM_NOTFOUND != mpMenu->GetItemPos( nItemId ) ) { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setTipHelpText()", nItemId ) mpMenu->SetTipHelpText( nItemId, sTipHelpText ); } } -::rtl::OUString SAL_CALL VCLXMenu::getTipHelpText( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) +OUString SAL_CALL VCLXMenu::getTipHelpText( + ::sal_Int16 nItemId ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); rtl::OUString sTipHelpText; - if ( mpMenu && IsPopupMenu() ) + if ( mpMenu && MENU_ITEM_NOTFOUND != mpMenu->GetItemPos( nItemId ) ) { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getTipHelpText()", nItemId ) sTipHelpText = mpMenu->GetTipHelpText( nItemId ); } return sTipHelpText; @@ -968,35 +907,34 @@ throw ( ::com::sun::star::container::NoSuchElementException, void SAL_CALL VCLXMenu::setItemImage( - ::sal_Int16 nItemId, - const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& xGraphic, ::sal_Bool bScale ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) + ::sal_Int16 nItemId, + const css::uno::Reference< css::graphic::XGraphic >& xGraphic, + ::sal_Bool bScale ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - if ( mpMenu && IsPopupMenu() ) + if ( mpMenu && IsPopupMenu() && MENU_ITEM_NOTFOUND != mpMenu->GetItemPos( nItemId ) ) { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setItemImage()", nItemId ) Image aImage = lcl_XGraphic2VCLImage( xGraphic, bScale ); mpMenu->SetItemImage( nItemId, aImage ); } } -::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL VCLXMenu::getItemImage( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) +css::uno::Reference< css::graphic::XGraphic > SAL_CALL +VCLXMenu::getItemImage( + ::sal_Int16 nItemId ) +throw (css::uno::RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > rxGraphic; + css::uno::Reference< css::graphic::XGraphic > rxGraphic; - if ( mpMenu && IsPopupMenu() ) + if ( mpMenu && IsPopupMenu() && MENU_ITEM_NOTFOUND != mpMenu->GetItemPos( nItemId ) ) { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getItemImage()", nItemId ) Image aImage = mpMenu->GetItemImage( nItemId ); if ( !!aImage ) rxGraphic = aImage.GetXGraphic(); @@ -1005,73 +943,6 @@ throw ( ::com::sun::star::container::NoSuchElementException, } -void SAL_CALL VCLXMenu::setItemImageAngle( ::sal_Int16 nItemId, ::sal_Int32 nAngle ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setItemImageAngle()", nItemId ) - mpMenu->SetItemImageAngle( nItemId, nAngle ); - } -} - - -::sal_Int32 SAL_CALL VCLXMenu::getItemImageAngle( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - ::sal_Int32 nItemImageAngle( 0 ); - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getItemImageAngle()", nItemId ) - nItemImageAngle = mpMenu->GetItemImageAngle( nItemId ); - } - return nItemImageAngle; -} - - -void SAL_CALL VCLXMenu::setItemImageMirrorMode( ::sal_Int16 nItemId, ::sal_Bool bMirror ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setItemImageMirrorMode()", nItemId ) - mpMenu->SetItemImageMirrorMode( nItemId, bMirror ); - } -} - - -::sal_Bool SAL_CALL VCLXMenu::isItemImageInMirrorMode( ::sal_Int16 nItemId ) -throw ( ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException) -{ - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - sal_Bool bMirrorMode( sal_False ); - if ( mpMenu && IsPopupMenu() ) - { - THROW_MENUITEM_NOT_FOUND( "VCLXMenu::isItemImageInMirrorMode()", nItemId ) - bMirrorMode = mpMenu->GetItemImageMirrorMode( nItemId ); - } - return bMirrorMode; -} - - -// ---------------------------------------------------- -// class VCLXMenuBar -// ---------------------------------------------------- DBG_NAME(VCLXMenuBar); @@ -1086,9 +957,6 @@ VCLXMenuBar::VCLXMenuBar( MenuBar* pMenuBar ) : VCLXMenu( (Menu *)pMenuBar ) DBG_CTOR( VCLXMenuBar, 0 ); } -// ---------------------------------------------------- -// class VCLXPopupMenu -// ---------------------------------------------------- DBG_NAME(VCLXPopupMenu); diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx index 28b2ec747219..ad1585271ae9 100644 --- a/toolkit/source/helper/listenermultiplexer.cxx +++ b/toolkit/source/helper/listenermultiplexer.cxx @@ -176,10 +176,10 @@ IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( AdjustmentListenerMultiplexer, ::com::s // class MenuListenerMultiplexer // ---------------------------------------------------- IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener ) -IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, highlight, ::com::sun::star::awt::MenuEvent ) -IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, select, ::com::sun::star::awt::MenuEvent ) -IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, activate, ::com::sun::star::awt::MenuEvent ) -IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, deactivate, ::com::sun::star::awt::MenuEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, itemHighlighted, ::com::sun::star::awt::MenuEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, itemSelected, ::com::sun::star::awt::MenuEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, itemActivated, ::com::sun::star::awt::MenuEvent ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, itemDeactivated, ::com::sun::star::awt::MenuEvent ) // ---------------------------------------------------- // class TreeSelectionListenerMultiplexer |