Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _TOOLKIT_AWT_VCLXMENU_HXX_
30 : : #define _TOOLKIT_AWT_VCLXMENU_HXX_
31 : :
32 : : #include <toolkit/dllapi.h>
33 : : #include <com/sun/star/awt/XMenuBarExtended.hpp>
34 : : #include <com/sun/star/awt/XPopupMenuExtended.hpp>
35 : : #include <com/sun/star/lang/XServiceInfo.hpp>
36 : : #include <com/sun/star/lang/XTypeProvider.hpp>
37 : : #include <com/sun/star/lang/XUnoTunnel.hpp>
38 : : #include <cppuhelper/weak.hxx>
39 : : #include <osl/mutex.hxx>
40 : :
41 : : #include <tools/link.hxx>
42 : :
43 : : #include <toolkit/helper/listenermultiplexer.hxx>
44 : : #include <vector>
45 : :
46 : : class Menu;
47 : : class MenuBar;
48 : : class VclSimpleEvent;
49 : : class PopupMenu;
50 : :
51 : : typedef ::std::vector<
52 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >*
53 : : > PopupMenuRefList;
54 : :
55 : : // ----------------------------------------------------
56 : : // class VCLXMenu
57 : : // ----------------------------------------------------
58 : :
59 : : class TOOLKIT_DLLPUBLIC VCLXMenu : public ::com::sun::star::awt::XMenuBarExtended,
60 : : public ::com::sun::star::awt::XPopupMenuExtended,
61 : : public ::com::sun::star::lang::XServiceInfo,
62 : : public ::com::sun::star::lang::XTypeProvider,
63 : : public ::com::sun::star::lang::XUnoTunnel,
64 : : public ::cppu::OWeakObject
65 : : {
66 : : private:
67 : : ::osl::Mutex maMutex;
68 : : Menu* mpMenu;
69 : : MenuListenerMultiplexer maMenuListeners;
70 : : PopupMenuRefList maPopupMenueRefs;
71 : :
72 : : protected:
73 : 16056 : ::osl::Mutex& GetMutex() { return maMutex; }
74 : :
75 : : DECL_LINK( MenuEventListener, VclSimpleEvent* );
76 : :
77 : : void ImplCreateMenu( sal_Bool bPopup );
78 : :
79 : : public:
80 : : VCLXMenu();
81 : : VCLXMenu( Menu* pMenu );
82 : : ~VCLXMenu();
83 : :
84 : :
85 : 14165 : Menu* GetMenu() const { return mpMenu; }
86 : : sal_Bool IsPopupMenu() const;
87 : :
88 : : // ::com::sun::star::uno::XInterface
89 : : ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
90 : 66803 : void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
91 : 66712 : void SAL_CALL release() throw() { OWeakObject::release(); }
92 : :
93 : : // ::com::sun::star::lang::XUnoTunnel
94 : : static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
95 : : static VCLXMenu* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
96 : : sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
97 : :
98 : : // ::com::sun::star::lang::XTypeProvider
99 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
100 : : ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
101 : :
102 : : // ::com::sun::star::awt::XMenu
103 : : void SAL_CALL addMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
104 : : void SAL_CALL removeMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
105 : : void SAL_CALL insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
106 : : void SAL_CALL removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException);
107 : : sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException);
108 : : sal_Int16 SAL_CALL getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
109 : : sal_Int16 SAL_CALL getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::RuntimeException);
110 : : void SAL_CALL enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException);
111 : : sal_Bool SAL_CALL isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException);
112 : : void SAL_CALL setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException);
113 : : ::rtl::OUString SAL_CALL getItemText( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException);
114 : : 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);
115 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > SAL_CALL getPopupMenu( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException);
116 : :
117 : : // ::com::sun::star::awt::XPopupMenu
118 : : void SAL_CALL insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
119 : : void SAL_CALL setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException);
120 : : sal_Int16 SAL_CALL getDefaultItem( ) throw(::com::sun::star::uno::RuntimeException);
121 : : void SAL_CALL checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun::star::uno::RuntimeException);
122 : : sal_Bool SAL_CALL isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException);
123 : : 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);
124 : :
125 : : // ::com::sun::star::awt::XMenuBar
126 : :
127 : : // ::com::sun::star::awt::XMenuExtended
128 : : virtual void SAL_CALL setCommand( sal_Int16 nItemId, const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException);
129 : : virtual ::rtl::OUString SAL_CALL getCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException);
130 : : virtual void SAL_CALL setHelpCommand( sal_Int16 nItemId, const ::rtl::OUString& aHelp ) throw (::com::sun::star::uno::RuntimeException);
131 : : virtual ::rtl::OUString SAL_CALL getHelpCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException);
132 : :
133 : : // ========================================================================
134 : : // ========================================================================
135 : : // ========================================================================
136 : :
137 : : // XMenuExtended2 Methods
138 : : virtual ::sal_Bool SAL_CALL isPopupMenu( ) throw (::com::sun::star::uno::RuntimeException);
139 : : virtual void SAL_CALL clear( ) throw (::com::sun::star::uno::RuntimeException);
140 : : virtual ::com::sun::star::awt::MenuItemType SAL_CALL getItemType( ::sal_Int16 nItemPos ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
141 : : virtual void SAL_CALL hideDisabledEntries( ::sal_Bool bHide ) throw (::com::sun::star::uno::RuntimeException);
142 : :
143 : : // XMenuBarExtended Methods
144 : :
145 : : // XPopupMenuExtended Methods
146 : : virtual ::sal_Bool SAL_CALL isInExecute( ) throw (::com::sun::star::uno::RuntimeException);
147 : : virtual void SAL_CALL endExecute( ) throw (::com::sun::star::uno::RuntimeException);
148 : : virtual void SAL_CALL setLogo( const ::com::sun::star::awt::MenuLogo& aMenuLogo ) throw (::com::sun::star::uno::RuntimeException);
149 : : virtual ::com::sun::star::awt::MenuLogo SAL_CALL getLogo( ) throw (::com::sun::star::uno::RuntimeException);
150 : : virtual void SAL_CALL enableAutoMnemonics( ::sal_Bool bEnable ) throw (::com::sun::star::uno::RuntimeException);
151 : : 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);
152 : : virtual ::com::sun::star::awt::KeyEvent SAL_CALL getAcceleratorKeyEvent( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
153 : : virtual void SAL_CALL setHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sHelpText ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
154 : : virtual ::rtl::OUString SAL_CALL getHelpText( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
155 : : virtual void SAL_CALL setTipHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sTipHelpText ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
156 : : virtual ::rtl::OUString SAL_CALL getTipHelpText( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
157 : : 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);
158 : : 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);
159 : : virtual void SAL_CALL setItemImageAngle( ::sal_Int16 nItemId, ::sal_Int32 nAngle ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
160 : : virtual ::sal_Int32 SAL_CALL getItemImageAngle( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
161 : : virtual void SAL_CALL setItemImageMirrorMode( ::sal_Int16 nItemId, ::sal_Bool bMirror ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
162 : : virtual ::sal_Bool SAL_CALL isItemImageInMirrorMode( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
163 : :
164 : : // ::com::sun::star::lang::XServiceInfo
165 : : virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
166 : : virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
167 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
168 : :
169 : : };
170 : :
171 : : // ----------------------------------------------------
172 : : // class VCLXMenuBar
173 : : // ----------------------------------------------------
174 [ - + ]: 3236 : class TOOLKIT_DLLPUBLIC VCLXMenuBar : public VCLXMenu
175 : : {
176 : : public:
177 : : VCLXMenuBar();
178 : : VCLXMenuBar( MenuBar* pMenuBar );
179 : : };
180 : :
181 : : // ----------------------------------------------------
182 : : // class VCLXPopupMenu
183 : : // ----------------------------------------------------
184 [ - + ]: 21576 : class TOOLKIT_DLLPUBLIC VCLXPopupMenu : public VCLXMenu
185 : : {
186 : : public:
187 : : VCLXPopupMenu();
188 : : VCLXPopupMenu( PopupMenu* pPopMenu );
189 : : };
190 : :
191 : : #endif // _TOOLKIT_AWT_VCLXMENU_HXX_
192 : :
193 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|