Line data Source code
1 : /*
2 : * This file is part of the LibreOffice project.
3 : *
4 : * This Source Code Form is subject to the terms of the Mozilla Public
5 : * License, v. 2.0. If a copy of the MPL was not distributed with this
6 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 : *
8 : * This file incorporates work covered by the following license notice:
9 : *
10 : * Licensed to the Apache Software Foundation (ASF) under one or more
11 : * contributor license agreements. See the NOTICE file distributed
12 : * with this work for additional information regarding copyright
13 : * ownership. The ASF licenses this file to you under the Apache
14 : * License, Version 2.0 (the "License"); you may not use this file
15 : * except in compliance with the License. You may obtain a copy of
16 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 : */
18 : #ifndef __FRAMEWORK_UIELEMENT_POPUPMENU_TOOLBARCONTROLLER_HXX__
19 : #define __FRAMEWORK_UIELEMENT_POPUPMENU_TOOLBARCONTROLLER_HXX__
20 :
21 : #include <com/sun/star/awt/XPopupMenu.hpp>
22 : #include <com/sun/star/frame/XPopupMenuController.hpp>
23 : #include <com/sun/star/frame/XUIControllerFactory.hpp>
24 : #include <com/sun/star/lang/XServiceInfo.hpp>
25 : #include <cppuhelper/implbase1.hxx>
26 : #include <macros/xserviceinfo.hxx>
27 : #include <svtools/toolboxcontroller.hxx>
28 :
29 : namespace framework
30 : {
31 : class PopupMenuToolbarController : public svt::ToolboxController
32 : {
33 : public:
34 : virtual ~PopupMenuToolbarController();
35 :
36 : // XComponent
37 : virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException );
38 : // XInitialization
39 : 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);
40 : // XToolbarController
41 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
42 : // XStatusListener
43 : virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& rEvent ) throw ( ::com::sun::star::uno::RuntimeException );
44 :
45 : protected:
46 : PopupMenuToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
47 : const OUString &rPopupCommand = OUString() );
48 : virtual void functionExecuted( const OUString &rCommand );
49 : virtual sal_uInt16 getDropDownStyle() const;
50 : void createPopupMenuController();
51 :
52 : com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
53 : sal_Bool m_bHasController;
54 : com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu > m_xPopupMenu;
55 :
56 : private:
57 : OUString m_aPopupCommand;
58 : com::sun::star::uno::Reference< com::sun::star::frame::XUIControllerFactory > m_xPopupMenuFactory;
59 : com::sun::star::uno::Reference< com::sun::star::frame::XPopupMenuController > m_xPopupMenuController;
60 : };
61 :
62 202 : class OpenToolbarController : public PopupMenuToolbarController
63 : {
64 : public:
65 : OpenToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
66 :
67 : // XServiceInfo
68 : DECLARE_XSERVICEINFO
69 : };
70 :
71 1280 : class NewToolbarController : public PopupMenuToolbarController
72 : {
73 : public:
74 : NewToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
75 :
76 : // XServiceInfo
77 : DECLARE_XSERVICEINFO
78 : private:
79 : void functionExecuted( const OUString &rCommand );
80 : 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);
81 : void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& rEvent ) throw ( ::com::sun::star::uno::RuntimeException );
82 : void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
83 : void setItemImage( const OUString &rCommand );
84 :
85 : OUString m_aLastURL;
86 : };
87 :
88 0 : class WizardsToolbarController : public PopupMenuToolbarController
89 : {
90 : public:
91 : WizardsToolbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
92 :
93 : // XServiceInfo
94 : DECLARE_XSERVICEINFO
95 : private:
96 : sal_uInt16 getDropDownStyle() const;
97 : };
98 : }
99 :
100 : #endif
|