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 FORMS_SOURCE_INC_CONTROLFEATUREINTERCEPTION_HXX 25 #define FORMS_SOURCE_INC_CONTROLFEATUREINTERCEPTION_HXX 26 27 /** === begin UNO includes === **/ 28 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 29 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> 30 /** === end UNO includes === **/ 31 32 #include <memory> 33 34 //........................................................................ 35 namespace frm 36 { 37 //........................................................................ 38 39 class UrlTransformer; 40 //==================================================================== 41 //= ControlFeatureInterception 42 //==================================================================== 43 /** helper class for controls which allow some of their features to be intercepted 44 by external instances 45 46 For using this class, instantiate it as member, derive yourself from 47 <type scope="com::sun::star::frame">XDispatchProviderInterception</type>, and forward all 48 respective methods to this member. 49 50 Additionally, don't forget to call <member>dispose</member> when your class is disposed itself. 51 */ 52 class ControlFeatureInterception 53 { 54 private: 55 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > 56 m_xFirstDispatchInterceptor; 57 ::std::auto_ptr< UrlTransformer > m_pUrlTransformer; 58 59 public: 60 /** retrieves our URL transformer, so our clients may use it, too 61 */ getTransformer() const62 const UrlTransformer& getTransformer() const { return *m_pUrlTransformer; } 63 64 public: 65 ControlFeatureInterception( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ); 66 67 // XDispatchProviderInterception 68 void SAL_CALL registerDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException ); 69 void SAL_CALL releaseDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException ); 70 71 // XComponent 72 void SAL_CALL dispose(); 73 74 /** queries the interceptor chain for the given dispatch 75 */ 76 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > 77 queryDispatch( const ::com::sun::star::util::URL& _rURL, const ::rtl::OUString& _rTargetFrameName, ::sal_Int32 _nSearchFlags ) SAL_THROW((::com::sun::star::uno::RuntimeException)); 78 79 /** queries the interceptor chain for the given dispatch, with a blank target frame and no frame search flags 80 */ 81 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > 82 queryDispatch( const ::com::sun::star::util::URL& _rURL ) SAL_THROW((::com::sun::star::uno::RuntimeException)); 83 84 /** queries the interceptor chain for the URL given as ASCII string, 85 with a blank target frame and no frame search flags 86 */ 87 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > 88 queryDispatch( const sal_Char* _pAsciiURL ) SAL_THROW((::com::sun::star::uno::RuntimeException)); 89 }; 90 91 //........................................................................ 92 } // namespace frm 93 //........................................................................ 94 95 #endif // FORMS_SOURCE_INC_CONTROLFEATUREINTERCEPTION_HXX 96 97