Files
libreoffice/framework/source/dispatch/dispatchprovider.cxx

627 lines
29 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patches contributed by: Armin Le Grand. #118558# Correcting OLE attributes of LO3.4 at load time by loading as OOo3.3, details see task. http://svn.apache.org/viewvc?view=revision&revision=1195906 #118485# - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 #118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert metafiles http://svn.apache.org/viewvc?view=revision&revision=1293316 #119337# Solves the wrong get/setPropertyValue calls in SvxShapeText (and thus in SvxOle2Shape) http://svn.apache.org/viewvc?view=revision&revision=1344156 Patches contributed by Mathias Bauer (and others) gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i117717#: remove wrong assertion http://svn.apache.org/viewvc?view=revision&revision=1172349 Patch contributed by Herbert Duerr goodbye Registration and License dialogs, don't let the door hit you http://svn.apache.org/viewvc?view=revision&revision=1172613 help gcc 4.6.0 on 32bit ubuntu 11.10" http://svn.apache.org/viewvc?view=revision&revision=1245357 Do not add targets for junit tests when junit is disabled. Patch contributed by Andre Fischer http://svn.apache.org/viewvc?view=revision&revision=1241508 Revert "sb140: #i117082# avoid unncessary static class data members commit 21d97438e2944861e26e4984195f959a0cce1e41. remove obsolete FreeBSD visibility special case. retain consolidated BSD bridge code, remove OS/2 pieces.
2012-11-12 17:21:24 +00:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2002-06-13 07:43:11 +00:00
#include <stdio.h>
#include <dispatch/dispatchprovider.hxx>
#include <loadenv/loadenv.hxx>
#include <dispatch/loaddispatcher.hxx>
#include <dispatch/closedispatcher.hxx>
#include <dispatch/menudispatcher.hxx>
CWS-TOOLING: integrate CWS vcl97 2008-12-11 20:47:52 +0100 pl r265361 : #i93173# revert change, event listeners on the toolbar can lead to crashes 2008-12-11 17:55:54 +0100 pl r265344 : #i92715# fix some border cases 2008-12-11 16:36:01 +0100 pl r265334 : remove forgotten debug printf 2008-12-11 15:54:25 +0100 pl r265323 : add missing pointer initializer 2008-12-11 14:08:44 +0100 as r265297 : #i86520# dont show start module twice 2008-12-11 12:56:34 +0100 as r265289 : #i86520# dont show start module twice 2008-12-11 12:22:18 +0100 pl r265280 : fix a snafu 2008-12-11 12:15:27 +0100 hdu r265279 : #i96549# change some dbg_assert to dbg_warn 2008-12-11 11:57:22 +0100 pl r265276 : #i86520# startcenter on dock item click for mac 2008-12-11 11:31:47 +0100 pl r265271 : #i96964# fix a wrong condition 2008-12-11 11:21:49 +0100 as r265268 : #i86520# new framework slot for ShowStartModule 2008-12-11 10:17:32 +0100 hdu r265251 : #i97127# use fontconfig fallbacks for psprinting too (thanks CMC!) 2008-12-09 10:18:41 +0100 hdu r265060 : #i96549# workaround MAC_OS_X_VERSION_* macros not defined in older SDKs 2008-12-09 09:39:47 +0100 hdu r265057 : #i89650# workaround bogus device resolutions 2008-12-09 09:14:23 +0100 hdu r265054 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 2008-12-08 19:17:42 +0100 pl r265016 : CWS-TOOLING: rebase CWS vcl97 to trunk@264807 (milestone: DEV300:m37) 2008-12-08 16:06:58 +0100 hdu r265004 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 only for the Aqua port 2008-12-08 12:16:26 +0100 hdu r264988 : #i96549# prepare for MAC_OS_X_VERSION_MIN_REQUIRED>=1050 2008-12-08 11:59:25 +0100 hdu r264982 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 2008-12-04 18:19:43 +0100 pl r264866 : #i86520# install a handler to be called on dock icon clicked 2008-12-03 13:04:32 +0100 pl r264769 : #i96551# on quartz build neither gtk nor cups in psprint is needed 2008-11-26 15:07:07 +0100 hdu r264400 : #i96317# adjust to extented SAL_DISABLE_FC_SUBST semantic 2008-11-21 16:15:31 +0100 pl r264147 : #i94443# generalize focus behavior when a child window becomes invisible 2008-11-21 15:45:03 +0100 pl r264144 : #i96433# improve torn off toolbar behavior 2008-11-21 11:50:01 +0100 pl r264119 : #i90083# improve key event dispatching 2008-11-20 17:28:03 +0100 pl r264076 : #i92715# do not execute app events during document recovery 2008-11-20 15:04:32 +0100 pl r264057 : #i92224# #i93249# more aqua key codes 2008-11-20 14:03:00 +0100 pl r264052 : #i92224# #i93249# remove debug printf 2008-11-20 14:00:29 +0100 pl r264049 : #i92224# #i93249# more aqua key codes 2008-11-20 13:59:34 +0100 pl r264048 : #i92224# #i93249# more aqua key codes 2008-11-20 13:52:38 +0100 pl r264047 : #i92224# #i93249# more aqua key codes 2008-11-19 18:42:17 +0100 pl r264017 : #i93249# support some mac specifc key codes: select to line end/begin 2008-11-19 18:40:26 +0100 pl r264016 : #i93249# support some mac specifc key codes: select to line end/begin 2008-11-19 18:32:31 +0100 pl r264014 : #i92224# support some mac specifc key codes: select to line end/begin 2008-11-19 17:34:50 +0100 pl r264009 : #i92224# some more needed keycodes 2008-11-19 16:11:33 +0100 pl r264003 : #i93249# support some mac specifc key codes 2008-11-19 16:10:31 +0100 pl r264002 : #i93249# support some mac specifc key codes 2008-11-19 15:50:03 +0100 pl r264000 : #i93249# support some mac specifc key codes 2008-11-19 14:17:41 +0100 pl r263993 : #i90015# strip appended parenthese entries from menubar 2008-11-17 18:30:37 +0100 pl r263737 : #i94601# emulate menu functionality for non vcl dialogs 2008-11-17 17:31:12 +0100 pl r263731 : #i95263# set inactive tab color on mac more distinct from the active tab color 2008-11-17 17:13:38 +0100 pl r263729 : #i93173# delete toolbar window in a more stack aware manner
2009-01-02 15:26:18 +00:00
#include <dispatch/startmoduledispatcher.hxx>
#include <pattern/window.hxx>
#include <threadhelp/transactionguard.hxx>
CWS-TOOLING: integrate CWS vcl97 2008-12-11 20:47:52 +0100 pl r265361 : #i93173# revert change, event listeners on the toolbar can lead to crashes 2008-12-11 17:55:54 +0100 pl r265344 : #i92715# fix some border cases 2008-12-11 16:36:01 +0100 pl r265334 : remove forgotten debug printf 2008-12-11 15:54:25 +0100 pl r265323 : add missing pointer initializer 2008-12-11 14:08:44 +0100 as r265297 : #i86520# dont show start module twice 2008-12-11 12:56:34 +0100 as r265289 : #i86520# dont show start module twice 2008-12-11 12:22:18 +0100 pl r265280 : fix a snafu 2008-12-11 12:15:27 +0100 hdu r265279 : #i96549# change some dbg_assert to dbg_warn 2008-12-11 11:57:22 +0100 pl r265276 : #i86520# startcenter on dock item click for mac 2008-12-11 11:31:47 +0100 pl r265271 : #i96964# fix a wrong condition 2008-12-11 11:21:49 +0100 as r265268 : #i86520# new framework slot for ShowStartModule 2008-12-11 10:17:32 +0100 hdu r265251 : #i97127# use fontconfig fallbacks for psprinting too (thanks CMC!) 2008-12-09 10:18:41 +0100 hdu r265060 : #i96549# workaround MAC_OS_X_VERSION_* macros not defined in older SDKs 2008-12-09 09:39:47 +0100 hdu r265057 : #i89650# workaround bogus device resolutions 2008-12-09 09:14:23 +0100 hdu r265054 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 2008-12-08 19:17:42 +0100 pl r265016 : CWS-TOOLING: rebase CWS vcl97 to trunk@264807 (milestone: DEV300:m37) 2008-12-08 16:06:58 +0100 hdu r265004 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 only for the Aqua port 2008-12-08 12:16:26 +0100 hdu r264988 : #i96549# prepare for MAC_OS_X_VERSION_MIN_REQUIRED>=1050 2008-12-08 11:59:25 +0100 hdu r264982 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 2008-12-04 18:19:43 +0100 pl r264866 : #i86520# install a handler to be called on dock icon clicked 2008-12-03 13:04:32 +0100 pl r264769 : #i96551# on quartz build neither gtk nor cups in psprint is needed 2008-11-26 15:07:07 +0100 hdu r264400 : #i96317# adjust to extented SAL_DISABLE_FC_SUBST semantic 2008-11-21 16:15:31 +0100 pl r264147 : #i94443# generalize focus behavior when a child window becomes invisible 2008-11-21 15:45:03 +0100 pl r264144 : #i96433# improve torn off toolbar behavior 2008-11-21 11:50:01 +0100 pl r264119 : #i90083# improve key event dispatching 2008-11-20 17:28:03 +0100 pl r264076 : #i92715# do not execute app events during document recovery 2008-11-20 15:04:32 +0100 pl r264057 : #i92224# #i93249# more aqua key codes 2008-11-20 14:03:00 +0100 pl r264052 : #i92224# #i93249# remove debug printf 2008-11-20 14:00:29 +0100 pl r264049 : #i92224# #i93249# more aqua key codes 2008-11-20 13:59:34 +0100 pl r264048 : #i92224# #i93249# more aqua key codes 2008-11-20 13:52:38 +0100 pl r264047 : #i92224# #i93249# more aqua key codes 2008-11-19 18:42:17 +0100 pl r264017 : #i93249# support some mac specifc key codes: select to line end/begin 2008-11-19 18:40:26 +0100 pl r264016 : #i93249# support some mac specifc key codes: select to line end/begin 2008-11-19 18:32:31 +0100 pl r264014 : #i92224# support some mac specifc key codes: select to line end/begin 2008-11-19 17:34:50 +0100 pl r264009 : #i92224# some more needed keycodes 2008-11-19 16:11:33 +0100 pl r264003 : #i93249# support some mac specifc key codes 2008-11-19 16:10:31 +0100 pl r264002 : #i93249# support some mac specifc key codes 2008-11-19 15:50:03 +0100 pl r264000 : #i93249# support some mac specifc key codes 2008-11-19 14:17:41 +0100 pl r263993 : #i90015# strip appended parenthese entries from menubar 2008-11-17 18:30:37 +0100 pl r263737 : #i94601# emulate menu functionality for non vcl dialogs 2008-11-17 17:31:12 +0100 pl r263731 : #i95263# set inactive tab color on mac more distinct from the active tab color 2008-11-17 17:13:38 +0100 pl r263729 : #i93173# delete toolbar window in a more stack aware manner
2009-01-02 15:26:18 +00:00
#include <dispatchcommands.h>
2002-08-22 09:07:00 +00:00
#include <protocols.h>
#include <services.h>
#include <targets.h>
#include <general.h>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/ucb/XContentProviderManager.hpp>
#include <com/sun/star/document/XTypeDetection.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <osl/diagnose.h>
#include <rtl/string.h>
#include <rtl/ustring.hxx>
#include <vcl/svapp.hxx>
#include <rtl/ustrbuf.hxx>
namespace framework{
/**
@short standard ctor/dtor
@descr These initialize a new instance of this class with needed information for work.
We hold a weakreference to our owner frame which start dispatches at us.
We can't use a normal reference because he hold a reference of us too ...
nobody can die so ...!
@seealso using at owner
@param rxContext
reference to servicemanager to create new services.
@param xFrame
reference to our owner frame.
*/
DispatchProvider::DispatchProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext ,
const css::uno::Reference< css::frame::XFrame >& xFrame )
: m_xContext ( rxContext )
, m_xFrame ( xFrame )
{
}
/**
@short protected(!) dtor for deinitializing
@descr We made it protected to prevent using of us as base class instead as a member.
*/
DispatchProvider::~DispatchProvider()
{
}
/**
@interface XDispatchProvider
@short search a dispatcher for given URL
@descr If no interceptor is set on owner, we search for right frame and dispatch URL to it.
If no frame was found, we do nothing.
But we don't do it directly here. We detect the type of our owner frame and calls
specialized queryDispatch() helper dependen from that. Because a Desktop handle some
requests in another way then a normal frame.
@param aURL
URL to dispatch.
@param sTargetFrameName
name of searched frame.
@param nSearchFlags
flags for searching.
@return A reference to a dispatch object for this URL (if someone was found!).
@threadsafe yes
*/
css::uno::Reference< css::frame::XDispatch > SAL_CALL DispatchProvider::queryDispatch( const css::util::URL& aURL ,
const OUString& sTargetFrameName ,
sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException, std::exception )
{
css::uno::Reference< css::frame::XDispatch > xDispatcher;
css::uno::Reference< css::frame::XFrame > xOwner(m_xFrame);
css::uno::Reference< css::frame::XDesktop > xDesktopCheck( xOwner, css::uno::UNO_QUERY );
if (xDesktopCheck.is())
xDispatcher = implts_queryDesktopDispatch(xOwner, aURL, sTargetFrameName, nSearchFlags);
else
xDispatcher = implts_queryFrameDispatch(xOwner, aURL, sTargetFrameName, nSearchFlags);
return xDispatcher;
}
/**
@interface XDispatchProvider
@short do the same like queryDispatch() ... but handle multiple dispatches at the same time
@descr It's an optimism. User give us a list of queries ... and we return a list of dispatcher.
If one of given queries couldn't be solved to a real existing dispatcher ...
we return a list with empty references in it! Order of both lists will be retained!
@seealso method queryDispatch()
@param lDescriptions
a list of all dispatch parameters for multiple requests
@return A reference a list of dispatch objects for these URLs - may with some <NULL/> values inside.
@threadsafe yes
*/
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 )
{
// Create return list - which must have same size then the given descriptor
// It's not allowed to pack it!
sal_Int32 nCount = lDescriptions.getLength();
css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > lDispatcher( nCount );
// Step over all descriptors and try to get any dispatcher for it.
for( sal_Int32 i=0; i<nCount; ++i )
{
lDispatcher[i] = queryDispatch( lDescriptions[i].FeatureURL ,
lDescriptions[i].FrameName ,
lDescriptions[i].SearchFlags );
}
return lDispatcher;
}
sal_Bool lcl_isStartModuleDispatch (const css::util::URL& aURL)
{
return aURL.Complete == CMD_UNO_SHOWSTARTMODULE;
}
/**
@short helper for queryDispatch()
@descr Every member of the frame tree (frame, desktop) must handle such request
in another way. So we implement different specialized metods for every one.
@threadsafe yes
*/
css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryDesktopDispatch( const css::uno::Reference< css::frame::XFrame > xDesktop ,
const css::util::URL& aURL ,
const OUString& sTargetFrameName ,
sal_Int32 nSearchFlags )
{
css::uno::Reference< css::frame::XDispatch > xDispatcher;
// ignore wrong requests which are not supported
if (
(sTargetFrameName==SPECIALTARGET_MENUBAR ) || // valid for frame dispatches - not for desktop
(sTargetFrameName==SPECIALTARGET_PARENT ) || // we have no parent by definition
(sTargetFrameName==SPECIALTARGET_BEAMER ) // beamer frames are allowed as child of tasks only -
// and they exist more then ones. We have no idea which our sub tasks is the right one
)
{
return NULL;
}
// I) handle special cases which not right for using findFrame() first
// I.I) "_blank"
// It's not the right place to create a new task here - because we are queried for a dispatch object
// only, which can handle such request. Such dispatcher should create the required task on demand.
// Normaly the functionality for "_blank" is provided by findFrame() - but that would create it directly
// here. Thats why we must "intercept" here.
if (sTargetFrameName==SPECIALTARGET_BLANK)
{
if (implts_isLoadableContent(aURL))
xDispatcher = implts_getOrCreateDispatchHelper( E_BLANKDISPATCHER, xDesktop );
}
// I.II) "_default"
// This is a combination of search an empty task for recycling - or create a new one.
else if (sTargetFrameName==SPECIALTARGET_DEFAULT)
{
if (implts_isLoadableContent(aURL))
xDispatcher = implts_getOrCreateDispatchHelper( E_DEFAULTDISPATCHER, xDesktop );
if (lcl_isStartModuleDispatch(aURL))
xDispatcher = implts_getOrCreateDispatchHelper( E_STARTMODULEDISPATCHER, xDesktop );
}
// I.III) "_self", "", "_top"
// The desktop can't load any document - but he can handle some special protocols like "uno", "slot" ...
// Why is "top" here handled too? Because the desktop is the topest frame. Normaly it's superflous
// to use this target - but we can handle it in the same manner then "_self".
else if (
(sTargetFrameName==SPECIALTARGET_SELF) ||
(sTargetFrameName==SPECIALTARGET_TOP ) ||
(sTargetFrameName.isEmpty())
)
{
xDispatcher = implts_searchProtocolHandler(aURL);
}
// I.IV) no further special targets exist
// Now we have to search for the right target frame by calling findFrame() - but should provide our code
// against creation of a new task if no frame could be found.
// I said it b efore - it's allowed for dispatch() only.
else
{
sal_Int32 nRightFlags = nSearchFlags;
nRightFlags &= ~css::frame::FrameSearchFlag::CREATE;
// try to find any existing target and ask him for his dispatcher
css::uno::Reference< css::frame::XFrame > xFoundFrame = xDesktop->findFrame(sTargetFrameName, nRightFlags);
if (xFoundFrame.is())
{
css::uno::Reference< css::frame::XDispatchProvider > xProvider( xFoundFrame, css::uno::UNO_QUERY );
xDispatcher = xProvider->queryDispatch(aURL,SPECIALTARGET_SELF,0);
}
// if it couldn't be found - but creation was allowed
// use special dispatcher for creatio or froward it to the browser
else if (nSearchFlags & css::frame::FrameSearchFlag::CREATE)
xDispatcher = implts_getOrCreateDispatchHelper( E_CREATEDISPATCHER, xDesktop, sTargetFrameName, nSearchFlags );
}
return xDispatcher;
}
css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryFrameDispatch( const css::uno::Reference< css::frame::XFrame > xFrame ,
const css::util::URL& aURL ,
const OUString& sTargetFrameName ,
sal_Int32 nSearchFlags )
{
css::uno::Reference< css::frame::XDispatch > xDispatcher;
// 0) Some URLs are dispatched in a generic way (e.g. by the menu) using the default target "".
// But they are specified to use her own fix target. Detect such URLs here and use the correct target.
OUString sTargetName = sTargetFrameName;
// I) handle special cases which not right for using findFrame() first
// I.I) "_blank", "_default"
// It's not the right place to create a new task here. Only the desktop can do that.
// Normaly the functionality for "_blank" is provided by findFrame() - but that would create it directly
// here. Thats why we must "intercept" here.
if (
(sTargetName==SPECIALTARGET_BLANK ) ||
(sTargetName==SPECIALTARGET_DEFAULT)
)
{
css::uno::Reference< css::frame::XDispatchProvider > xParent( xFrame->getCreator(), css::uno::UNO_QUERY );
if (xParent.is())
xDispatcher = xParent->queryDispatch(aURL, sTargetName, 0); // it's a special target - ignore search flags
}
// I.II) "_menubar"
// Special mode on frame or task to receive the local menu. Not supported by findFrame()
else if (sTargetName==SPECIALTARGET_MENUBAR)
{
xDispatcher = implts_getOrCreateDispatchHelper( E_MENUDISPATCHER, xFrame );
}
// I.IV) "_beamer"
// Special sub frame of a top frame only. Search or create it. ... OK it's currently a little bit HACKI.
// Only the sfx (means the controller) can create it it.
else if (sTargetName==SPECIALTARGET_BEAMER)
{
css::uno::Reference< css::frame::XDispatchProvider > xBeamer( xFrame->findFrame( SPECIALTARGET_BEAMER, css::frame::FrameSearchFlag::CHILDREN | css::frame::FrameSearchFlag::SELF ), css::uno::UNO_QUERY );
if (xBeamer.is())
{
xDispatcher = xBeamer->queryDispatch(aURL, SPECIALTARGET_SELF, 0);
}
else
{
css::uno::Reference< css::frame::XDispatchProvider > xController( xFrame->getController(), css::uno::UNO_QUERY );
if (xController.is())
// force using of special target - but use original search flags
// May the caller used the CREATE flag or not!
xDispatcher = xController->queryDispatch(aURL, SPECIALTARGET_BEAMER, nSearchFlags);
}
}
// I.V) "_parent"
// Our parent frame (if it exist) should handle this URL.
else if (sTargetName==SPECIALTARGET_PARENT)
{
css::uno::Reference< css::frame::XDispatchProvider > xParent( xFrame->getCreator(), css::uno::UNO_QUERY );
if (xParent.is())
2012-02-11 12:37:03 +08:00
// SELF => we must address the parent directly... and not his parent or any other parent!
xDispatcher = xParent->queryDispatch(aURL, SPECIALTARGET_SELF, 0);
}
// I.VI) "_top"
// This request must be forwarded to any parent frame, till we reach a top frame.
// If no parent exist, we can handle itself.
else if (sTargetName==SPECIALTARGET_TOP)
{
if (xFrame->isTop())
{
// If we are this top frame itself (means our owner frame)
// we should call ourself recursiv with a better target "_self".
// So we can share the same code! (see reaction for "_self" inside this method too.)
xDispatcher = this->queryDispatch(aURL,SPECIALTARGET_SELF,0);
}
else
{
css::uno::Reference< css::frame::XDispatchProvider > xParent( xFrame->getCreator(), css::uno::UNO_QUERY );
// Normaly if isTop() returned sal_False ... the parent frame MUST(!) exist ...
// But it seems to be better to check that here to prevent us against an access violation.
if (xParent.is())
xDispatcher = xParent->queryDispatch(aURL, SPECIALTARGET_TOP, 0);
}
}
// I.VII) "_self", ""
// Our owner frame should handle this URL. But we can't do it for all of them.
// So we ask the internal setted controller first. If he disagree we try to find a registered
// protocol handler. If this failed too - we check for a loadable content and in case of true
// we load it into the frame by returning specilized dispatch object.
else if (
(sTargetName==SPECIALTARGET_SELF) ||
(sTargetName.isEmpty())
)
{
// There exist a hard coded interception for special URLs.
if ( aURL.Complete == ".uno:CloseDoc" || aURL.Complete == ".uno:CloseWin" )
CWS-TOOLING: integrate CWS mav44 2009-01-18 22:39:43 +0100 mav r266467 : #i97073# the soffice file should be a shell script, adjust the plugin 2009-01-18 22:35:15 +0100 mav r266466 : #i97073# the soffice file should be a shell script, integrate fix from hro41 cws 2009-01-16 15:32:10 +0100 mav r266426 : #i96456# fix link resolving 2009-01-16 12:21:39 +0100 mav r266413 : #i97073# the soffice file is no more a shell script 2009-01-16 09:58:05 +0100 mav r266402 : #i95409# add complex test using unicode names 2009-01-15 20:27:03 +0100 mav r266392 : #i95408# fix include list 2009-01-15 20:09:28 +0100 mav r266390 : #i95408# deliver new header 2009-01-15 16:16:33 +0100 mav r266382 : #i95408# rebase to m38 2009-01-15 16:11:16 +0100 mav r266380 : #i95408# rebase to m38 2009-01-15 15:38:16 +0100 mav r266376 : CWS-TOOLING: rebase CWS mav44 to trunk@265758 (milestone: DEV300:m38) 2009-01-14 13:23:55 +0100 mav r266294 : #i97073# let the presentation slideshow be started in window mode in plugin 2009-01-13 17:27:52 +0100 mav r266241 : #i95409#,#i95408# support UTF8 encoding for entry names, check the validity of the entries 2009-01-13 16:35:39 +0100 mav r266236 : #i95408# function to check whether a zip entry name is acceptable 2009-01-13 12:00:18 +0100 mav r266205 : #i94003# a readonly document can not be modified 2009-01-09 13:24:49 +0100 mav r266078 : #i95951# let the title be changed 2009-01-09 11:34:49 +0100 mav r266068 : #i80862# close the link only if was closed by the container, othewise leave it open 2009-01-08 11:30:13 +0100 mav r265989 : #i97071# disable Toolbars during window-based slide show in ActiveX control 2009-01-08 08:23:23 +0100 mav r265983 : #i97071# setVisible does not trigger layout in case there is not MenuBar 2009-01-06 12:39:39 +0100 mav r265908 : #i96185# let the MediaDescriptor get the target URL 2009-01-05 08:46:45 +0100 mav r265856 : #i93473# integrate the patch 2009-01-02 17:45:17 +0100 mav r265845 : #i94468#,#i96456# try to follow links 2009-01-02 16:53:41 +0100 mav r265841 : #i94468#,#i96456# use the same parsing mechanics in sharing control file and document lock file 2009-01-02 16:51:24 +0100 mav r265839 : #i94468#,#i96456# use the same parsing mechanics in sharing control file and document lock file
2009-02-12 10:27:21 +00:00
{
css::uno::Reference< css::frame::XDispatchProvider > xParent( xFrame->getCreator(), css::uno::UNO_QUERY );
// In case the frame is not a top one, is not based on system window and has a parent,
// the parent frame should to be queried for the correct dispatcher.
// See i93473
if (
!WindowHelper::isTopWindow(xFrame->getContainerWindow()) &&
!VCLUnoHelper::GetWindow(xFrame->getContainerWindow())->IsSystemWindow() &&
xParent.is()
)
xDispatcher = xParent->queryDispatch(aURL, SPECIALTARGET_SELF, 0);
else
xDispatcher = implts_getOrCreateDispatchHelper( E_CLOSEDISPATCHER, xFrame );
}
else if ( aURL.Complete == ".uno:CloseFrame" )
xDispatcher = implts_getOrCreateDispatchHelper( E_CLOSEDISPATCHER, xFrame );
if ( ! xDispatcher.is())
{
// Ask our controller for his agreement for these dispatched URL ...
// because some URLs are internal and can be handled faster by SFX - which most is the current controller!
// But in case of e.g. the bibliography not all queries will be handled successfully here.
css::uno::Reference< css::frame::XDispatchProvider > xController( xFrame->getController(), css::uno::UNO_QUERY );
if (xController.is())
xDispatcher = xController->queryDispatch(aURL, SPECIALTARGET_SELF, 0);
}
// If controller has no fun to dispatch these URL - we must search another right dispatcher.
// Search for any registered protocol handler first.
if (!xDispatcher.is())
xDispatcher = implts_searchProtocolHandler(aURL);
// Not for controller - not for protocol handler
// It should be a loadable content - may be a file. Check it ...
// This check is necessary to found out, that
// support for some protocols isn't installed by user. May be
// "ftp" isn't available. So we suppress creation of our self dispatcher.
// The result will be clear. He can't handle it - but he would try it.
if (
( ! xDispatcher.is() ) &&
( implts_isLoadableContent(aURL) )
)
{
xDispatcher = implts_getOrCreateDispatchHelper( E_SELFDISPATCHER, xFrame );
}
}
// I.VI) no further special handlings exist
// Now we have to search for the right target frame by calling findFrame() - but should provide our code
// against creation of a new task if no frame could be found.
// I said it before - it's allowed for dispatch() only.
else
{
sal_Int32 nRightFlags = nSearchFlags;
nRightFlags &= ~css::frame::FrameSearchFlag::CREATE;
// try to find any existing target and ask him for his dispatcher
css::uno::Reference< css::frame::XFrame > xFoundFrame = xFrame->findFrame(sTargetName, nRightFlags);
if (xFoundFrame.is())
{
// Attention: Found target is our own owner frame!
// Don't ask him for his dispatcher. We know it already - it's our self dispatch helper.
// Otherwhise we can start a never ending recursiv call. Why?
// Somewere called our owner frame - he called some interceptor objects - and may by this dispatch provider
// is called. If wa use queryDispatch() on our owner frame again - we start this call stack again ... and again.
if (xFoundFrame==xFrame)
xDispatcher = implts_getOrCreateDispatchHelper( E_SELFDISPATCHER, xFrame );
else
{
css::uno::Reference< css::frame::XDispatchProvider > xProvider( xFoundFrame, css::uno::UNO_QUERY );
xDispatcher = xProvider->queryDispatch(aURL,SPECIALTARGET_SELF,0);
}
}
else
// if it couldn't be found - but creation was allowed
// forward request to the desktop.
// Note: The given target name must be used to set the name on new created task!
// Don't forward request by changing it to a special one e.g _blank.
// Use the CREATE flag only to prevent call against further searches.
// We already know it - the target must be created new.
if (nSearchFlags & css::frame::FrameSearchFlag::CREATE)
{
css::uno::Reference< css::frame::XDispatchProvider > xParent( xFrame->getCreator(), css::uno::UNO_QUERY );
if (xParent.is())
xDispatcher = xParent->queryDispatch(aURL, sTargetName, css::frame::FrameSearchFlag::CREATE);
}
}
return xDispatcher;
}
/**
@short search for a registered protocol handler and ask him for a dispatch object
@descr Wes earch a suitable handler inside our cfg package org.openoffice.Office.ProtocolHandler.
If we found anyone, we create and initialize it. Initialize means: we set our owner frame on it
as context information. He can use it or leave it. Of course - we are aware of handler implementations,
which doesn't support initialization. It's an optional feature.
@param aURL
the dispatch URL for which may a handler is registered
@return A dispatch object if a handler was found and agree with the given URL or <NULL/> otherwise.
@threadsafe yes
*/
css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_searchProtocolHandler( const css::util::URL& aURL )
{
css::uno::Reference< css::frame::XDispatch > xDispatcher;
ProtocolHandler aHandler;
// This member is threadsafe by himself and lives if we live - we don't need any mutex here.
if (m_aProtocolHandlerCache.search(aURL,&aHandler))
{
css::uno::Reference< css::frame::XDispatchProvider > xHandler;
{
SolarMutexGuard g;
// create it
try
{
xHandler = css::uno::Reference< css::frame::XDispatchProvider >(
css::uno::Reference<css::lang::XMultiServiceFactory>(m_xContext->getServiceManager(), css::uno::UNO_QUERY_THROW)
->createInstance(aHandler.m_sUNOName),
css::uno::UNO_QUERY);
}
catch(const css::uno::Exception&) {}
// look if initialization is necessary
css::uno::Reference< css::lang::XInitialization > xInit( xHandler, css::uno::UNO_QUERY );
if (xInit.is())
{
css::uno::Reference< css::frame::XFrame > xOwner( m_xFrame.get(), css::uno::UNO_QUERY );
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.");
if (xOwner.is())
{
try
{
// but do it only, if all context information are OK
css::uno::Sequence< css::uno::Any > lContext(1);
lContext[0] <<= xOwner;
xInit->initialize(lContext);
}
catch(const css::uno::Exception&) {}
}
}
}
// ask for his (sub)dispatcher for the given URL
if (xHandler.is())
xDispatcher = xHandler->queryDispatch(aURL,SPECIALTARGET_SELF,0);
}
return xDispatcher;
}
/**
@short get or create new dispatch helper
@descr Sometimes we need some helper implementations to support dispatching of special URLs or commands.
But it's not a good idea to hold these services for the whole life time of this provider instance.
We should create it on demand ...
Thats why we implement this method. It return an already existing helper or create a new one otherwise.
@attention The parameter sTarget and nSearchFlags are defaulted to "" and 0!
Please use it only, if you can be shure, that the really given by the outside calli!
Mostly it depends from the parameter eHelper is they are required or not.
@param eHelper
specify the requested dispatch helper
@param xOwner
the target of possible dispatch() call on created dispatch helper
@param sTarget
the target parameter of the original queryDispatch() request
@param nSearchFlags
the flags parameter of the original queryDispatch() request
@return A reference to a dispatch helper.
@threadsafe yes
*/
css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreateDispatchHelper( EDispatchHelper eHelper ,
const css::uno::Reference< css::frame::XFrame >& xOwner ,
const OUString& sTarget ,
sal_Int32 nSearchFlags)
{
css::uno::Reference< css::frame::XDispatch > xDispatchHelper;
switch (eHelper)
{
case E_MENUDISPATCHER :
{
// Attention: Such menue dispatcher must be a singleton for this frame - means our owner frame.
// Otherwhise he can make some trouble.
SolarMutexGuard g;
if ( ! m_xMenuDispatcher.is() )
{
MenuDispatcher* pDispatcher = new MenuDispatcher( m_xContext, xOwner );
m_xMenuDispatcher = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
}
xDispatchHelper = m_xMenuDispatcher;
}
break;
case E_CREATEDISPATCHER :
{
LoadDispatcher* pDispatcher = new LoadDispatcher(m_xContext, xOwner, sTarget, nSearchFlags);
xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
}
break;
case E_BLANKDISPATCHER :
{
css::uno::Reference< css::frame::XFrame > xDesktop( xOwner, css::uno::UNO_QUERY );
if (xDesktop.is())
{
LoadDispatcher* pDispatcher = new LoadDispatcher(m_xContext, xOwner, SPECIALTARGET_BLANK, 0);
xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
}
}
break;
case E_DEFAULTDISPATCHER :
{
css::uno::Reference< css::frame::XFrame > xDesktop( xOwner, css::uno::UNO_QUERY );
if (xDesktop.is())
{
LoadDispatcher* pDispatcher = new LoadDispatcher(m_xContext, xOwner, SPECIALTARGET_DEFAULT, 0);
xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
}
}
break;
case E_SELFDISPATCHER :
{
LoadDispatcher* pDispatcher = new LoadDispatcher(m_xContext, xOwner, SPECIALTARGET_SELF, 0);
xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
}
break;
case E_CLOSEDISPATCHER :
{
CloseDispatcher* pDispatcher = new CloseDispatcher( m_xContext, xOwner, sTarget );
xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
}
break;
CWS-TOOLING: integrate CWS vcl97 2008-12-11 20:47:52 +0100 pl r265361 : #i93173# revert change, event listeners on the toolbar can lead to crashes 2008-12-11 17:55:54 +0100 pl r265344 : #i92715# fix some border cases 2008-12-11 16:36:01 +0100 pl r265334 : remove forgotten debug printf 2008-12-11 15:54:25 +0100 pl r265323 : add missing pointer initializer 2008-12-11 14:08:44 +0100 as r265297 : #i86520# dont show start module twice 2008-12-11 12:56:34 +0100 as r265289 : #i86520# dont show start module twice 2008-12-11 12:22:18 +0100 pl r265280 : fix a snafu 2008-12-11 12:15:27 +0100 hdu r265279 : #i96549# change some dbg_assert to dbg_warn 2008-12-11 11:57:22 +0100 pl r265276 : #i86520# startcenter on dock item click for mac 2008-12-11 11:31:47 +0100 pl r265271 : #i96964# fix a wrong condition 2008-12-11 11:21:49 +0100 as r265268 : #i86520# new framework slot for ShowStartModule 2008-12-11 10:17:32 +0100 hdu r265251 : #i97127# use fontconfig fallbacks for psprinting too (thanks CMC!) 2008-12-09 10:18:41 +0100 hdu r265060 : #i96549# workaround MAC_OS_X_VERSION_* macros not defined in older SDKs 2008-12-09 09:39:47 +0100 hdu r265057 : #i89650# workaround bogus device resolutions 2008-12-09 09:14:23 +0100 hdu r265054 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 2008-12-08 19:17:42 +0100 pl r265016 : CWS-TOOLING: rebase CWS vcl97 to trunk@264807 (milestone: DEV300:m37) 2008-12-08 16:06:58 +0100 hdu r265004 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 only for the Aqua port 2008-12-08 12:16:26 +0100 hdu r264988 : #i96549# prepare for MAC_OS_X_VERSION_MIN_REQUIRED>=1050 2008-12-08 11:59:25 +0100 hdu r264982 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 2008-12-04 18:19:43 +0100 pl r264866 : #i86520# install a handler to be called on dock icon clicked 2008-12-03 13:04:32 +0100 pl r264769 : #i96551# on quartz build neither gtk nor cups in psprint is needed 2008-11-26 15:07:07 +0100 hdu r264400 : #i96317# adjust to extented SAL_DISABLE_FC_SUBST semantic 2008-11-21 16:15:31 +0100 pl r264147 : #i94443# generalize focus behavior when a child window becomes invisible 2008-11-21 15:45:03 +0100 pl r264144 : #i96433# improve torn off toolbar behavior 2008-11-21 11:50:01 +0100 pl r264119 : #i90083# improve key event dispatching 2008-11-20 17:28:03 +0100 pl r264076 : #i92715# do not execute app events during document recovery 2008-11-20 15:04:32 +0100 pl r264057 : #i92224# #i93249# more aqua key codes 2008-11-20 14:03:00 +0100 pl r264052 : #i92224# #i93249# remove debug printf 2008-11-20 14:00:29 +0100 pl r264049 : #i92224# #i93249# more aqua key codes 2008-11-20 13:59:34 +0100 pl r264048 : #i92224# #i93249# more aqua key codes 2008-11-20 13:52:38 +0100 pl r264047 : #i92224# #i93249# more aqua key codes 2008-11-19 18:42:17 +0100 pl r264017 : #i93249# support some mac specifc key codes: select to line end/begin 2008-11-19 18:40:26 +0100 pl r264016 : #i93249# support some mac specifc key codes: select to line end/begin 2008-11-19 18:32:31 +0100 pl r264014 : #i92224# support some mac specifc key codes: select to line end/begin 2008-11-19 17:34:50 +0100 pl r264009 : #i92224# some more needed keycodes 2008-11-19 16:11:33 +0100 pl r264003 : #i93249# support some mac specifc key codes 2008-11-19 16:10:31 +0100 pl r264002 : #i93249# support some mac specifc key codes 2008-11-19 15:50:03 +0100 pl r264000 : #i93249# support some mac specifc key codes 2008-11-19 14:17:41 +0100 pl r263993 : #i90015# strip appended parenthese entries from menubar 2008-11-17 18:30:37 +0100 pl r263737 : #i94601# emulate menu functionality for non vcl dialogs 2008-11-17 17:31:12 +0100 pl r263731 : #i95263# set inactive tab color on mac more distinct from the active tab color 2008-11-17 17:13:38 +0100 pl r263729 : #i93173# delete toolbar window in a more stack aware manner
2009-01-02 15:26:18 +00:00
case E_STARTMODULEDISPATCHER :
{
StartModuleDispatcher* pDispatcher = new StartModuleDispatcher( m_xContext, xOwner, sTarget );
CWS-TOOLING: integrate CWS vcl97 2008-12-11 20:47:52 +0100 pl r265361 : #i93173# revert change, event listeners on the toolbar can lead to crashes 2008-12-11 17:55:54 +0100 pl r265344 : #i92715# fix some border cases 2008-12-11 16:36:01 +0100 pl r265334 : remove forgotten debug printf 2008-12-11 15:54:25 +0100 pl r265323 : add missing pointer initializer 2008-12-11 14:08:44 +0100 as r265297 : #i86520# dont show start module twice 2008-12-11 12:56:34 +0100 as r265289 : #i86520# dont show start module twice 2008-12-11 12:22:18 +0100 pl r265280 : fix a snafu 2008-12-11 12:15:27 +0100 hdu r265279 : #i96549# change some dbg_assert to dbg_warn 2008-12-11 11:57:22 +0100 pl r265276 : #i86520# startcenter on dock item click for mac 2008-12-11 11:31:47 +0100 pl r265271 : #i96964# fix a wrong condition 2008-12-11 11:21:49 +0100 as r265268 : #i86520# new framework slot for ShowStartModule 2008-12-11 10:17:32 +0100 hdu r265251 : #i97127# use fontconfig fallbacks for psprinting too (thanks CMC!) 2008-12-09 10:18:41 +0100 hdu r265060 : #i96549# workaround MAC_OS_X_VERSION_* macros not defined in older SDKs 2008-12-09 09:39:47 +0100 hdu r265057 : #i89650# workaround bogus device resolutions 2008-12-09 09:14:23 +0100 hdu r265054 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 2008-12-08 19:17:42 +0100 pl r265016 : CWS-TOOLING: rebase CWS vcl97 to trunk@264807 (milestone: DEV300:m37) 2008-12-08 16:06:58 +0100 hdu r265004 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 only for the Aqua port 2008-12-08 12:16:26 +0100 hdu r264988 : #i96549# prepare for MAC_OS_X_VERSION_MIN_REQUIRED>=1050 2008-12-08 11:59:25 +0100 hdu r264982 : #i96549# set MAC_OS_X_VERSION_MIN_REQUIRED=1040 2008-12-04 18:19:43 +0100 pl r264866 : #i86520# install a handler to be called on dock icon clicked 2008-12-03 13:04:32 +0100 pl r264769 : #i96551# on quartz build neither gtk nor cups in psprint is needed 2008-11-26 15:07:07 +0100 hdu r264400 : #i96317# adjust to extented SAL_DISABLE_FC_SUBST semantic 2008-11-21 16:15:31 +0100 pl r264147 : #i94443# generalize focus behavior when a child window becomes invisible 2008-11-21 15:45:03 +0100 pl r264144 : #i96433# improve torn off toolbar behavior 2008-11-21 11:50:01 +0100 pl r264119 : #i90083# improve key event dispatching 2008-11-20 17:28:03 +0100 pl r264076 : #i92715# do not execute app events during document recovery 2008-11-20 15:04:32 +0100 pl r264057 : #i92224# #i93249# more aqua key codes 2008-11-20 14:03:00 +0100 pl r264052 : #i92224# #i93249# remove debug printf 2008-11-20 14:00:29 +0100 pl r264049 : #i92224# #i93249# more aqua key codes 2008-11-20 13:59:34 +0100 pl r264048 : #i92224# #i93249# more aqua key codes 2008-11-20 13:52:38 +0100 pl r264047 : #i92224# #i93249# more aqua key codes 2008-11-19 18:42:17 +0100 pl r264017 : #i93249# support some mac specifc key codes: select to line end/begin 2008-11-19 18:40:26 +0100 pl r264016 : #i93249# support some mac specifc key codes: select to line end/begin 2008-11-19 18:32:31 +0100 pl r264014 : #i92224# support some mac specifc key codes: select to line end/begin 2008-11-19 17:34:50 +0100 pl r264009 : #i92224# some more needed keycodes 2008-11-19 16:11:33 +0100 pl r264003 : #i93249# support some mac specifc key codes 2008-11-19 16:10:31 +0100 pl r264002 : #i93249# support some mac specifc key codes 2008-11-19 15:50:03 +0100 pl r264000 : #i93249# support some mac specifc key codes 2008-11-19 14:17:41 +0100 pl r263993 : #i90015# strip appended parenthese entries from menubar 2008-11-17 18:30:37 +0100 pl r263737 : #i94601# emulate menu functionality for non vcl dialogs 2008-11-17 17:31:12 +0100 pl r263731 : #i95263# set inactive tab color on mac more distinct from the active tab color 2008-11-17 17:13:38 +0100 pl r263729 : #i93173# delete toolbar window in a more stack aware manner
2009-01-02 15:26:18 +00:00
xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
}
break;
}
return xDispatchHelper;
}
/**
@short check URL for support by our used loader or handler
@descr If we must return our own dispatch helper implementations (self, blank, create dispatcher!)
we should be shure, that URL describe any loadable content. Otherwise slot/uno URLs
will be detected ... but there exist nothing for ral loading into a target frame!
@param aURL
URL which should be "detected"
@return <TRUE/> if somewhere could handle that - <FALSE/> otherwise.
@threadsafe yes
*/
sal_Bool DispatchProvider::implts_isLoadableContent( const css::util::URL& aURL )
{
LoadEnv::EContentType eType = LoadEnv::classifyContent(aURL.Complete, css::uno::Sequence< css::beans::PropertyValue >());
return ( eType == LoadEnv::E_CAN_BE_LOADED );
}
} // namespace framework
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */