1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef __FRAMEWORK_DISPATCH_LOADDISPATCHER_HXX_
29*cdf0e10cSrcweir #define __FRAMEWORK_DISPATCH_LOADDISPATCHER_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir //_______________________________________________
32*cdf0e10cSrcweir // my own includes
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #include <loadenv/loadenv.hxx>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir //_______________________________________________
37*cdf0e10cSrcweir // interface includes
38*cdf0e10cSrcweir #include <com/sun/star/frame/XNotifyingDispatch.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/frame/XSynchronousDispatch.hpp>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir //_______________________________________________
42*cdf0e10cSrcweir // other includes
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir //_______________________________________________
47*cdf0e10cSrcweir // namespace
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir namespace framework{
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir namespace css = ::com::sun::star;
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir //_______________________________________________
54*cdf0e10cSrcweir // exported const
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir //_______________________________________________
57*cdf0e10cSrcweir // exported definitions
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir /** @short      implements a dispatch object which can be used to load
60*cdf0e10cSrcweir                 non-visible components (by using the mechanism of ContentHandler)
61*cdf0e10cSrcweir                 or visible-components (by using the mechanism of FrameLoader).
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir     @author     as96863
64*cdf0e10cSrcweir  */
65*cdf0e10cSrcweir class LoadDispatcher : private ThreadHelpBase
66*cdf0e10cSrcweir                      , public  ::cppu::WeakImplHelper2< css::frame::XNotifyingDispatch,          // => XDispatch => XInterface
67*cdf0e10cSrcweir                                                         css::frame::XSynchronousDispatch >
68*cdf0e10cSrcweir {
69*cdf0e10cSrcweir     //___________________________________________
70*cdf0e10cSrcweir     // member
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir     private:
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir         /** @short  can be used to create own needed services on demand. */
75*cdf0e10cSrcweir         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir         /** @short  TODO document me */
78*cdf0e10cSrcweir         css::uno::WeakReference< css::frame::XFrame > m_xOwnerFrame;
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir         /** @short  TODO document me */
81*cdf0e10cSrcweir         ::rtl::OUString m_sTarget;
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir         /** @short  TODO document me */
84*cdf0e10cSrcweir         sal_Int32 m_nSearchFlags;
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir         /** @short  TODO document me */
87*cdf0e10cSrcweir         LoadEnv m_aLoader;
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir     //___________________________________________
90*cdf0e10cSrcweir     // native interface
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir     public:
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir         /** @short  creates a new instance and initialize it with all neccessary parameters.
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir             @descr  Every instance of such LoadDispatcher can be used for the specified context only.
97*cdf0e10cSrcweir                     That means: It can be used to load any further requested content into tzhe here(!)
98*cdf0e10cSrcweir                     specified target frame.
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir             @param  xSMGR
101*cdf0e10cSrcweir                     will be used to create own needed services on demand.
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir             @param  xOwnerFrame
104*cdf0e10cSrcweir                     used as startpoit to locate the right target frame.
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir             @param  sTargetName
107*cdf0e10cSrcweir                     the name or the target frame for loading or a special qualifier
108*cdf0e10cSrcweir                     which define such target.
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir             @param  nSearchFlags
111*cdf0e10cSrcweir                     used in case sTargetFrame isnt a special one.
112*cdf0e10cSrcweir          */
113*cdf0e10cSrcweir         LoadDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR       ,
114*cdf0e10cSrcweir                        const css::uno::Reference< css::frame::XFrame >&              xOwnerFrame ,
115*cdf0e10cSrcweir                        const ::rtl::OUString                                         sTargetName ,
116*cdf0e10cSrcweir                              sal_Int32                                               nSearchFlags);
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir         //_______________________________________
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir         /** @short  used to free internal resources.
121*cdf0e10cSrcweir          */
122*cdf0e10cSrcweir         virtual ~LoadDispatcher();
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir     //___________________________________________
125*cdf0e10cSrcweir     // uno interface
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir     public:
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir         // XNotifyingDispatch
130*cdf0e10cSrcweir         virtual void SAL_CALL dispatchWithNotification(const css::util::URL&                                             aURL      ,
131*cdf0e10cSrcweir                                                        const css::uno::Sequence< css::beans::PropertyValue >&            lArguments,
132*cdf0e10cSrcweir                                                        const css::uno::Reference< css::frame::XDispatchResultListener >& xListener )
133*cdf0e10cSrcweir             throw(css::uno::RuntimeException);
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir         // XDispatch
136*cdf0e10cSrcweir         virtual void SAL_CALL dispatch(const css::util::URL&                                  aURL      ,
137*cdf0e10cSrcweir                                        const css::uno::Sequence< css::beans::PropertyValue >& lArguments)
138*cdf0e10cSrcweir             throw(css::uno::RuntimeException);
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir         virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener,
141*cdf0e10cSrcweir                                                 const css::util::URL&                                     aURL     )
142*cdf0e10cSrcweir             throw(css::uno::RuntimeException);
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir         virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener,
145*cdf0e10cSrcweir                                                    const css::util::URL&                                     aURL     )
146*cdf0e10cSrcweir             throw(css::uno::RuntimeException);
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir         // XSynchronousDispatch
149*cdf0e10cSrcweir         virtual css::uno::Any SAL_CALL dispatchWithReturnValue( const css::util::URL&                                  aURL      ,
150*cdf0e10cSrcweir                                                                 const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
151*cdf0e10cSrcweir             throw( css::uno::RuntimeException );
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir     private:
154*cdf0e10cSrcweir         css::uno::Any impl_dispatch( const css::util::URL& rURL,
155*cdf0e10cSrcweir                                      const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
156*cdf0e10cSrcweir                                      const css::uno::Reference< css::frame::XDispatchResultListener >& xListener );
157*cdf0e10cSrcweir }; // class LoadDispatcher
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir } // namespace framework
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir #endif // #ifndef __FRAMEWORK_DISPATCH_LOADDISPATCHER_HXX_
162