bump product version to 4.1.6.2
[LibreOffice.git] / framework / inc / uielement / toolbarsmenucontroller.hxx
blobe5ba4bf7445875e74f5b7ad554900b1765f1b72e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef __FRAMEWORK_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX_
21 #define __FRAMEWORK_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX_
23 #include <macros/xserviceinfo.hxx>
24 #include <stdtypes.h>
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>
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>
45 #include <vector>
47 namespace framework
49 class ToolbarsMenuController : public svt::PopupMenuControllerBase
51 using svt::PopupMenuControllerBase::disposing;
53 public:
54 ToolbarsMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
55 virtual ~ToolbarsMenuController();
57 // XServiceInfo
58 DECLARE_XSERVICEINFO
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);
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);
66 // XStatusListener
67 virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
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);
73 // XEventListener
74 virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
76 struct ExecuteInfo
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;
83 DECL_STATIC_LINK( ToolbarsMenuController, ExecuteHdl_Impl, ExecuteInfo* );
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 OUString getUINameFromCommand( const OUString& rCommandURL );
89 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > getDispatchFromCommandURL( const OUString& rCommandURL );
90 void addCommand( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu, const OUString& rCommandURL, const OUString& aLabel );
91 sal_Bool isContextSensitiveToolbarNonVisible();
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 OUString m_aModuleIdentifier;
98 OUString m_aPropUIName;
99 OUString m_aPropResourceURL;
100 sal_Bool m_bModuleIdentified;
101 sal_Bool m_bResetActive;
102 std::vector< OUString > m_aCommandVector;
103 IntlWrapper m_aIntlWrapper;
107 #endif // __FRAMEWORK_UIELEMENT_TOOLBARSMENUCONTROLLER_HXX_
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */