1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef __FRAMEWORK_UIELEMENT_GENERICTOOLBARCONTROLLER_HXX_ 25 #define __FRAMEWORK_UIELEMENT_GENERICTOOLBARCONTROLLER_HXX_ 26 27 //_________________________________________________________________________________________________________________ 28 // includes of other projects 29 //_________________________________________________________________________________________________________________ 30 31 #include <svtools/toolboxcontroller.hxx> 32 #include <vcl/toolbox.hxx> 33 #include <memory> 34 35 class PopupMenu; 36 37 namespace framework 38 { 39 40 struct ExecuteInfo; 41 class ToolBar; 42 class GenericToolbarController : public svt::ToolboxController 43 { 44 public: 45 GenericToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, 46 const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, 47 ToolBox* pToolBar, 48 sal_uInt16 nID, 49 const rtl::OUString& aCommand ); 50 virtual ~GenericToolbarController(); 51 52 // XComponent 53 virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); 54 55 // XToolbarController 56 virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException); 57 58 // XStatusListener 59 virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); 60 61 DECL_STATIC_LINK( GenericToolbarController, ExecuteHdl_Impl, ExecuteInfo* ); 62 63 protected: 64 ToolBox* m_pToolbar; 65 sal_uInt16 m_nID; 66 sal_Bool m_bEnumCommand : 1, 67 m_bMadeInvisible : 1; 68 rtl::OUString m_aEnumCommand; 69 }; 70 71 class MenuToolbarController : public GenericToolbarController 72 { 73 com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_xMenuDesc; 74 PopupMenu* pMenu; 75 com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xMenuManager; 76 rtl::OUString m_aModuleIdentifier; 77 public: 78 MenuToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, 79 const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, 80 ToolBox* pToolBar, 81 sal_uInt16 nID, 82 const rtl::OUString& aCommand, 83 const rtl::OUString& aModuleIdentifier, 84 const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& xMenuDesc ); 85 86 ~MenuToolbarController(); 87 // XToolbarController 88 virtual void SAL_CALL click() throw ( ::com::sun::star::uno::RuntimeException ); 89 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); 90 91 }; 92 93 } 94 95 #endif // __FRAMEWORK_UIELEMENT_GENERICTOOLBARCONTROLLER_HXX_ 96