xref: /trunk/main/toolkit/inc/toolkit/awt/vclxmenu.hxx (revision d3e0dd8eb215533c15e891ee35bd141abe9397ee)
150e6b072SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
350e6b072SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
450e6b072SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
550e6b072SAndrew Rist  * distributed with this work for additional information
650e6b072SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
750e6b072SAndrew Rist  * to you under the Apache License, Version 2.0 (the
850e6b072SAndrew Rist  * "License"); you may not use this file except in compliance
950e6b072SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
1150e6b072SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
1350e6b072SAndrew Rist  * Unless required by applicable law or agreed to in writing,
1450e6b072SAndrew Rist  * software distributed under the License is distributed on an
1550e6b072SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1650e6b072SAndrew Rist  * KIND, either express or implied.  See the License for the
1750e6b072SAndrew Rist  * specific language governing permissions and limitations
1850e6b072SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
2050e6b072SAndrew Rist  *************************************************************/
2150e6b072SAndrew Rist 
22cdf0e10cSrcweir #ifndef _TOOLKIT_AWT_VCLXMENU_HXX_
23cdf0e10cSrcweir #define _TOOLKIT_AWT_VCLXMENU_HXX_
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <toolkit/dllapi.h>
26d026be40SAriel Constenla-Haile #include <toolkit/helper/listenermultiplexer.hxx>
27d026be40SAriel Constenla-Haile 
28d026be40SAriel Constenla-Haile #include <com/sun/star/awt/XMenuBar.hpp>
29d026be40SAriel Constenla-Haile #include <com/sun/star/awt/XPopupMenu.hpp>
30cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
31cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp>
32cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
33d026be40SAriel Constenla-Haile 
34cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
35cdf0e10cSrcweir #include <osl/mutex.hxx>
36cdf0e10cSrcweir #include <tools/link.hxx>
37d026be40SAriel Constenla-Haile #include <tools/list.hxx>
38cdf0e10cSrcweir 
39d026be40SAriel Constenla-Haile namespace css = ::com::sun::star;
40cdf0e10cSrcweir 
41cdf0e10cSrcweir class Menu;
42cdf0e10cSrcweir class MenuBar;
43cdf0e10cSrcweir class VclSimpleEvent;
44cdf0e10cSrcweir 
45d026be40SAriel Constenla-Haile DECLARE_LIST( PopupMenuRefList, css::uno::Reference< css::awt::XPopupMenu >* )
46cdf0e10cSrcweir 
47d026be40SAriel Constenla-Haile class TOOLKIT_DLLPUBLIC VCLXMenu : public css::awt::XMenuBar,
48d026be40SAriel Constenla-Haile                                    public css::awt::XPopupMenu,
49d026be40SAriel Constenla-Haile                                    public css::lang::XServiceInfo,
50d026be40SAriel Constenla-Haile                                    public css::lang::XTypeProvider,
51d026be40SAriel Constenla-Haile                                    public css::lang::XUnoTunnel,
52cdf0e10cSrcweir                                    public ::cppu::OWeakObject
53cdf0e10cSrcweir {
54cdf0e10cSrcweir private:
55cdf0e10cSrcweir     ::osl::Mutex                maMutex;
56cdf0e10cSrcweir     Menu*                       mpMenu;
57cdf0e10cSrcweir     MenuListenerMultiplexer     maMenuListeners;
58cdf0e10cSrcweir     PopupMenuRefList            maPopupMenueRefs;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir protected:
GetMutex()61cdf0e10cSrcweir     ::osl::Mutex&               GetMutex() { return maMutex; }
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     DECL_LINK( MenuEventListener, VclSimpleEvent* );
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     void ImplCreateMenu( sal_Bool bPopup );
66cdf0e10cSrcweir 
67cdf0e10cSrcweir public:
68cdf0e10cSrcweir     VCLXMenu();
69cdf0e10cSrcweir     VCLXMenu( Menu* pMenu );
70cdf0e10cSrcweir     ~VCLXMenu();
71cdf0e10cSrcweir 
GetMenu() const72cdf0e10cSrcweir     Menu*    GetMenu() const { return mpMenu; }
73cdf0e10cSrcweir     sal_Bool IsPopupMenu() const;
74cdf0e10cSrcweir 
75d026be40SAriel Constenla-Haile     // css::uno::XInterface
76d026be40SAriel Constenla-Haile     css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) throw(css::uno::RuntimeException);
acquire()77cdf0e10cSrcweir     void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
release()78cdf0e10cSrcweir     void SAL_CALL release() throw() { OWeakObject::release(); }
79cdf0e10cSrcweir 
80d026be40SAriel Constenla-Haile     // css::lang::XUnoTunnel
81d026be40SAriel Constenla-Haile     static const css::uno::Sequence< sal_Int8 >&  GetUnoTunnelId() throw();
82d026be40SAriel Constenla-Haile     static VCLXMenu* GetImplementation( const css::uno::Reference< css::uno::XInterface >& rxIFace ) throw();
83d026be40SAriel Constenla-Haile     sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) throw(css::uno::RuntimeException);
84cdf0e10cSrcweir 
85d026be40SAriel Constenla-Haile     // css::lang::XTypeProvider
86d026be40SAriel Constenla-Haile     css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw(css::uno::RuntimeException);
87d026be40SAriel Constenla-Haile     css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(css::uno::RuntimeException);
88cdf0e10cSrcweir 
89d026be40SAriel Constenla-Haile     // css::awt::XMenu
90d026be40SAriel Constenla-Haile     virtual void SAL_CALL addMenuListener( const css::uno::Reference< css::awt::XMenuListener >& xListener ) throw (css::uno::RuntimeException);
91d026be40SAriel Constenla-Haile     virtual void SAL_CALL removeMenuListener( const css::uno::Reference< css::awt::XMenuListener >& xListener ) throw (css::uno::RuntimeException);
92d026be40SAriel Constenla-Haile     virtual void SAL_CALL insertItem( ::sal_Int16 nItemId, const ::rtl::OUString& aText, ::sal_Int16 nItemStyle, ::sal_Int16 nItemPos ) throw (css::uno::RuntimeException);
93d026be40SAriel Constenla-Haile     virtual void SAL_CALL removeItem( ::sal_Int16 nItemPos, ::sal_Int16 nCount ) throw (css::uno::RuntimeException);
94d026be40SAriel Constenla-Haile     virtual void SAL_CALL clear(  ) throw (css::uno::RuntimeException);
95d026be40SAriel Constenla-Haile     virtual ::sal_Int16 SAL_CALL getItemCount(  ) throw (css::uno::RuntimeException);
96d026be40SAriel Constenla-Haile     virtual ::sal_Int16 SAL_CALL getItemId( ::sal_Int16 nItemPos ) throw (css::uno::RuntimeException);
97d026be40SAriel Constenla-Haile     virtual ::sal_Int16 SAL_CALL getItemPos( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException);
98d026be40SAriel Constenla-Haile     virtual css::awt::MenuItemType SAL_CALL getItemType( ::sal_Int16 nItemPos ) throw (css::uno::RuntimeException);
99d026be40SAriel Constenla-Haile     virtual void SAL_CALL enableItem( ::sal_Int16 nItemId, ::sal_Bool bEnable ) throw (css::uno::RuntimeException);
100d026be40SAriel Constenla-Haile     virtual ::sal_Bool SAL_CALL isItemEnabled( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException);
101d026be40SAriel Constenla-Haile     virtual void SAL_CALL hideDisabledEntries( ::sal_Bool bHide ) throw (css::uno::RuntimeException);
102d026be40SAriel Constenla-Haile     virtual void SAL_CALL enableAutoMnemonics( ::sal_Bool bEnable ) throw (css::uno::RuntimeException);
103d026be40SAriel Constenla-Haile     virtual void SAL_CALL setItemText( ::sal_Int16 nItemId, const ::rtl::OUString& aText ) throw (css::uno::RuntimeException);
104d026be40SAriel Constenla-Haile     virtual ::rtl::OUString SAL_CALL getItemText( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException);
105d026be40SAriel Constenla-Haile     virtual void SAL_CALL setCommand( ::sal_Int16 nItemId, const ::rtl::OUString& aCommand ) throw (css::uno::RuntimeException);
106d026be40SAriel Constenla-Haile     virtual ::rtl::OUString SAL_CALL getCommand( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException);
107d026be40SAriel Constenla-Haile     virtual void SAL_CALL setHelpCommand( ::sal_Int16 nItemId, const ::rtl::OUString& aCommand ) throw (css::uno::RuntimeException);
108d026be40SAriel Constenla-Haile     virtual ::rtl::OUString SAL_CALL getHelpCommand( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException);
109d026be40SAriel Constenla-Haile     virtual void SAL_CALL setHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sHelpText ) throw (css::uno::RuntimeException);
110d026be40SAriel Constenla-Haile     virtual ::rtl::OUString SAL_CALL getHelpText( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException);
111d026be40SAriel Constenla-Haile     virtual void SAL_CALL setTipHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sTipHelpText ) throw (css::uno::RuntimeException);
112d026be40SAriel Constenla-Haile     virtual ::rtl::OUString SAL_CALL getTipHelpText( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException);
113d026be40SAriel Constenla-Haile     virtual ::sal_Bool SAL_CALL isPopupMenu(  ) throw (css::uno::RuntimeException);
114d026be40SAriel Constenla-Haile     virtual void SAL_CALL setPopupMenu( ::sal_Int16 nItemId, const css::uno::Reference< css::awt::XPopupMenu >& aPopupMenu ) throw (css::uno::RuntimeException);
115d026be40SAriel Constenla-Haile     virtual css::uno::Reference< css::awt::XPopupMenu > SAL_CALL getPopupMenu( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException);
116cdf0e10cSrcweir 
117d026be40SAriel Constenla-Haile     // css::awt::XPopupMenu
118d026be40SAriel Constenla-Haile     virtual void SAL_CALL insertSeparator( ::sal_Int16 nItemPos ) throw (css::uno::RuntimeException);
119d026be40SAriel Constenla-Haile     virtual void SAL_CALL setDefaultItem( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException);
120d026be40SAriel Constenla-Haile     virtual ::sal_Int16 SAL_CALL getDefaultItem(  ) throw (css::uno::RuntimeException);
121d026be40SAriel Constenla-Haile     virtual void SAL_CALL checkItem( ::sal_Int16 nItemId, ::sal_Bool bCheck ) throw (css::uno::RuntimeException);
122d026be40SAriel Constenla-Haile     virtual ::sal_Bool SAL_CALL isItemChecked( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException);
123*31d843d7SAriel Constenla-Haile     virtual ::sal_Int16 SAL_CALL execute( const css::uno::Reference< css::awt::XWindowPeer >& Parent, const css::awt::Rectangle& Position, ::sal_Int16 Direction ) throw (css::uno::RuntimeException);
124d026be40SAriel Constenla-Haile     virtual ::sal_Bool SAL_CALL isInExecute(  ) throw (css::uno::RuntimeException);
125d026be40SAriel Constenla-Haile     virtual void SAL_CALL endExecute(  ) throw (css::uno::RuntimeException);
126d026be40SAriel Constenla-Haile     virtual void SAL_CALL setAcceleratorKeyEvent( ::sal_Int16 nItemId, const css::awt::KeyEvent& aKeyEvent ) throw (css::uno::RuntimeException);
127d026be40SAriel Constenla-Haile     virtual css::awt::KeyEvent SAL_CALL getAcceleratorKeyEvent( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException);
128d026be40SAriel Constenla-Haile     virtual void SAL_CALL setItemImage( ::sal_Int16 nItemId, const css::uno::Reference< css::graphic::XGraphic >& xGraphic, ::sal_Bool bScale ) throw (css::uno::RuntimeException);
129d026be40SAriel Constenla-Haile     virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getItemImage( ::sal_Int16 nItemId ) throw (css::uno::RuntimeException);
130cdf0e10cSrcweir 
131d026be40SAriel Constenla-Haile     // css::lang::XServiceInfo
132d026be40SAriel Constenla-Haile     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (css::uno::RuntimeException);
133d026be40SAriel Constenla-Haile     virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (css::uno::RuntimeException);
134d026be40SAriel Constenla-Haile     virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (css::uno::RuntimeException);
135cdf0e10cSrcweir };
136cdf0e10cSrcweir 
137cdf0e10cSrcweir class TOOLKIT_DLLPUBLIC VCLXMenuBar : public VCLXMenu
138cdf0e10cSrcweir {
139cdf0e10cSrcweir public:
140cdf0e10cSrcweir     VCLXMenuBar();
141cdf0e10cSrcweir     VCLXMenuBar( MenuBar* pMenuBar );
142cdf0e10cSrcweir };
143cdf0e10cSrcweir 
144cdf0e10cSrcweir class TOOLKIT_DLLPUBLIC VCLXPopupMenu : public VCLXMenu
145cdf0e10cSrcweir {
146cdf0e10cSrcweir public:
147cdf0e10cSrcweir     VCLXPopupMenu();
148cdf0e10cSrcweir };
149cdf0e10cSrcweir 
150d026be40SAriel Constenla-Haile #endif
151