1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef FORMS_SOURCE_INC_CONTROLFEATUREINTERCEPTION_HXX
29 #define FORMS_SOURCE_INC_CONTROLFEATUREINTERCEPTION_HXX
30 
31 /** === begin UNO includes === **/
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
34 /** === end UNO includes === **/
35 
36 #include <memory>
37 
38 //........................................................................
39 namespace frm
40 {
41 //........................................................................
42 
43     class UrlTransformer;
44 	//====================================================================
45 	//= ControlFeatureInterception
46 	//====================================================================
47     /** helper class for controls which allow some of their features to be intercepted
48         by external instances
49 
50         For using this class, instantiate it as member, derive yourself from
51         <type scope="com::sun::star::frame">XDispatchProviderInterception</type>, and forward all
52         respective methods to this member.
53 
54         Additionally, don't forget to call <member>dispose</member> when your class is disposed itself.
55     */
56 	class ControlFeatureInterception
57 	{
58     private:
59         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >
60                                             m_xFirstDispatchInterceptor;
61         ::std::auto_ptr< UrlTransformer >   m_pUrlTransformer;
62 
63     public:
64         /** retrieves our URL transformer, so our clients may use it, too
65         */
66         const UrlTransformer& getTransformer() const { return *m_pUrlTransformer; }
67 
68     public:
69         ControlFeatureInterception( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
70 
71         // XDispatchProviderInterception
72         void SAL_CALL registerDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException );
73         void SAL_CALL releaseDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException );
74 
75         // XComponent
76         void SAL_CALL dispose();
77 
78         /** queries the interceptor chain for the given dispatch
79         */
80         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >
81             queryDispatch( const ::com::sun::star::util::URL& _rURL, const ::rtl::OUString& _rTargetFrameName, ::sal_Int32 _nSearchFlags ) SAL_THROW((::com::sun::star::uno::RuntimeException));
82 
83         /** queries the interceptor chain for the given dispatch, with a blank target frame and no frame search flags
84         */
85         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >
86             queryDispatch( const ::com::sun::star::util::URL& _rURL ) SAL_THROW((::com::sun::star::uno::RuntimeException));
87 
88         /** queries the interceptor chain for the URL given as ASCII string,
89             with a blank target frame and no frame search flags
90         */
91         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >
92             queryDispatch( const sal_Char* _pAsciiURL ) SAL_THROW((::com::sun::star::uno::RuntimeException));
93 	};
94 
95 //........................................................................
96 } // namespace frm
97 //........................................................................
98 
99 #endif // FORMS_SOURCE_INC_CONTROLFEATUREINTERCEPTION_HXX
100 
101