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 __FRAMEWORK_DISPATCH_CREATEDISPATCHER_HXX_ 29 #define __FRAMEWORK_DISPATCH_CREATEDISPATCHER_HXX_ 30 31 //_________________________________________________________________________________________________________________ 32 // my own includes 33 //_________________________________________________________________________________________________________________ 34 35 #include <dispatch/basedispatcher.hxx> 36 37 //_________________________________________________________________________________________________________________ 38 // interface includes 39 //_________________________________________________________________________________________________________________ 40 41 //_________________________________________________________________________________________________________________ 42 // other includes 43 //_________________________________________________________________________________________________________________ 44 45 //_________________________________________________________________________________________________________________ 46 // namespace 47 //_________________________________________________________________________________________________________________ 48 49 namespace framework{ 50 51 //_________________________________________________________________________________________________________________ 52 // exported const 53 //_________________________________________________________________________________________________________________ 54 55 //_________________________________________________________________________________________________________________ 56 // exported definitions 57 //_________________________________________________________________________________________________________________ 58 59 /*-************************************************************************************************************//** 60 @short helper to create new frames by using non special target name and CREATE flag 61 @descr If user whish to find any frame by name or will create it, if it not already exist ... 62 these dispatch helper should be used. Because - a frame must be created at dispatch call ... 63 not on queryDispatch()! So we hold weakreferences to the possible parent frame, safe the name 64 of new frame. If user call dispatch at us - we check a weakreference to our last created frame 65 (he should have same name!) ... if he exist - we do nothing ... if not - we create it again. 66 But if possible parent for new created task doesn't exist - we couldn't do anything! 67 Then we wait for our own dispose and do nothing. 68 69 @attention Use this class as member only! Never use it as baseclass. 70 XInterface will be ambigous and we hold a weakreference to ouer OWNER - not to ouer SUPERCLASS! 71 72 @implements XInterface 73 XDispatch 74 XStatusListener 75 XLoadEventListener 76 XEventListener 77 78 @base BaseDispatcher 79 80 @devstatus ready to use 81 @threadsafe yes 82 *//*-*************************************************************************************************************/ 83 class CreateDispatcher : // -interfaces ... are supported by our BaseDispatcher! 84 // -baseclasses ... order is neccessary for right initialization! 85 public BaseDispatcher 86 { 87 //------------------------------------------------------------------------------------------------------------- 88 // public methods 89 //------------------------------------------------------------------------------------------------------------- 90 public: 91 // ctor 92 CreateDispatcher ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , 93 const css::uno::Reference< css::frame::XFrame >& xParent , 94 const rtl::OUString& sName ); 95 // XDispatch 96 virtual void SAL_CALL dispatch ( const css::util::URL& aURL , 97 const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); 98 99 //------------------------------------------------------------------------------------------------------------- 100 // protected methods 101 //------------------------------------------------------------------------------------------------------------- 102 protected: 103 virtual void SAL_CALL reactForLoadingState ( const css::util::URL& aURL , 104 const css::uno::Sequence< css::beans::PropertyValue >& lDescriptor , 105 const css::uno::Reference< css::frame::XFrame >& xTarget , 106 sal_Bool bState , 107 const css::uno::Any& aAsyncInfo = css::uno::Any() ); 108 109 virtual void SAL_CALL reactForHandlingState( const css::util::URL& aURL , 110 const css::uno::Sequence< css::beans::PropertyValue >& lDescriptor , 111 sal_Bool bState , 112 const css::uno::Any& aAsyncInfo = css::uno::Any() ) 113 { LOG_WARNING( "CreateDispatcher::reactForHandlingState()", "Who call this function! It's a non used pure virtual function overload ..." ) } 114 115 //------------------------------------------------------------------------------------------------------------- 116 // variables 117 // (should be private everyway!) 118 //------------------------------------------------------------------------------------------------------------- 119 private: 120 css::uno::WeakReference< css::frame::XFrame > m_xTarget ; /// new created frame (Don't hold hard reference ... target frame couldn't die then!) 121 ::rtl::OUString m_sTargetName ; /// name of new created frame 122 123 }; // class CreateDispatcher 124 125 } // namespace framework 126 127 #endif // #ifndef __FRAMEWORK_DISPATCH_CREATEDISPATCHER_HXX_ 128