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_DISPATCH_LOADDISPATCHER_HXX_
25cdf0e10cSrcweir #define __FRAMEWORK_DISPATCH_LOADDISPATCHER_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_______________________________________________
28cdf0e10cSrcweir // my own includes
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <loadenv/loadenv.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir //_______________________________________________
33cdf0e10cSrcweir // interface includes
34cdf0e10cSrcweir #include <com/sun/star/frame/XNotifyingDispatch.hpp>
35cdf0e10cSrcweir #include <com/sun/star/frame/XSynchronousDispatch.hpp>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir //_______________________________________________
38cdf0e10cSrcweir // other includes
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir //_______________________________________________
43cdf0e10cSrcweir // namespace
44cdf0e10cSrcweir 
45cdf0e10cSrcweir namespace framework{
46cdf0e10cSrcweir 
47cdf0e10cSrcweir namespace css = ::com::sun::star;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir //_______________________________________________
50cdf0e10cSrcweir // exported const
51cdf0e10cSrcweir 
52cdf0e10cSrcweir //_______________________________________________
53cdf0e10cSrcweir // exported definitions
54cdf0e10cSrcweir 
55cdf0e10cSrcweir /** @short      implements a dispatch object which can be used to load
56cdf0e10cSrcweir                 non-visible components (by using the mechanism of ContentHandler)
57cdf0e10cSrcweir                 or visible-components (by using the mechanism of FrameLoader).
58cdf0e10cSrcweir 
59cdf0e10cSrcweir     @author     as96863
60cdf0e10cSrcweir  */
61cdf0e10cSrcweir class LoadDispatcher : private ThreadHelpBase
62cdf0e10cSrcweir                      , public  ::cppu::WeakImplHelper2< css::frame::XNotifyingDispatch,          // => XDispatch => XInterface
63cdf0e10cSrcweir                                                         css::frame::XSynchronousDispatch >
64cdf0e10cSrcweir {
65cdf0e10cSrcweir     //___________________________________________
66cdf0e10cSrcweir     // member
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     private:
69cdf0e10cSrcweir 
70cdf0e10cSrcweir         /** @short  can be used to create own needed services on demand. */
71cdf0e10cSrcweir         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir         /** @short  TODO document me */
74cdf0e10cSrcweir         css::uno::WeakReference< css::frame::XFrame > m_xOwnerFrame;
75cdf0e10cSrcweir 
76cdf0e10cSrcweir         /** @short  TODO document me */
77cdf0e10cSrcweir         ::rtl::OUString m_sTarget;
78cdf0e10cSrcweir 
79cdf0e10cSrcweir         /** @short  TODO document me */
80cdf0e10cSrcweir         sal_Int32 m_nSearchFlags;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir         /** @short  TODO document me */
83cdf0e10cSrcweir         LoadEnv m_aLoader;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     //___________________________________________
86cdf0e10cSrcweir     // native interface
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     public:
89cdf0e10cSrcweir 
90cdf0e10cSrcweir         /** @short  creates a new instance and initialize it with all neccessary parameters.
91cdf0e10cSrcweir 
92cdf0e10cSrcweir             @descr  Every instance of such LoadDispatcher can be used for the specified context only.
93cdf0e10cSrcweir                     That means: It can be used to load any further requested content into tzhe here(!)
94cdf0e10cSrcweir                     specified target frame.
95cdf0e10cSrcweir 
96cdf0e10cSrcweir             @param  xSMGR
97cdf0e10cSrcweir                     will be used to create own needed services on demand.
98cdf0e10cSrcweir 
99cdf0e10cSrcweir             @param  xOwnerFrame
100cdf0e10cSrcweir                     used as startpoit to locate the right target frame.
101cdf0e10cSrcweir 
102cdf0e10cSrcweir             @param  sTargetName
103cdf0e10cSrcweir                     the name or the target frame for loading or a special qualifier
104cdf0e10cSrcweir                     which define such target.
105cdf0e10cSrcweir 
106cdf0e10cSrcweir             @param  nSearchFlags
107cdf0e10cSrcweir                     used in case sTargetFrame isnt a special one.
108cdf0e10cSrcweir          */
109cdf0e10cSrcweir         LoadDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR       ,
110cdf0e10cSrcweir                        const css::uno::Reference< css::frame::XFrame >&              xOwnerFrame ,
111cdf0e10cSrcweir                        const ::rtl::OUString                                         sTargetName ,
112cdf0e10cSrcweir                              sal_Int32                                               nSearchFlags);
113cdf0e10cSrcweir 
114cdf0e10cSrcweir         //_______________________________________
115cdf0e10cSrcweir 
116cdf0e10cSrcweir         /** @short  used to free internal resources.
117cdf0e10cSrcweir          */
118cdf0e10cSrcweir         virtual ~LoadDispatcher();
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     //___________________________________________
121cdf0e10cSrcweir     // uno interface
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     public:
124cdf0e10cSrcweir 
125cdf0e10cSrcweir         // XNotifyingDispatch
126cdf0e10cSrcweir         virtual void SAL_CALL dispatchWithNotification(const css::util::URL&                                             aURL      ,
127cdf0e10cSrcweir                                                        const css::uno::Sequence< css::beans::PropertyValue >&            lArguments,
128cdf0e10cSrcweir                                                        const css::uno::Reference< css::frame::XDispatchResultListener >& xListener )
129cdf0e10cSrcweir             throw(css::uno::RuntimeException);
130cdf0e10cSrcweir 
131cdf0e10cSrcweir         // XDispatch
132cdf0e10cSrcweir         virtual void SAL_CALL dispatch(const css::util::URL&                                  aURL      ,
133cdf0e10cSrcweir                                        const css::uno::Sequence< css::beans::PropertyValue >& lArguments)
134cdf0e10cSrcweir             throw(css::uno::RuntimeException);
135cdf0e10cSrcweir 
136cdf0e10cSrcweir         virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener,
137cdf0e10cSrcweir                                                 const css::util::URL&                                     aURL     )
138cdf0e10cSrcweir             throw(css::uno::RuntimeException);
139cdf0e10cSrcweir 
140cdf0e10cSrcweir         virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener,
141cdf0e10cSrcweir                                                    const css::util::URL&                                     aURL     )
142cdf0e10cSrcweir             throw(css::uno::RuntimeException);
143cdf0e10cSrcweir 
144cdf0e10cSrcweir         // XSynchronousDispatch
145cdf0e10cSrcweir         virtual css::uno::Any SAL_CALL dispatchWithReturnValue( const css::util::URL&                                  aURL      ,
146cdf0e10cSrcweir                                                                 const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
147cdf0e10cSrcweir             throw( css::uno::RuntimeException );
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     private:
150cdf0e10cSrcweir         css::uno::Any impl_dispatch( const css::util::URL& rURL,
151cdf0e10cSrcweir                                      const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
152cdf0e10cSrcweir                                      const css::uno::Reference< css::frame::XDispatchResultListener >& xListener );
153cdf0e10cSrcweir }; // class LoadDispatcher
154cdf0e10cSrcweir 
155cdf0e10cSrcweir } // namespace framework
156cdf0e10cSrcweir 
157cdf0e10cSrcweir #endif // #ifndef __FRAMEWORK_DISPATCH_LOADDISPATCHER_HXX_
158