Update ooo320-m1
[ooovba.git] / framework / inc / dispatch / createdispatcher.hxx
blobfbd7b05696fdfd095b9a570292dfe152f0424f89
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: createdispatcher.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __FRAMEWORK_DISPATCH_CREATEDISPATCHER_HXX_
32 #define __FRAMEWORK_DISPATCH_CREATEDISPATCHER_HXX_
34 //_________________________________________________________________________________________________________________
35 // my own includes
36 //_________________________________________________________________________________________________________________
38 #include <dispatch/basedispatcher.hxx>
40 //_________________________________________________________________________________________________________________
41 // interface includes
42 //_________________________________________________________________________________________________________________
44 //_________________________________________________________________________________________________________________
45 // other includes
46 //_________________________________________________________________________________________________________________
48 //_________________________________________________________________________________________________________________
49 // namespace
50 //_________________________________________________________________________________________________________________
52 namespace framework{
54 //_________________________________________________________________________________________________________________
55 // exported const
56 //_________________________________________________________________________________________________________________
58 //_________________________________________________________________________________________________________________
59 // exported definitions
60 //_________________________________________________________________________________________________________________
62 /*-************************************************************************************************************//**
63 @short helper to create new frames by using non special target name and CREATE flag
64 @descr If user whish to find any frame by name or will create it, if it not already exist ...
65 these dispatch helper should be used. Because - a frame must be created at dispatch call ...
66 not on queryDispatch()! So we hold weakreferences to the possible parent frame, safe the name
67 of new frame. If user call dispatch at us - we check a weakreference to our last created frame
68 (he should have same name!) ... if he exist - we do nothing ... if not - we create it again.
69 But if possible parent for new created task doesn't exist - we couldn't do anything!
70 Then we wait for our own dispose and do nothing.
72 @attention Use this class as member only! Never use it as baseclass.
73 XInterface will be ambigous and we hold a weakreference to ouer OWNER - not to ouer SUPERCLASS!
75 @implements XInterface
76 XDispatch
77 XStatusListener
78 XLoadEventListener
79 XEventListener
81 @base BaseDispatcher
83 @devstatus ready to use
84 @threadsafe yes
85 *//*-*************************************************************************************************************/
86 class CreateDispatcher : // -interfaces ... are supported by our BaseDispatcher!
87 // -baseclasses ... order is neccessary for right initialization!
88 public BaseDispatcher
90 //-------------------------------------------------------------------------------------------------------------
91 // public methods
92 //-------------------------------------------------------------------------------------------------------------
93 public:
94 // ctor
95 CreateDispatcher ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ,
96 const css::uno::Reference< css::frame::XFrame >& xParent ,
97 const rtl::OUString& sName );
98 // XDispatch
99 virtual void SAL_CALL dispatch ( const css::util::URL& aURL ,
100 const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException );
102 //-------------------------------------------------------------------------------------------------------------
103 // protected methods
104 //-------------------------------------------------------------------------------------------------------------
105 protected:
106 virtual void SAL_CALL reactForLoadingState ( const css::util::URL& aURL ,
107 const css::uno::Sequence< css::beans::PropertyValue >& lDescriptor ,
108 const css::uno::Reference< css::frame::XFrame >& xTarget ,
109 sal_Bool bState ,
110 const css::uno::Any& aAsyncInfo = css::uno::Any() );
112 virtual void SAL_CALL reactForHandlingState( const css::util::URL& aURL ,
113 const css::uno::Sequence< css::beans::PropertyValue >& lDescriptor ,
114 sal_Bool bState ,
115 const css::uno::Any& aAsyncInfo = css::uno::Any() )
116 { LOG_WARNING( "CreateDispatcher::reactForHandlingState()", "Who call this function! It's a non used pure virtual function overload ..." ) }
118 //-------------------------------------------------------------------------------------------------------------
119 // variables
120 // (should be private everyway!)
121 //-------------------------------------------------------------------------------------------------------------
122 private:
123 css::uno::WeakReference< css::frame::XFrame > m_xTarget ; /// new created frame (Don't hold hard reference ... target frame couldn't die then!)
124 ::rtl::OUString m_sTargetName ; /// name of new created frame
126 }; // class CreateDispatcher
128 } // namespace framework
130 #endif // #ifndef __FRAMEWORK_DISPATCH_CREATEDISPATCHER_HXX_