1*f8e07b45SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f8e07b45SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f8e07b45SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f8e07b45SAndrew Rist * distributed with this work for additional information 6*f8e07b45SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f8e07b45SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f8e07b45SAndrew Rist * "License"); you may not use this file except in compliance 9*f8e07b45SAndrew Rist * with the License. You may obtain a copy of the License at 10*f8e07b45SAndrew Rist * 11*f8e07b45SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f8e07b45SAndrew Rist * 13*f8e07b45SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f8e07b45SAndrew Rist * software distributed under the License is distributed on an 15*f8e07b45SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f8e07b45SAndrew Rist * KIND, either express or implied. See the License for the 17*f8e07b45SAndrew Rist * specific language governing permissions and limitations 18*f8e07b45SAndrew Rist * under the License. 19*f8e07b45SAndrew Rist * 20*f8e07b45SAndrew Rist *************************************************************/ 21*f8e07b45SAndrew Rist 22*f8e07b45SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef __FRAMEWORK_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX_ 25cdf0e10cSrcweir #define __FRAMEWORK_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/util/URL.hpp> 28cdf0e10cSrcweir #include <com/sun/star/beans/NamedValue.hpp> 29cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp> 30cdf0e10cSrcweir #include <com/sun/star/frame/ControlCommand.hpp> 31cdf0e10cSrcweir #include <com/sun/star/frame/XControlNotificationListener.hpp> 32cdf0e10cSrcweir 33cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 34cdf0e10cSrcweir // includes of other projects 35cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 36cdf0e10cSrcweir #include <svtools/toolboxcontroller.hxx> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include <vcl/toolbox.hxx> 39cdf0e10cSrcweir 40cdf0e10cSrcweir namespace framework 41cdf0e10cSrcweir { 42cdf0e10cSrcweir 43cdf0e10cSrcweir struct ExecuteInfo 44cdf0e10cSrcweir { 45cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; 46cdf0e10cSrcweir ::com::sun::star::util::URL aTargetURL; 47cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs; 48cdf0e10cSrcweir }; 49cdf0e10cSrcweir 50cdf0e10cSrcweir struct NotifyInfo 51cdf0e10cSrcweir { 52cdf0e10cSrcweir ::rtl::OUString aEventName; 53cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XControlNotificationListener > xNotifyListener; 54cdf0e10cSrcweir ::com::sun::star::util::URL aSourceURL; 55cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > aInfoSeq; 56cdf0e10cSrcweir }; 57cdf0e10cSrcweir 58cdf0e10cSrcweir class ToolBar; 59cdf0e10cSrcweir 60cdf0e10cSrcweir class ComplexToolbarController : public svt::ToolboxController 61cdf0e10cSrcweir 62cdf0e10cSrcweir { 63cdf0e10cSrcweir public: 64cdf0e10cSrcweir ComplexToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, 65cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, 66cdf0e10cSrcweir ToolBox* pToolBar, 67cdf0e10cSrcweir sal_uInt16 nID, 68cdf0e10cSrcweir const rtl::OUString& aCommand ); 69cdf0e10cSrcweir virtual ~ComplexToolbarController(); 70cdf0e10cSrcweir 71cdf0e10cSrcweir // XComponent 72cdf0e10cSrcweir virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); 73cdf0e10cSrcweir 74cdf0e10cSrcweir // XToolbarController 75cdf0e10cSrcweir virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException); 76cdf0e10cSrcweir 77cdf0e10cSrcweir // XStatusListener 78cdf0e10cSrcweir virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); 79cdf0e10cSrcweir 80cdf0e10cSrcweir DECL_STATIC_LINK( ComplexToolbarController, ExecuteHdl_Impl, ExecuteInfo* ); 81cdf0e10cSrcweir DECL_STATIC_LINK( ComplexToolbarController, Notify_Impl, NotifyInfo* ); 82cdf0e10cSrcweir 83cdf0e10cSrcweir protected: 84cdf0e10cSrcweir static sal_Int32 getFontSizePixel( const Window* pWindow ); 85cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > getDispatchFromCommand( const rtl::OUString& aCommand ) const; 86cdf0e10cSrcweir void addNotifyInfo( const ::rtl::OUString& aEventName, 87cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& xDispatch, 88cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rInfo ); 89cdf0e10cSrcweir 90cdf0e10cSrcweir virtual void executeControlCommand( const ::com::sun::star::frame::ControlCommand& rControlCommand ) = 0; 91cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> getExecuteArgs(sal_Int16 KeyModifier) const; 92cdf0e10cSrcweir const ::com::sun::star::util::URL& getInitializedURL(); 93cdf0e10cSrcweir void notifyFocusGet(); 94cdf0e10cSrcweir void notifyFocusLost(); 95cdf0e10cSrcweir void notifyTextChanged( const ::rtl::OUString& aText ); 96cdf0e10cSrcweir 97cdf0e10cSrcweir ToolBox* m_pToolbar; 98cdf0e10cSrcweir sal_uInt16 m_nID; 99cdf0e10cSrcweir sal_Bool m_bMadeInvisible; 100cdf0e10cSrcweir mutable ::com::sun::star::util::URL m_aURL; 101cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; 102cdf0e10cSrcweir }; 103cdf0e10cSrcweir 104cdf0e10cSrcweir } 105cdf0e10cSrcweir 106cdf0e10cSrcweir #endif // __FRAMEWORK_UIELEMENT_COMPLEXTOOLBARCONTROLLER_HXX_ 107