Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : : #ifndef INCLUDED_SFX_HELPINTERCEPTOR_HXX
20 : : #define INCLUDED_SFX_HELPINTERCEPTOR_HXX
21 : :
22 : : #include <cppuhelper/implbase3.hxx>
23 : : #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
24 : : #include <com/sun/star/frame/XInterceptorInfo.hpp>
25 : : #include <com/sun/star/frame/XDispatch.hpp>
26 : : #include <com/sun/star/frame/XDispatchProviderInterception.hpp>
27 : : #include <com/sun/star/frame/XFrame.hpp>
28 : : #include <cppuhelper/implbase1.hxx>
29 : : #include <com/sun/star/frame/XStatusListener.hpp>
30 : : #include <tools/string.hxx>
31 : : #include <tools/link.hxx>
32 : : #include <vector>
33 : :
34 : 0 : struct HelpHistoryEntry_Impl
35 : : {
36 : : String aURL;
37 : : com::sun::star::uno::Any aViewData;
38 : :
39 : 0 : HelpHistoryEntry_Impl( const String& rURL, const com::sun::star::uno::Any& rViewData ) :
40 : 0 : aURL( rURL ), aViewData(rViewData) {}
41 : : };
42 : :
43 : : typedef ::std::vector< HelpHistoryEntry_Impl* > HelpHistoryList_Impl;
44 : :
45 : : class SfxHelpWindow_Impl;
46 : : class HelpInterceptor_Impl : public ::cppu::WeakImplHelper3<
47 : :
48 : : ::com::sun::star::frame::XDispatchProviderInterceptor,
49 : : ::com::sun::star::frame::XInterceptorInfo,
50 : : ::com::sun::star::frame::XDispatch >
51 : :
52 : : {
53 : : private:
54 : : friend class HelpDispatch_Impl;
55 : : friend class SfxHelpWindow_Impl;
56 : :
57 : : // the component which's dispatches we're intercepting
58 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception > m_xIntercepted;
59 : :
60 : : // chaining
61 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xSlaveDispatcher;
62 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xMasterDispatcher;
63 : :
64 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > m_xListener;
65 : :
66 : : HelpHistoryList_Impl* m_pHistory;
67 : : SfxHelpWindow_Impl* m_pWindow;
68 : : sal_uIntPtr m_nCurPos;
69 : : String m_aCurrentURL;
70 : : com::sun::star::uno::Any m_aViewData;
71 : :
72 : : void addURL( const String& rURL );
73 : :
74 : : public:
75 : : HelpInterceptor_Impl();
76 : : ~HelpInterceptor_Impl();
77 : :
78 : : void setInterception( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame );
79 : 0 : String GetCurrentURL() const { return m_aCurrentURL; }
80 : :
81 : :
82 : :
83 : 0 : const com::sun::star::uno::Any& GetViewData()const {return m_aViewData;}
84 : :
85 : : sal_Bool HasHistoryPred() const; // is there a predecessor for the current in the history
86 : : sal_Bool HasHistorySucc() const; // is there a successor for the current in the history
87 : :
88 : : // XDispatchProvider
89 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL
90 : : queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw(::com::sun::star::uno::RuntimeException);
91 : : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL
92 : : queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw(::com::sun::star::uno::RuntimeException);
93 : :
94 : : // XDispatchProviderInterceptor
95 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL
96 : : getSlaveDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException);
97 : : virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSlave ) throw(::com::sun::star::uno::RuntimeException);
98 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL
99 : : getMasterDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException);
100 : : virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewMaster ) throw(::com::sun::star::uno::RuntimeException);
101 : :
102 : : // XInterceptorInfo
103 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
104 : : getInterceptedURLs( ) throw(::com::sun::star::uno::RuntimeException);
105 : :
106 : : // XDispatch
107 : : virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw(::com::sun::star::uno::RuntimeException);
108 : : virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw(::com::sun::star::uno::RuntimeException);
109 : : virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw(::com::sun::star::uno::RuntimeException);
110 : :
111 : : // extras
112 : 0 : void InitWaiter( SfxHelpWindow_Impl* pWindow )
113 : 0 : { m_pWindow = pWindow; }
114 : 0 : SfxHelpWindow_Impl* GetHelpWindow() const { return m_pWindow; }
115 : : };
116 : :
117 : : // HelpListener_Impl -----------------------------------------------------
118 : :
119 [ # # ][ # # ]: 0 : class HelpListener_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XStatusListener >
120 : : {
121 : : private:
122 : : HelpInterceptor_Impl* pInterceptor;
123 : : Link aChangeLink;
124 : : String aFactory;
125 : :
126 : : public:
127 : : HelpListener_Impl( HelpInterceptor_Impl* pInter );
128 : :
129 : : virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event )
130 : : throw( ::com::sun::star::uno::RuntimeException );
131 : : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& obj )
132 : : throw( ::com::sun::star::uno::RuntimeException );
133 : :
134 : 0 : void SetChangeHdl( const Link& rLink ) { aChangeLink = rLink; }
135 : 0 : String GetFactory() const { return aFactory; }
136 : : };
137 : : // HelpStatusListener_Impl -----------------------------------------------------
138 : :
139 : : class HelpStatusListener_Impl : public
140 : : ::cppu::WeakImplHelper1< ::com::sun::star::frame::XStatusListener >
141 : : {
142 : : private:
143 : : ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > xDispatch;
144 : : ::com::sun::star::frame::FeatureStateEvent aStateEvent;
145 : :
146 : : public:
147 : : HelpStatusListener_Impl(
148 : : ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > xDispatch,
149 : : com::sun::star::util::URL& rURL);
150 : : ~HelpStatusListener_Impl();
151 : :
152 : : virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event )
153 : : throw( ::com::sun::star::uno::RuntimeException );
154 : : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& obj )
155 : : throw( ::com::sun::star::uno::RuntimeException );
156 : : const ::com::sun::star::frame::FeatureStateEvent&
157 : 0 : GetStateEvent() const {return aStateEvent;}
158 : : };
159 : :
160 : :
161 : : #endif // #ifndef INCLUDED_SFX_HELPINTERCEPTOR_HXX
162 : :
163 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|