fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / framework / source / dispatch / dispatchprovider.cxx
blob949b65da5ffaba8a7c822e51906057cf3b28c17a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <stdio.h>
21 #include <dispatch/dispatchprovider.hxx>
22 #include <loadenv/loadenv.hxx>
23 #include <dispatch/loaddispatcher.hxx>
24 #include <dispatch/closedispatcher.hxx>
25 #include <dispatch/menudispatcher.hxx>
26 #include <dispatch/startmoduledispatcher.hxx>
28 #include <pattern/window.hxx>
29 #include <threadhelp/transactionguard.hxx>
30 #include <dispatchcommands.h>
31 #include <protocols.h>
32 #include <services.h>
33 #include <targets.h>
34 #include <general.h>
36 #include <com/sun/star/frame/FrameSearchFlag.hpp>
37 #include <com/sun/star/uno/Exception.hpp>
38 #include <com/sun/star/ucb/XContentProviderManager.hpp>
39 #include <com/sun/star/document/XTypeDetection.hpp>
40 #include <com/sun/star/lang/XInitialization.hpp>
42 #include <osl/diagnose.h>
43 #include <rtl/string.h>
44 #include <rtl/ustring.hxx>
45 #include <vcl/svapp.hxx>
46 #include <rtl/ustrbuf.hxx>
48 namespace framework{
50 /**
51 @short standard ctor/dtor
52 @descr These initialize a new instance of this class with needed information for work.
53 We hold a weakreference to our owner frame which start dispatches at us.
54 We can't use a normal reference because he hold a reference of us too ...
55 nobody can die so ...!
57 @seealso using at owner
59 @param rxContext
60 reference to servicemanager to create new services.
61 @param xFrame
62 reference to our owner frame.
64 DispatchProvider::DispatchProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext ,
65 const css::uno::Reference< css::frame::XFrame >& xFrame )
66 : m_xContext ( rxContext )
67 , m_xFrame ( xFrame )
71 /**
72 @short protected(!) dtor for deinitializing
73 @descr We made it protected to prevent using of us as base class instead as a member.
75 DispatchProvider::~DispatchProvider()
79 /**
80 @interface XDispatchProvider
81 @short search a dispatcher for given URL
82 @descr If no interceptor is set on owner, we search for right frame and dispatch URL to it.
83 If no frame was found, we do nothing.
84 But we don't do it directly here. We detect the type of our owner frame and calls
85 specialized queryDispatch() helper dependen from that. Because a Desktop handle some
86 requests in another way then a normal frame.
88 @param aURL
89 URL to dispatch.
90 @param sTargetFrameName
91 name of searched frame.
92 @param nSearchFlags
93 flags for searching.
94 @return A reference to a dispatch object for this URL (if someone was found!).
96 @threadsafe yes
98 css::uno::Reference< css::frame::XDispatch > SAL_CALL DispatchProvider::queryDispatch( const css::util::URL& aURL ,
99 const OUString& sTargetFrameName ,
100 sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException, std::exception )
102 css::uno::Reference< css::frame::XDispatch > xDispatcher;
104 css::uno::Reference< css::frame::XFrame > xOwner(m_xFrame);
106 css::uno::Reference< css::frame::XDesktop > xDesktopCheck( xOwner, css::uno::UNO_QUERY );
108 if (xDesktopCheck.is())
109 xDispatcher = implts_queryDesktopDispatch(xOwner, aURL, sTargetFrameName, nSearchFlags);
110 else
111 xDispatcher = implts_queryFrameDispatch(xOwner, aURL, sTargetFrameName, nSearchFlags);
113 return xDispatcher;
117 @interface XDispatchProvider
118 @short do the same like queryDispatch() ... but handle multiple dispatches at the same time
119 @descr It's an optimism. User give us a list of queries ... and we return a list of dispatcher.
120 If one of given queries couldn't be solved to a real existing dispatcher ...
121 we return a list with empty references in it! Order of both lists will be retained!
123 @seealso method queryDispatch()
125 @param lDescriptions
126 a list of all dispatch parameters for multiple requests
127 @return A reference a list of dispatch objects for these URLs - may with some <NULL/> values inside.
129 @threadsafe yes
131 css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL DispatchProvider::queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptions ) throw( css::uno::RuntimeException, std::exception )
133 // Create return list - which must have same size then the given descriptor
134 // It's not allowed to pack it!
135 sal_Int32 nCount = lDescriptions.getLength();
136 css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > lDispatcher( nCount );
138 // Step over all descriptors and try to get any dispatcher for it.
139 for( sal_Int32 i=0; i<nCount; ++i )
141 lDispatcher[i] = queryDispatch( lDescriptions[i].FeatureURL ,
142 lDescriptions[i].FrameName ,
143 lDescriptions[i].SearchFlags );
146 return lDispatcher;
149 bool lcl_isStartModuleDispatch (const css::util::URL& aURL)
151 return aURL.Complete == CMD_UNO_SHOWSTARTMODULE;
155 @short helper for queryDispatch()
156 @descr Every member of the frame tree (frame, desktop) must handle such request
157 in another way. So we implement different specialized methods for every one.
159 @threadsafe yes
161 css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryDesktopDispatch( const css::uno::Reference< css::frame::XFrame > xDesktop ,
162 const css::util::URL& aURL ,
163 const OUString& sTargetFrameName ,
164 sal_Int32 nSearchFlags )
166 css::uno::Reference< css::frame::XDispatch > xDispatcher;
168 // ignore wrong requests which are not supported
169 if (
170 (sTargetFrameName==SPECIALTARGET_MENUBAR ) || // valid for frame dispatches - not for desktop
171 (sTargetFrameName==SPECIALTARGET_PARENT ) || // we have no parent by definition
172 (sTargetFrameName==SPECIALTARGET_BEAMER ) // beamer frames are allowed as child of tasks only -
173 // and they exist more than ones. We have no idea which our sub tasks is the right one
176 return NULL;
179 // I) handle special cases which not right for using findFrame() first
181 // I.I) "_blank"
182 // It's not the right place to create a new task here - because we are queried for a dispatch object
183 // only, which can handle such request. Such dispatcher should create the required task on demand.
184 // Normally the functionality for "_blank" is provided by findFrame() - but that would create it directly
185 // here. Thats why we must "intercept" here.
187 if (sTargetFrameName==SPECIALTARGET_BLANK)
189 if (implts_isLoadableContent(aURL))
190 xDispatcher = implts_getOrCreateDispatchHelper( E_BLANKDISPATCHER, xDesktop );
193 // I.II) "_default"
194 // This is a combination of search an empty task for recycling - or create a new one.
196 else if (sTargetFrameName==SPECIALTARGET_DEFAULT)
198 if (implts_isLoadableContent(aURL))
199 xDispatcher = implts_getOrCreateDispatchHelper( E_DEFAULTDISPATCHER, xDesktop );
201 if (lcl_isStartModuleDispatch(aURL))
202 xDispatcher = implts_getOrCreateDispatchHelper( E_STARTMODULEDISPATCHER, xDesktop );
205 // I.III) "_self", "", "_top"
206 // The desktop can't load any document - but he can handle some special protocols like "uno", "slot" ...
207 // Why is "top" here handled too? Because the desktop is the topest frame. Normally it's superflous
208 // to use this target - but we can handle it in the same manner then "_self".
210 else if (
211 (sTargetFrameName==SPECIALTARGET_SELF) ||
212 (sTargetFrameName==SPECIALTARGET_TOP ) ||
213 (sTargetFrameName.isEmpty())
216 xDispatcher = implts_searchProtocolHandler(aURL);
219 // I.IV) no further special targets exist
220 // Now we have to search for the right target frame by calling findFrame() - but should provide our code
221 // against creation of a new task if no frame could be found.
222 // I said it b efore - it's allowed for dispatch() only.
224 else
226 sal_Int32 nRightFlags = nSearchFlags;
227 nRightFlags &= ~css::frame::FrameSearchFlag::CREATE;
229 // try to find any existing target and ask him for his dispatcher
230 css::uno::Reference< css::frame::XFrame > xFoundFrame = xDesktop->findFrame(sTargetFrameName, nRightFlags);
231 if (xFoundFrame.is())
233 css::uno::Reference< css::frame::XDispatchProvider > xProvider( xFoundFrame, css::uno::UNO_QUERY );
234 xDispatcher = xProvider->queryDispatch(aURL,SPECIALTARGET_SELF,0);
236 // if it couldn't be found - but creation was allowed
237 // use special dispatcher for creatio or froward it to the browser
238 else if (nSearchFlags & css::frame::FrameSearchFlag::CREATE)
239 xDispatcher = implts_getOrCreateDispatchHelper( E_CREATEDISPATCHER, xDesktop, sTargetFrameName, nSearchFlags );
242 return xDispatcher;
245 css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryFrameDispatch( const css::uno::Reference< css::frame::XFrame > xFrame ,
246 const css::util::URL& aURL ,
247 const OUString& sTargetFrameName ,
248 sal_Int32 nSearchFlags )
250 css::uno::Reference< css::frame::XDispatch > xDispatcher;
252 // 0) Some URLs are dispatched in a generic way (e.g. by the menu) using the default target "".
253 // But they are specified to use her own fix target. Detect such URLs here and use the correct target.
255 OUString sTargetName = sTargetFrameName;
257 // I) handle special cases which not right for using findFrame() first
259 // I.I) "_blank", "_default"
260 // It's not the right place to create a new task here. Only the desktop can do that.
261 // Normally the functionality for "_blank" is provided by findFrame() - but that would create it directly
262 // here. Thats why we must "intercept" here.
264 if (
265 (sTargetName==SPECIALTARGET_BLANK ) ||
266 (sTargetName==SPECIALTARGET_DEFAULT)
269 css::uno::Reference< css::frame::XDispatchProvider > xParent( xFrame->getCreator(), css::uno::UNO_QUERY );
270 if (xParent.is())
271 xDispatcher = xParent->queryDispatch(aURL, sTargetName, 0); // it's a special target - ignore search flags
274 // I.II) "_menubar"
275 // Special mode on frame or task to receive the local menu. Not supported by findFrame()
277 else if (sTargetName==SPECIALTARGET_MENUBAR)
279 xDispatcher = implts_getOrCreateDispatchHelper( E_MENUDISPATCHER, xFrame );
282 // I.IV) "_beamer"
283 // Special sub frame of a top frame only. Search or create it. ... OK it's currently a little bit HACKI.
284 // Only the sfx (means the controller) can create it.
286 else if (sTargetName==SPECIALTARGET_BEAMER)
288 css::uno::Reference< css::frame::XDispatchProvider > xBeamer( xFrame->findFrame( SPECIALTARGET_BEAMER, css::frame::FrameSearchFlag::CHILDREN | css::frame::FrameSearchFlag::SELF ), css::uno::UNO_QUERY );
289 if (xBeamer.is())
291 xDispatcher = xBeamer->queryDispatch(aURL, SPECIALTARGET_SELF, 0);
293 else
295 css::uno::Reference< css::frame::XDispatchProvider > xController( xFrame->getController(), css::uno::UNO_QUERY );
296 if (xController.is())
297 // force using of special target - but use original search flags
298 // May the caller used the CREATE flag or not!
299 xDispatcher = xController->queryDispatch(aURL, SPECIALTARGET_BEAMER, nSearchFlags);
303 // I.V) "_parent"
304 // Our parent frame (if it exist) should handle this URL.
306 else if (sTargetName==SPECIALTARGET_PARENT)
308 css::uno::Reference< css::frame::XDispatchProvider > xParent( xFrame->getCreator(), css::uno::UNO_QUERY );
309 if (xParent.is())
310 // SELF => we must address the parent directly... and not his parent or any other parent!
311 xDispatcher = xParent->queryDispatch(aURL, SPECIALTARGET_SELF, 0);
314 // I.VI) "_top"
315 // This request must be forwarded to any parent frame, till we reach a top frame.
316 // If no parent exist, we can handle itself.
318 else if (sTargetName==SPECIALTARGET_TOP)
320 if (xFrame->isTop())
322 // If we are this top frame itself (means our owner frame)
323 // we should call ourself recursiv with a better target "_self".
324 // So we can share the same code! (see reaction for "_self" inside this method too.)
325 xDispatcher = this->queryDispatch(aURL,SPECIALTARGET_SELF,0);
327 else
329 css::uno::Reference< css::frame::XDispatchProvider > xParent( xFrame->getCreator(), css::uno::UNO_QUERY );
330 // Normally if isTop() returned sal_False ... the parent frame MUST(!) exist ...
331 // But it seems to be better to check that here to prevent us against an access violation.
332 if (xParent.is())
333 xDispatcher = xParent->queryDispatch(aURL, SPECIALTARGET_TOP, 0);
337 // I.VII) "_self", ""
338 // Our owner frame should handle this URL. But we can't do it for all of them.
339 // So we ask the internal setted controller first. If he disagree we try to find a registered
340 // protocol handler. If this failed too - we check for a loadable content and in case of true
341 // we load it into the frame by returning specilized dispatch object.
343 else if (
344 (sTargetName==SPECIALTARGET_SELF) ||
345 (sTargetName.isEmpty())
348 // There exist a hard coded interception for special URLs.
349 if ( aURL.Complete == ".uno:CloseDoc" || aURL.Complete == ".uno:CloseWin" )
351 css::uno::Reference< css::frame::XDispatchProvider > xParent( xFrame->getCreator(), css::uno::UNO_QUERY );
352 // In case the frame is not a top one, is not based on system window and has a parent,
353 // the parent frame should to be queried for the correct dispatcher.
354 // See i93473
355 if (
356 !WindowHelper::isTopWindow(xFrame->getContainerWindow()) &&
357 !VCLUnoHelper::GetWindow(xFrame->getContainerWindow())->IsSystemWindow() &&
358 xParent.is()
360 xDispatcher = xParent->queryDispatch(aURL, SPECIALTARGET_SELF, 0);
361 else
362 xDispatcher = implts_getOrCreateDispatchHelper( E_CLOSEDISPATCHER, xFrame );
364 else if ( aURL.Complete == ".uno:CloseFrame" )
365 xDispatcher = implts_getOrCreateDispatchHelper( E_CLOSEDISPATCHER, xFrame );
367 if ( ! xDispatcher.is())
369 // Ask our controller for his agreement for these dispatched URL ...
370 // because some URLs are internal and can be handled faster by SFX - which most is the current controller!
371 // But in case of e.g. the bibliography not all queries will be handled successfully here.
372 css::uno::Reference< css::frame::XDispatchProvider > xController( xFrame->getController(), css::uno::UNO_QUERY );
373 if (xController.is())
374 xDispatcher = xController->queryDispatch(aURL, SPECIALTARGET_SELF, 0);
377 // If controller has no fun to dispatch these URL - we must search another right dispatcher.
378 // Search for any registered protocol handler first.
379 if (!xDispatcher.is())
380 xDispatcher = implts_searchProtocolHandler(aURL);
382 // Not for controller - not for protocol handler
383 // It should be a loadable content - may be a file. Check it ...
384 // This check is necessary to found out, that
385 // support for some protocols isn't installed by user. May be
386 // "ftp" isn't available. So we suppress creation of our self dispatcher.
387 // The result will be clear. He can't handle it - but he would try it.
388 if (
389 ( ! xDispatcher.is() ) &&
390 ( implts_isLoadableContent(aURL) )
393 xDispatcher = implts_getOrCreateDispatchHelper( E_SELFDISPATCHER, xFrame );
397 // I.VI) no further special handlings exist
398 // Now we have to search for the right target frame by calling findFrame() - but should provide our code
399 // against creation of a new task if no frame could be found.
400 // I said it before - it's allowed for dispatch() only.
402 else
404 sal_Int32 nRightFlags = nSearchFlags;
405 nRightFlags &= ~css::frame::FrameSearchFlag::CREATE;
407 // try to find any existing target and ask him for his dispatcher
408 css::uno::Reference< css::frame::XFrame > xFoundFrame = xFrame->findFrame(sTargetName, nRightFlags);
409 if (xFoundFrame.is())
411 // Attention: Found target is our own owner frame!
412 // Don't ask him for his dispatcher. We know it already - it's our self dispatch helper.
413 // Otherwhise we can start a never ending recursiv call. Why?
414 // Somewere called our owner frame - he called some interceptor objects - and may by this dispatch provider
415 // is called. If wa use queryDispatch() on our owner frame again - we start this call stack again ... and again.
416 if (xFoundFrame==xFrame)
417 xDispatcher = implts_getOrCreateDispatchHelper( E_SELFDISPATCHER, xFrame );
418 else
420 css::uno::Reference< css::frame::XDispatchProvider > xProvider( xFoundFrame, css::uno::UNO_QUERY );
421 xDispatcher = xProvider->queryDispatch(aURL,SPECIALTARGET_SELF,0);
424 else
425 // if it couldn't be found - but creation was allowed
426 // forward request to the desktop.
427 // Note: The given target name must be used to set the name on new created task!
428 // Don't forward request by changing it to a special one e.g _blank.
429 // Use the CREATE flag only to prevent call against further searches.
430 // We already know it - the target must be created new.
431 if (nSearchFlags & css::frame::FrameSearchFlag::CREATE)
433 css::uno::Reference< css::frame::XDispatchProvider > xParent( xFrame->getCreator(), css::uno::UNO_QUERY );
434 if (xParent.is())
435 xDispatcher = xParent->queryDispatch(aURL, sTargetName, css::frame::FrameSearchFlag::CREATE);
439 return xDispatcher;
443 @short search for a registered protocol handler and ask him for a dispatch object
444 @descr Wes earch a suitable handler inside our cfg package org.openoffice.Office.ProtocolHandler.
445 If we found anyone, we create and initialize it. Initialize means: we set our owner frame on it
446 as context information. He can use it or leave it. Of course - we are aware of handler implementations,
447 which doesn't support initialization. It's an optional feature.
449 @param aURL
450 the dispatch URL for which may a handler is registered
452 @return A dispatch object if a handler was found and agree with the given URL or <NULL/> otherwise.
454 @threadsafe yes
456 css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_searchProtocolHandler( const css::util::URL& aURL )
458 css::uno::Reference< css::frame::XDispatch > xDispatcher;
459 ProtocolHandler aHandler;
461 // This member is threadsafe by himself and lives if we live - we don't need any mutex here.
462 if (m_aProtocolHandlerCache.search(aURL,&aHandler))
464 css::uno::Reference< css::frame::XDispatchProvider > xHandler;
466 SolarMutexGuard g;
468 // create it
471 xHandler = css::uno::Reference< css::frame::XDispatchProvider >(
472 css::uno::Reference<css::lang::XMultiServiceFactory>(m_xContext->getServiceManager(), css::uno::UNO_QUERY_THROW)
473 ->createInstance(aHandler.m_sUNOName),
474 css::uno::UNO_QUERY);
476 catch(const css::uno::Exception&) {}
478 // look if initialization is necessary
479 css::uno::Reference< css::lang::XInitialization > xInit( xHandler, css::uno::UNO_QUERY );
480 if (xInit.is())
482 css::uno::Reference< css::frame::XFrame > xOwner( m_xFrame.get(), css::uno::UNO_QUERY );
483 SAL_WARN_IF(!xOwner.is(), "fwk", "DispatchProvider::implts_searchProtocolHandler(): Couldn't get reference to my owner frame. So I can't set may needed context information for this protocol handler.");
484 if (xOwner.is())
488 // but do it only, if all context information are OK
489 css::uno::Sequence< css::uno::Any > lContext(1);
490 lContext[0] <<= xOwner;
491 xInit->initialize(lContext);
493 catch(const css::uno::Exception&) {}
498 // ask for his (sub)dispatcher for the given URL
499 if (xHandler.is())
500 xDispatcher = xHandler->queryDispatch(aURL,SPECIALTARGET_SELF,0);
503 return xDispatcher;
507 @short get or create new dispatch helper
508 @descr Sometimes we need some helper implementations to support dispatching of special URLs or commands.
509 But it's not a good idea to hold these services for the whole life time of this provider instance.
510 We should create it on demand ...
511 Thats why we implement this method. It return an already existing helper or create a new one otherwise.
513 @attention The parameter sTarget and nSearchFlags are defaulted to "" and 0!
514 Please use it only, if you can be sure, that the really given by the outside calli!
515 Mostly it depends from the parameter eHelper is they are required or not.
517 @param eHelper
518 specify the requested dispatch helper
519 @param xOwner
520 the target of possible dispatch() call on created dispatch helper
521 @param sTarget
522 the target parameter of the original queryDispatch() request
523 @param nSearchFlags
524 the flags parameter of the original queryDispatch() request
525 @return A reference to a dispatch helper.
527 @threadsafe yes
529 css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreateDispatchHelper( EDispatchHelper eHelper ,
530 const css::uno::Reference< css::frame::XFrame >& xOwner ,
531 const OUString& sTarget ,
532 sal_Int32 nSearchFlags)
534 css::uno::Reference< css::frame::XDispatch > xDispatchHelper;
536 switch (eHelper)
538 case E_MENUDISPATCHER :
540 // Attention: Such menue dispatcher must be a singleton for this frame - means our owner frame.
541 // Otherwhise he can make some trouble.
542 SolarMutexGuard g;
543 if ( ! m_xMenuDispatcher.is() )
545 MenuDispatcher* pDispatcher = new MenuDispatcher( m_xContext, xOwner );
546 m_xMenuDispatcher = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
548 xDispatchHelper = m_xMenuDispatcher;
550 break;
552 case E_CREATEDISPATCHER :
554 LoadDispatcher* pDispatcher = new LoadDispatcher(m_xContext, xOwner, sTarget, nSearchFlags);
555 xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
557 break;
559 case E_BLANKDISPATCHER :
561 css::uno::Reference< css::frame::XFrame > xDesktop( xOwner, css::uno::UNO_QUERY );
562 if (xDesktop.is())
564 LoadDispatcher* pDispatcher = new LoadDispatcher(m_xContext, xOwner, SPECIALTARGET_BLANK, 0);
565 xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
568 break;
570 case E_DEFAULTDISPATCHER :
572 css::uno::Reference< css::frame::XFrame > xDesktop( xOwner, css::uno::UNO_QUERY );
573 if (xDesktop.is())
575 LoadDispatcher* pDispatcher = new LoadDispatcher(m_xContext, xOwner, SPECIALTARGET_DEFAULT, 0);
576 xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
579 break;
581 case E_SELFDISPATCHER :
583 LoadDispatcher* pDispatcher = new LoadDispatcher(m_xContext, xOwner, SPECIALTARGET_SELF, 0);
584 xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
586 break;
588 case E_CLOSEDISPATCHER :
590 CloseDispatcher* pDispatcher = new CloseDispatcher( m_xContext, xOwner, sTarget );
591 xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
593 break;
595 case E_STARTMODULEDISPATCHER :
597 StartModuleDispatcher* pDispatcher = new StartModuleDispatcher( m_xContext, xOwner );
598 xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
600 break;
603 return xDispatchHelper;
607 @short check URL for support by our used loader or handler
608 @descr If we must return our own dispatch helper implementations (self, blank, create dispatcher!)
609 we should be sure, that URL describe any loadable content. Otherwise slot/uno URLs
610 will be detected ... but there exist nothing for ral loading into a target frame!
612 @param aURL
613 URL which should be "detected"
614 @return <TRUE/> if somewhere could handle that - <FALSE/> otherwise.
616 @threadsafe yes
618 bool DispatchProvider::implts_isLoadableContent( const css::util::URL& aURL )
620 LoadEnv::EContentType eType = LoadEnv::classifyContent(aURL.Complete, css::uno::Sequence< css::beans::PropertyValue >());
621 return ( eType == LoadEnv::E_CAN_BE_LOADED );
624 } // namespace framework
626 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */