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 __FRAMEWORK_UIELEMENT_CONTROLMENUCONTROLLER_HXX_
30 : : #define __FRAMEWORK_UIELEMENT_CONTROLMENUCONTROLLER_HXX_
31 : :
32 : : #include <macros/xserviceinfo.hxx>
33 : : #include <stdtypes.h>
34 : :
35 : : #include <com/sun/star/lang/XServiceInfo.hpp>
36 : : #include <com/sun/star/lang/XTypeProvider.hpp>
37 : : #include <com/sun/star/lang/XInitialization.hpp>
38 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
39 : : #include <com/sun/star/frame/XFrame.hpp>
40 : : #include <com/sun/star/frame/XDispatch.hpp>
41 : : #include <com/sun/star/frame/XStatusListener.hpp>
42 : : #include <com/sun/star/frame/XPopupMenuController.hpp>
43 : : #include <com/sun/star/frame/status/Verb.hpp>
44 : : #include <com/sun/star/frame/XModel.hpp>
45 : :
46 : : #include <svtools/popupmenucontrollerbase.hxx>
47 : : #include <toolkit/awt/vclxmenu.hxx>
48 : : #include <cppuhelper/weak.hxx>
49 : : #include <rtl/ustring.hxx>
50 : :
51 : : class PopupMenu;
52 : : namespace framework
53 : : {
54 : : class ControlMenuController : public svt::PopupMenuControllerBase
55 : : {
56 : : using svt::PopupMenuControllerBase::disposing;
57 : :
58 : : public:
59 : : ControlMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
60 : : virtual ~ControlMenuController();
61 : :
62 : : // XServiceInfo
63 : : DECLARE_XSERVICEINFO
64 : :
65 : : // XPopupMenuController
66 : : virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException);
67 : :
68 : : // XInitialization
69 : : virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
70 : :
71 : : // XStatusListener
72 : : virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
73 : :
74 : : // XMenuListener
75 : : virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
76 : :
77 : : // XEventListener
78 : : virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
79 : :
80 : : private:
81 : : virtual void impl_setPopupMenu();
82 : : virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL);
83 : :
84 [ + - ]: 8 : class UrlToDispatchMap : public ::boost::unordered_map< ::rtl::OUString,
85 : : com::sun::star::uno::Reference< com::sun::star::frame::XDispatch >,
86 : : OUStringHashCode,
87 : : ::std::equal_to< ::rtl::OUString > >
88 : : {
89 : : public:
90 : 0 : inline void free()
91 : : {
92 [ # # ]: 0 : UrlToDispatchMap().swap( *this );
93 : 0 : }
94 : : };
95 : :
96 : : void updateImagesPopupMenu( PopupMenu* pPopupMenu );
97 : : void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu );
98 : :
99 : : sal_Bool m_bShowMenuImages : 1;
100 : : PopupMenu* m_pResPopupMenu;
101 : : UrlToDispatchMap m_aURLToDispatchMap;
102 : : };
103 : : }
104 : :
105 : : #endif // __FRAMEWORK_UIELEMENT_CONTROLMENUCONTROLLER_HXX_
106 : :
107 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|