Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #ifndef __FRAMEWORK_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX_
21 : : #define __FRAMEWORK_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX_
22 : :
23 : : #include <macros/xserviceinfo.hxx>
24 : : #include <stdtypes.h>
25 : :
26 : : #include <com/sun/star/lang/XServiceInfo.hpp>
27 : : #include <com/sun/star/lang/XTypeProvider.hpp>
28 : : #include <com/sun/star/lang/XInitialization.hpp>
29 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
30 : : #include <com/sun/star/frame/XFrame.hpp>
31 : : #include <com/sun/star/frame/XDispatch.hpp>
32 : : #include <com/sun/star/frame/XStatusListener.hpp>
33 : : #include <com/sun/star/frame/XPopupMenuController.hpp>
34 : : #include <com/sun/star/frame/XLayoutManager.hpp>
35 : : #include <com/sun/star/frame/XModel.hpp>
36 : : #include <com/sun/star/container/XNameAccess.hpp>
37 : : #include <com/sun/star/ui/XUIConfigurationManager.hpp>
38 : :
39 : : #include <svtools/popupmenucontrollerbase.hxx>
40 : : #include <toolkit/awt/vclxmenu.hxx>
41 : : #include <cppuhelper/weak.hxx>
42 : : #include <rtl/ustring.hxx>
43 : : #include <unotools/intlwrapper.hxx>
44 : :
45 : : #include <vector>
46 : :
47 : : namespace framework
48 : : {
49 : : class ToolbarsMenuController : public svt::PopupMenuControllerBase
50 : : {
51 : : using svt::PopupMenuControllerBase::disposing;
52 : :
53 : : public:
54 : : ToolbarsMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
55 : : virtual ~ToolbarsMenuController();
56 : :
57 : : // XServiceInfo
58 : : DECLARE_XSERVICEINFO
59 : :
60 : : // XPopupMenuController
61 : : virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException);
62 : :
63 : : // XInitialization
64 : : 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);
65 : :
66 : : // XStatusListener
67 : : virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
68 : :
69 : : // XMenuListener
70 : : virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
71 : : virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
72 : :
73 : : // XEventListener
74 : : virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
75 : :
76 [ # # ][ # # ]: 0 : struct ExecuteInfo
77 : : {
78 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
79 : : ::com::sun::star::util::URL aTargetURL;
80 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs;
81 : : };
82 : :
83 : : DECL_STATIC_LINK( ToolbarsMenuController, ExecuteHdl_Impl, ExecuteInfo* );
84 : :
85 : : private:
86 : : void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu );
87 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > getLayoutManagerToolbars( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& rLayoutManager );
88 : : rtl::OUString getUINameFromCommand( const rtl::OUString& rCommandURL );
89 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > getDispatchFromCommandURL( const rtl::OUString& rCommandURL );
90 : : void addCommand( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu, const rtl::OUString& rCommandURL, const rtl::OUString& aLabel );
91 : : sal_Bool isContextSensitiveToolbarNonVisible();
92 : :
93 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState;
94 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUICommandDescription;
95 : : ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xModuleCfgMgr;
96 : : ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xDocCfgMgr;
97 : : rtl::OUString m_aModuleIdentifier;
98 : : rtl::OUString m_aPropUIName;
99 : : rtl::OUString m_aPropResourceURL;
100 : : sal_Bool m_bModuleIdentified;
101 : : sal_Bool m_bResetActive;
102 : : std::vector< rtl::OUString > m_aCommandVector;
103 : : IntlWrapper m_aIntlWrapper;
104 : : };
105 : : }
106 : :
107 : : #endif // __FRAMEWORK_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX_
108 : :
109 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|