1f8e07b45SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f8e07b45SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f8e07b45SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f8e07b45SAndrew Rist * distributed with this work for additional information 6f8e07b45SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f8e07b45SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f8e07b45SAndrew Rist * "License"); you may not use this file except in compliance 9f8e07b45SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11f8e07b45SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13f8e07b45SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f8e07b45SAndrew Rist * software distributed under the License is distributed on an 15f8e07b45SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f8e07b45SAndrew Rist * KIND, either express or implied. See the License for the 17f8e07b45SAndrew Rist * specific language governing permissions and limitations 18f8e07b45SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20f8e07b45SAndrew Rist *************************************************************/ 21f8e07b45SAndrew Rist 22f8e07b45SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef __FRAMEWORK_DISPATCH_DISPATCHPROVIDER_HXX_ 25cdf0e10cSrcweir #define __FRAMEWORK_DISPATCH_DISPATCHPROVIDER_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 28cdf0e10cSrcweir // my own includes 29cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <services/frame.hxx> 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include <classes/protocolhandlercache.hxx> 34cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx> 35cdf0e10cSrcweir 36cdf0e10cSrcweir #ifndef __FRAMEWORK_THREADHELP_TRANSACTIONBASE_HXX_ 37cdf0e10cSrcweir #include <threadhelp/transactionbase.hxx> 38cdf0e10cSrcweir #endif 39cdf0e10cSrcweir #include <macros/xinterface.hxx> 40cdf0e10cSrcweir #include <macros/xtypeprovider.hxx> 41cdf0e10cSrcweir #include <macros/debug.hxx> 42cdf0e10cSrcweir #include <macros/generic.hxx> 43cdf0e10cSrcweir #include <stdtypes.h> 44cdf0e10cSrcweir 45cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 46cdf0e10cSrcweir // interface includes 47cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 48cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp> 49cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp> 50cdf0e10cSrcweir #include <com/sun/star/util/URL.hpp> 51cdf0e10cSrcweir #include <com/sun/star/frame/DispatchDescriptor.hpp> 52cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 53cdf0e10cSrcweir 54cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 55cdf0e10cSrcweir // other includes 56cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 57cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 58cdf0e10cSrcweir #include <cppuhelper/weakref.hxx> 59cdf0e10cSrcweir 60cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 61cdf0e10cSrcweir // namespace 62cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 63cdf0e10cSrcweir 64cdf0e10cSrcweir namespace framework{ 65cdf0e10cSrcweir 66cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 67cdf0e10cSrcweir 68cdf0e10cSrcweir /** 6907a3d7f1SPedro Giffuni @descr We know some special dispatch objects with different functionality. 70*a49f1911Smseidel They can be created internally by the following DispatchProvider. 71cdf0e10cSrcweir Here we define some identifier to force creation of the right one. 72cdf0e10cSrcweir */ 73cdf0e10cSrcweir enum EDispatchHelper 74cdf0e10cSrcweir { 75cdf0e10cSrcweir E_DEFAULTDISPATCHER , 76cdf0e10cSrcweir E_MENUDISPATCHER , 77cdf0e10cSrcweir E_HELPAGENTDISPATCHER , 78cdf0e10cSrcweir E_CREATEDISPATCHER , 79cdf0e10cSrcweir E_BLANKDISPATCHER , 80cdf0e10cSrcweir E_SELFDISPATCHER , 81cdf0e10cSrcweir E_CLOSEDISPATCHER , 82cdf0e10cSrcweir E_STARTMODULEDISPATCHER 83cdf0e10cSrcweir }; 84cdf0e10cSrcweir 85cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 86cdf0e10cSrcweir 87cdf0e10cSrcweir /** 88cdf0e10cSrcweir @short implement a helper for XDispatchProvider interface 89cdf0e10cSrcweir @descr The result of a queryDispatch() call depends from the owner, which use an instance of this class. 90cdf0e10cSrcweir (frame, desktop) All of them must provides different functionality. 91cdf0e10cSrcweir E.g: - task can be created by the desktop only 92cdf0e10cSrcweir - a task can have a beamer as direct child 93cdf0e10cSrcweir - a normal frame never can create a new one by himself 94cdf0e10cSrcweir 95cdf0e10cSrcweir @attention Use this class as member only! Never use it as baseclass. 96cdf0e10cSrcweir XInterface will be ambigous and we hold a weakreference to ouer OWNER - not to ouer SUPERCLASS! 97cdf0e10cSrcweir 98cdf0e10cSrcweir @base ThreadHelpBase 99cdf0e10cSrcweir supports threadsafe mechanism 100cdf0e10cSrcweir @base OWeakObject 101cdf0e10cSrcweir provides ref count and weak mechanism 102cdf0e10cSrcweir 103cdf0e10cSrcweir @devstatus ready to use 104cdf0e10cSrcweir @threadsafe yes 105cdf0e10cSrcweir @modified 17.05.2002 07:56, as96863 106cdf0e10cSrcweir */ 107cdf0e10cSrcweir class DispatchProvider : // interfaces 108cdf0e10cSrcweir public css::lang::XTypeProvider , 109cdf0e10cSrcweir public css::frame::XDispatchProvider , 110cdf0e10cSrcweir // baseclasses 11107a3d7f1SPedro Giffuni // Order is necessary for right initialization! 112cdf0e10cSrcweir private ThreadHelpBase , 113cdf0e10cSrcweir private TransactionBase , 114cdf0e10cSrcweir public ::cppu::OWeakObject 115cdf0e10cSrcweir { 116cdf0e10cSrcweir /* member */ 117cdf0e10cSrcweir private: 118cdf0e10cSrcweir /// reference to global service manager to create new services 119cdf0e10cSrcweir css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; 120cdf0e10cSrcweir /// weakreference to owner frame (Don't use a hard reference. Owner can't delete us then!) 121cdf0e10cSrcweir css::uno::WeakReference< css::frame::XFrame > m_xFrame; 122cdf0e10cSrcweir /// different dispatcher to handle special dispatch calls, protocols or URLs (they will be created on demand.) 123cdf0e10cSrcweir css::uno::Reference< css::frame::XDispatch > m_xMenuDispatcher ; 124cdf0e10cSrcweir css::uno::Reference< css::frame::XDispatch > m_xHelpAgentDispatcher; 125cdf0e10cSrcweir /* css::uno::Reference< css::frame::XDispatch > m_xBlankDispatcher ; 126cdf0e10cSrcweir css::uno::Reference< css::frame::XDispatch > m_xSelfDispatcher ; 127cdf0e10cSrcweir css::uno::Reference< css::frame::XDispatch > m_xDefaultDispatcher ;*/ 128cdf0e10cSrcweir /// cache of some other dispatch provider which are registered inside configuration to handle special URL protocols 129cdf0e10cSrcweir HandlerCache m_aProtocolHandlerCache; 130cdf0e10cSrcweir 131cdf0e10cSrcweir /* interface */ 132cdf0e10cSrcweir public: 133cdf0e10cSrcweir FWK_DECLARE_XINTERFACE 134cdf0e10cSrcweir FWK_DECLARE_XTYPEPROVIDER 135cdf0e10cSrcweir 136cdf0e10cSrcweir DispatchProvider( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , 137cdf0e10cSrcweir const css::uno::Reference< css::frame::XFrame >& xFrame ); 138cdf0e10cSrcweir 139cdf0e10cSrcweir virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL , 140cdf0e10cSrcweir const ::rtl::OUString& sTargetFrameName , 141cdf0e10cSrcweir sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); 142cdf0e10cSrcweir virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptions ) throw( css::uno::RuntimeException ); 143cdf0e10cSrcweir 144cdf0e10cSrcweir /* helper */ 145cdf0e10cSrcweir protected: 146cdf0e10cSrcweir // Let him protected! So nobody can use us as base ... 147cdf0e10cSrcweir virtual ~DispatchProvider(); 148cdf0e10cSrcweir 149cdf0e10cSrcweir private: 150cdf0e10cSrcweir css::uno::Reference< css::frame::XDispatch > implts_getOrCreateDispatchHelper ( EDispatchHelper eHelper , 151cdf0e10cSrcweir const css::uno::Reference< css::frame::XFrame >& xOwner , 152cdf0e10cSrcweir const ::rtl::OUString& sTarget = ::rtl::OUString() , 153cdf0e10cSrcweir sal_Int32 nSearchFlags = 0 ); 154cdf0e10cSrcweir sal_Bool implts_isLoadableContent ( const css::util::URL& aURL ); 155cdf0e10cSrcweir css::uno::Reference< css::frame::XDispatch > implts_queryDesktopDispatch ( const css::uno::Reference< css::frame::XFrame > xDesktop , 156cdf0e10cSrcweir const css::util::URL& aURL , 157cdf0e10cSrcweir const ::rtl::OUString& sTargetFrameName , 158cdf0e10cSrcweir sal_Int32 nSearchFlags ); 159cdf0e10cSrcweir css::uno::Reference< css::frame::XDispatch > implts_queryFrameDispatch ( const css::uno::Reference< css::frame::XFrame > xFrame , 160cdf0e10cSrcweir const css::util::URL& aURL , 161cdf0e10cSrcweir const ::rtl::OUString& sTargetFrameName , 162cdf0e10cSrcweir sal_Int32 nSearchFlags ); 163cdf0e10cSrcweir css::uno::Reference< css::frame::XDispatch > implts_searchProtocolHandler ( const css::util::URL& aURL ); 164cdf0e10cSrcweir 165cdf0e10cSrcweir }; // class DispatchProvider 166cdf0e10cSrcweir 167cdf0e10cSrcweir } // namespace framework 168cdf0e10cSrcweir 169cdf0e10cSrcweir #endif // #ifndef __FRAMEWORK_DISPATCH_DISPATCHPROVIDER_HXX_ 170