diff options
author | Andreas Schlüns <as@openoffice.org> | 2002-08-12 10:47:27 +0000 |
---|---|---|
committer | Andreas Schlüns <as@openoffice.org> | 2002-08-12 10:47:27 +0000 |
commit | 7e93a7e178fb246c0c9877ff2e5131c27248eaca (patch) | |
tree | f5bcc53a01c45a2a4d92b8d1ca8fcce99e2be094 | |
parent | 96efe843fe2c4baa5f4e1412d6b7ff190b32c082 (diff) |
#92086# some more helper; better detail handling
-rw-r--r-- | framework/inc/interaction/restricteduiinteraction.hxx | 237 | ||||
-rw-r--r-- | framework/inc/interaction/stillinteraction.hxx | 218 | ||||
-rw-r--r-- | framework/inc/loadstate.h | 154 | ||||
-rw-r--r-- | framework/inc/protocols.h | 97 | ||||
-rw-r--r-- | framework/inc/services.h | 5 | ||||
-rw-r--r-- | framework/inc/targets.h | 63 | ||||
-rw-r--r-- | framework/source/dispatch/dispatchprovider.cxx | 8 | ||||
-rw-r--r-- | framework/source/helper/makefile.mk | 5 | ||||
-rw-r--r-- | framework/source/interaction/makefile.mk | 88 | ||||
-rw-r--r-- | framework/source/interaction/restricteduiinteraction.cxx | 317 | ||||
-rw-r--r-- | framework/source/interaction/stillinteraction.cxx | 208 | ||||
-rw-r--r-- | framework/source/services/frame.cxx | 14 | ||||
-rw-r--r-- | framework/util/makefile.mk | 5 |
13 files changed, 1386 insertions, 33 deletions
diff --git a/framework/inc/interaction/restricteduiinteraction.hxx b/framework/inc/interaction/restricteduiinteraction.hxx new file mode 100644 index 0000000000..bb64c19418 --- /dev/null +++ b/framework/inc/interaction/restricteduiinteraction.hxx @@ -0,0 +1,237 @@ +/************************************************************************* + * + * $RCSfile: restricteduiinteraction.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: as $ $Date: 2002-08-12 11:41:52 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef __FRAMEWORK_INTERACTION_RESTRICTEDUIINTERACTION_HXX_ +#define __FRAMEWORK_INTERACTION_RESTRICTEDUIINTERACTION_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_ +#include <threadhelp/threadhelpbase.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_ +#include <macros/xinterface.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_ +#include <macros/xtypeprovider.hxx> +#endif + +#ifndef __FRAMEWORK_GENERAL_H_ +#include <general.h> +#endif + +#ifndef __FRAMEWORK_LOADSTATE_H_ +#include <loadstate.h> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_ +#include <com/sun/star/task/XInteractionHandler.hpp> +#endif + +#ifndef _COM_SUN_STAR_TASK_XINTERACTIONREQUEST_HPP_ +#include <com/sun/star/task/XInteractionRequest.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/** + @short handle interactions visible ... but ignore some of them + @descr Sometimes it's neccessary to use a visible interaction handler, + which ignore some of all possible ones. So for example requests for + missing password or ambigous filter must be solved by the real UI user. + So we have to show dialogs. But some interactions are showing of message + boxes only. They doesn't help to solve a problem. They inform the user only. + But such things can be done by the code, which uses this interaction handler too. + So we collect this informations only and break the outside process. + + @modified 12.08.2002 08:11 + @by Andreas Schlüns + */ +class RestrictedUIInteraction : public css::lang::XTypeProvider + , public css::task::XInteractionHandler + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //_____________________________________ + // member + private: + + /// in case an unknown interaction was aborted - we save it for our external user! + css::uno::Any m_aRequest; + /// some interaction has to be forwarded to a generic UI interaction handler implementation + css::uno::Reference< css::task::XInteractionHandler > m_xGenericUIHandler; + /// for some interactions which supports a non visible retry, we must kn ow, how often they was handled before + sal_Int32 m_nIORetry; + sal_Int32 m_nNetworkRetry; + sal_Int32 m_nChaosRetry; + sal_Int32 m_nWrongMediumRetry; + sal_Int32 m_nWrongJavaVersionRetry; + sal_Int32 m_nBadPartnershipRetry; + /// for retries we must know, when we have to stop it + sal_Int32 m_nMaxRetry; + + //_____________________________________ + // uno interface + public: + + // XInterface, XTypeProvider + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + + //_________________________________ + /** + @interface XInteractionHandler + @short called from outside to handle a problem + @descr We filter the incoming interactions. some of them + will be forwarded to the generic UI interaction handler. + So we must not implement it twice. Some other ones + will be aborted only. + + @threadsafe yes + */ + virtual void SAL_CALL handle( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) throw( css::uno::RuntimeException ); + + //_____________________________________ + // c++ interface + public: + + //_________________________________ + /** + @short ctor to guarantee right initialized instances of this class + @descr It uses the given uno service manager to create the global + generic UI interaction handler for later internal using. + + @param xSMGR + uno service manager for creating services internaly + + @threadsafe not neccessary + */ + RestrictedUIInteraction( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + sal_Int32 nMaxRetry = 2); + + //_________________________________ + /** + @short return the handled interaction request + @descr We save the last getted interaction request internaly. + May the outside user of this class is interessted + on that. Especialy we gotted an unknown interaction + and aborted it hard. + + We save only the last one - because only this interaction can + have breaked the operation. All possible ones before was solved. + + @return [com.sun.star.uno.Any] + the packed interaction request + Can be empty if no interaction was used! + + @threadsafe yes + */ + css::uno::Any getRequest() const; + + //_________________________________ + /** + @short returns information if interaction was used + @descr It can be usefully to know the reason for a failed operation. + + @return [boolean] + <TRUE/> for used interaction + <FALSE/> otherwhise + + @threadsafe yes + */ + sal_Bool wasUsed() const; +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_INTERACTION_RESTRICTEDUIINTERACTION_HXX_ diff --git a/framework/inc/interaction/stillinteraction.hxx b/framework/inc/interaction/stillinteraction.hxx new file mode 100644 index 0000000000..f251372463 --- /dev/null +++ b/framework/inc/interaction/stillinteraction.hxx @@ -0,0 +1,218 @@ +/************************************************************************* + * + * $RCSfile: stillinteraction.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: as $ $Date: 2002-08-12 11:41:51 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef __FRAMEWORK_INTERACTION_STILLINTERACTION_HXX_ +#define __FRAMEWORK_INTERACTION_STILLINTERACTION_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_ +#include <threadhelp/threadhelpbase.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_ +#include <macros/xinterface.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_ +#include <macros/xtypeprovider.hxx> +#endif + +#ifndef __FRAMEWORK_GENERAL_H_ +#include <general.h> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_ +#include <com/sun/star/task/XInteractionHandler.hpp> +#endif + +#ifndef _COM_SUN_STAR_TASK_XINTERACTIONREQUEST_HPP_ +#include <com/sun/star/task/XInteractionRequest.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/** + @short handle interactions non visible + @descr Sometimes it's neccessary to use a non visible interaction handler. + He can't do anything, which a visible one can handle. + But it can be used to intercept problems e.g. during loading of documents. + + In current implementation we solve conflicts for following situations only: + - AmbigousFilterRequest + - InteractiveIOException + - InteractiveAugmentedIOException + All other requests will be aborted. + + @modified 12.07.2002 14:06 + @by Andreas Schlüns + */ +class StillInteraction : public css::lang::XTypeProvider + , public css::task::XInteractionHandler + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //_____________________________________ + // member + private: + + /// in case an unknown interaction was aborted - we save it for our external user! + css::uno::Any m_aRequest; + + //_____________________________________ + // uno interface + public: + + // XInterface, XTypeProvider + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + + //_________________________________ + /** + @interface XInteractionHandler + @short called from outside to handle a problem + @descr The only interaction we can handle here is to + decide which of two ambigous filters should be realy used. + We use the user selected one every time. + All other request will be aborted and can break the code, + which use this interaction handler. + + But you can use another method of this class to check for + some special interactions too: IO Exceptions + May a ComponentLoader needs that to throw suitable exception + on his own interface. + + @threadsafe yes + */ + virtual void SAL_CALL handle( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) throw( css::uno::RuntimeException ); + + //_____________________________________ + // c++ interface + public: + + //_________________________________ + /** + @short ctor to guarantee right initialized instances of this class + @descr - + + @threadsafe not neccessary + */ + StillInteraction(); + + //_________________________________ + /** + @short return the handled interaction request + @descr We saved any getted interaction request internaly. + May the outside user of this class is interessted + on that. Especialy we gotted an unknown interaction + and aborted it hard. + + @return [com.sun.star.uno.Any] + the packed interaction request + Can be empty if no interaction was used! + + @threadsafe yes + */ + css::uno::Any getRequest() const; + + //_________________________________ + /** + @short returns information if interaction was used + @descr It can be usefully to know the reason for a failed operation. + + @return [boolean] + <TRUE/> for used interaction + <FALSE/> otherwhise + + @threadsafe yes + */ + sal_Bool wasUsed() const; +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_INTERACTION_STILLINTERACTION_HXX_ diff --git a/framework/inc/loadstate.h b/framework/inc/loadstate.h new file mode 100644 index 0000000000..7d171c8052 --- /dev/null +++ b/framework/inc/loadstate.h @@ -0,0 +1,154 @@ +/************************************************************************* + * + * $RCSfile: loadstate.h,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: as $ $Date: 2002-08-12 11:40:05 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef __FRAMEWORK_LOADSTATE_H_ +#define __FRAMEWORK_LOADSTATE_H_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_UCB_INTERACTIVEIOEXCEPTION_HPP_ +#include <com/sun/star/ucb/InteractiveIOException.hpp> +#endif + +#ifndef _COM_SUN_STAR_UCB_INTERACTIVEAUGMENTEDIOEXCEPTION_HPP_ +#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_______________________________________________________________________ +/** + These enum values specify all possible results of a load request. + It doesn't matter, if this load operation used dispatch() or loadComponentFromURL(). + The meaning is everytime the same. + */ +enum ELoadState +{ + E_UNSPECIFIED = 0, // indicates the operation was not already started + E_SUCCESS = 1, // the load request was successfull + E_IOERROR = 2, // there was an io error internaly + E_INTERACTION = 3, // there was an interaction, which couldn't be handled (doesn't include IO interactions => see E_IOERROR before) + E_FAILED = 4 // for unknown or unspecified errors +}; + +//_______________________________________________________________________ +/** + Helper, which provides some functionality to identify the reason for + a failed load request and can describe it. + */ +class LoadStateHelper +{ + public: + + //_________________________________ + /** + @short checks if the given interaction request was an io error + @descr This information can be used to throw + a suitable IOException. (e.g. loadComponentFromURL()) + + @param aRequest + the original interaction request, which may produced + the failed load request + + @param rReason + in case this Method returns <TRUE/> the referred string object + will be used to set the original message of the + aborted io exception on it. + If method returns <FALSE/> rReason was not used. + + @return [boolean] + <TRUE/> in case it was an IO error + <FALSE/> in case it wasn't an IO error or interaction was not used + */ + static sal_Bool wasIOError( const css::uno::Any& aRequest , + rtl::OUString& rReason ) + { + if ( ! aRequest.hasValue() ) + return sal_False; + + css::ucb::InteractiveIOException exIOInteractive ; + css::ucb::InteractiveAugmentedIOException exIOAugmented ; + + if (aRequest>>=exIOInteractive) + { + rReason = exIOInteractive.Message; + return sal_True; + } + + if (aRequest>>=exIOAugmented) + { + rReason = exIOAugmented.Message; + return sal_True; + } + + return sal_False; + } +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_LOADSTATE_H_ diff --git a/framework/inc/protocols.h b/framework/inc/protocols.h new file mode 100644 index 0000000000..21db7e5950 --- /dev/null +++ b/framework/inc/protocols.h @@ -0,0 +1,97 @@ +/************************************************************************* + * + * $RCSfile: protocols.h,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: as $ $Date: 2002-08-12 11:40:06 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef __FRAMEWORK_PROTOCOLS_H_ +#define __FRAMEWORK_PROTOCOLS_H_ + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ +#include <macros/generic.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_______________________________________________________________________ +/** + some protocols must be checked during loading or dispatching URLs manually + It can be neccessary to decide, if a URL represent a non visible content or + a real visible component. + */ + +#define SPECIALPROTOCOL_STREAMLOADING DECLARE_ASCII("private:stream*" ) // indicates loading of components using a stream only +#define SPECIALPROTOCOL_NEWDOCUMENT DECLARE_ASCII("private:factory*") // indicates creation of empty documents +#define SPECIALPROTOCOL_SLOT DECLARE_ASCII("slot:*" ) // internal protocol of the sfx project for generic dispatch funtionality +#define SPECIALPROTOCOL_UNO DECLARE_ASCII(".uno:*" ) // external representation of the slot protocol using names instead of id's +#define SPECIALPROTOCOL_MACRO DECLARE_ASCII("macro:*" ) // special sfx protocol to execute macros +#define SPECIALPROTOCOL_SERVICE DECLARE_ASCII("service:*" ) // generic way to start uno services during dispatch +#define SPECIALPROTOCOL_MAILTO DECLARE_ASCII("mailto:*" ) // for sending mails +#define SPECIALPROTOCOL_NEWS DECLARE_ASCII("news:*" ) // for sending news + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_PROTOCOLS_H_ diff --git a/framework/inc/services.h b/framework/inc/services.h index 6f0763c583..f37c40c20e 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -2,9 +2,9 @@ * * $RCSfile: services.h,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: as $ $Date: 2002-05-02 11:36:58 $ + * last change: $Author: as $ $Date: 2002-08-12 11:40:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -139,6 +139,7 @@ namespace framework{ #define IMPLEMENTATIONNAME_DISPATCHRECORDER DECLARE_ASCII("com.sun.star.comp.framework.DispatchRecorder" ) #define IMPLEMENTATIONNAME_MAILTODISPATCHER DECLARE_ASCII("com.sun.star.comp.framework.MailToDispatcher" ) #define IMPLEMENTATIONNAME_SERVICEHANDLER DECLARE_ASCII("com.sun.star.comp.framework.ServiceHandler" ) +#define IMPLEMENTATIONNAME_UIINTERACTIONHANDLER DECLARE_ASCII("com.sun.star.comp.uui.UUIInteractionHandler" ) } // namespace framework diff --git a/framework/inc/targets.h b/framework/inc/targets.h index 9eb5d46361..bf8dcf05ce 100644 --- a/framework/inc/targets.h +++ b/framework/inc/targets.h @@ -2,9 +2,9 @@ * * $RCSfile: targets.h,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: mba $ $Date: 2001-11-28 11:03:50 $ + * last change: $Author: as $ $Date: 2002-08-12 11:40:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,19 +80,52 @@ namespace framework{ // Values for special frame search ... sTargetFrameName of findFrame() or queryDispatch() or loadComponentFromURL() //_________________________________________________________________________________________________________________ -#define SPECIALTARGET_SELF DECLARE_ASCII("_self" ) // The frame himself is searched. -#define SPECIALTARGET_PARENT DECLARE_ASCII("_parent" ) // The direct parent frame is searched. -#define SPECIALTARGET_TOP DECLARE_ASCII("_top" ) // Search at ouer parents for the first task (if any exist) or a frame without a parent. -#define SPECIALTARGET_BLANK DECLARE_ASCII("_blank" ) // Create a new task. -#define SPECIALTARGET_DEFAULT DECLARE_ASCII("_default" ) // Create a new task or recycle an existing one -#define SPECIALTARGET_BEAMER DECLARE_ASCII("_beamer" ) // special frame in hierarchy -#define SPECIALTARGET_MENUBAR DECLARE_ASCII("_menubar" ) // special target for menubars -#define SPECIALTARGET_HELPAGENT DECLARE_ASCII("_helpagent" ) // special target for the help agent window -/* not supported yet! -#define SPECIALTARGET_DOCUMENT DECLARE_ASCII("_document" ) -#define SPECIALTARGET_EXPLORER DECLARE_ASCII("_explorer" ) -#define SPECIALTARGET_PARTWINDOW DECLARE_ASCII("_partwindow" ) -*/ +#define SPECIALTARGET_SELF DECLARE_ASCII("_self" ) // The frame himself is searched. +#define SPECIALTARGET_PARENT DECLARE_ASCII("_parent" ) // The direct parent frame is searched. +#define SPECIALTARGET_TOP DECLARE_ASCII("_top" ) // Search at ouer parents for the first task (if any exist) or a frame without a parent. +#define SPECIALTARGET_BLANK DECLARE_ASCII("_blank" ) // Create a new task. +#define SPECIALTARGET_DEFAULT DECLARE_ASCII("_default" ) // Create a new task or recycle an existing one +#define SPECIALTARGET_BEAMER DECLARE_ASCII("_beamer" ) // special frame in hierarchy +#define SPECIALTARGET_MENUBAR DECLARE_ASCII("_menubar" ) // special target for menubars +#define SPECIALTARGET_HELPAGENT DECLARE_ASCII("_helpagent" ) // special target for the help agent window + +class TargetCheck +{ + public: + + //_______________________________________________________________________ + /** + it checks, if the given target name is a well known special one. + The it returns <TRUE/> - otherwhise <FALSE/>. + Special targets are defined above ... + */ + static sal_Bool isSpecialTarget( const ::rtl::OUString& sTarget ) + { + return ( + sTarget == SPECIALTARGET_SELF || + sTarget == SPECIALTARGET_PARENT || + sTarget == SPECIALTARGET_TOP || + sTarget == SPECIALTARGET_BLANK || + sTarget == SPECIALTARGET_DEFAULT || + sTarget == SPECIALTARGET_BEAMER || + sTarget == SPECIALTARGET_MENUBAR || + sTarget == SPECIALTARGET_HELPAGENT + ); + } + + //_______________________________________________________________________ + /** + it checks, if the given target name can be valid + Of course we can't check unknwon names, which are not special ones. + But we decide, that it's not allowed to use "_" as first sign + and the value doesn't represent such special target. + We reserve this letter for our own purposes. + */ + static sal_Bool isValidTarget( const ::rtl::OUString& sTarget ) + { + return (sTarget.indexOf('_') == 0 && TargetCheck::isSpecialTarget(sTarget)); + } +}; } // namespace framework diff --git a/framework/source/dispatch/dispatchprovider.cxx b/framework/source/dispatch/dispatchprovider.cxx index 65954f6335..e8a45e9c2c 100644 --- a/framework/source/dispatch/dispatchprovider.cxx +++ b/framework/source/dispatch/dispatchprovider.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dispatchprovider.cxx,v $ * - * $Revision: 1.23 $ + * $Revision: 1.24 $ * - * last change: $Author: rt $ $Date: 2002-06-13 08:43:11 $ + * last change: $Author: as $ $Date: 2002-08-12 11:43:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -940,8 +940,8 @@ sal_Bool DispatchProvider::implts_isLoadableContent( const css::util::URL& aURL // no else here! // (c) such special URL indicates a given input stream - it should be loadable too if( - ( bLoadable == sal_False ) && - ( aURL.Complete.compareToAscii( "private:stream/", 15 ) == 0 ) + ( bLoadable == sal_False ) && + ( aURL.Complete.compareToAscii( "private:stream", 15 ) == 0 ) ) { bLoadable = sal_True; diff --git a/framework/source/helper/makefile.mk b/framework/source/helper/makefile.mk index 7d1b96cf50..2dd43b3d06 100644 --- a/framework/source/helper/makefile.mk +++ b/framework/source/helper/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.19 $ +# $Revision: 1.20 $ # -# last change: $Author: as $ $Date: 2002-07-29 08:25:34 $ +# last change: $Author: as $ $Date: 2002-08-12 11:44:19 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -94,7 +94,6 @@ SLOFILES= $(SLO)$/timerhelper.obj \ $(SLO)$/asyncloadthread.obj \ $(SLO)$/componentloader.obj \ $(SLO)$/loadeventlistener.obj \ - $(SLO)$/stillinteraction.obj \ $(SLO)$/persistentwindowstate.obj # --- Targets ------------------------------------------------------ diff --git a/framework/source/interaction/makefile.mk b/framework/source/interaction/makefile.mk new file mode 100644 index 0000000000..8aa99ebd15 --- /dev/null +++ b/framework/source/interaction/makefile.mk @@ -0,0 +1,88 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1 $ +# +# last change: $Author: as $ $Date: 2002-08-12 11:45:07 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (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.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* +PRJ=..$/.. + +PRJNAME= framework +TARGET= fwk_interaction +USE_DEFFILE= TRUE +NO_BSYMBOLIC= TRUE +ENABLE_EXCEPTIONS= TRUE +BOOTSTRAP_SERVICE= FALSE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- defines ------------------------------------------------------ + +CDEFS+=-DCOMPMOD_NAMESPACE=framework + +# --- Generate ----------------------------------------------------- + +SLOFILES= $(SLO)$/stillinteraction.obj \ + $(SLO)$/restricteduiinteraction.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/framework/source/interaction/restricteduiinteraction.cxx b/framework/source/interaction/restricteduiinteraction.cxx new file mode 100644 index 0000000000..70d7cbc016 --- /dev/null +++ b/framework/source/interaction/restricteduiinteraction.cxx @@ -0,0 +1,317 @@ +/************************************************************************* + * + * $RCSfile: restricteduiinteraction.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: as $ $Date: 2002-08-12 11:45:06 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "interaction/restricteduiinteraction.hxx" + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_THREADHELP_READGUARD_HXX_ +#include <threadhelp/readguard.hxx> +#endif + +#ifndef __FRAMEWORK_THREADHELP_WRITEGUARD_HXX_ +#include <threadhelp/writeguard.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ +#include <macros/generic.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +#ifndef __FRAMEWORK_SERVICES_H_ +#include <services.h> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_TASK_XINTERACTIONABORT_HPP_ +#include <com/sun/star/task/XInteractionAbort.hpp> +#endif + +#ifndef _COM_SUN_STAR_TASK_XINTERACTIONRETRY_HPP_ +#include <com/sun/star/task/XInteractionRetry.hpp> +#endif + +#ifndef _COM_SUN_STAR_UCB_INTERACTIVEIOEXCEPTION_HPP_ +#include <com/sun/star/ucb/InteractiveIOException.hpp> +#endif + +#ifndef _COM_SUN_STAR_UCB_INTERACTIVENETWORKEXCEPTION_HPP_ +#include <com/sun/star/ucb/InteractiveNetworkException.hpp> +#endif + +#ifndef _COM_SUN_STAR_UCB_INTERACTIVECHAOSEXCEPTION_HPP_ +#include <com/sun/star/ucb/InteractiveCHAOSException.hpp> +#endif + +#ifndef _COM_SUN_STAR_UCB_INTERACTIVEWRONGMEDIUMEXCEPTION_HPP_ +#include <com/sun/star/ucb/InteractiveWrongMediumException.hpp> +#endif + +#ifndef _COM_SUN_STAR_JAVA_WRONGJAVAVERSIONEXCEPTION_HPP_ +#include <com/sun/star/java/WrongJavaVersionException.hpp> +#endif + +#ifndef _COM_SUN_STAR_SYNC2_BADPARTNERSHIPEXCEPTION_HPP_ +#include <com/sun/star/sync2/BadPartnershipException.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _SV_SVAPP_HXX +#include <vcl/svapp.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +DEFINE_XINTERFACE_2( RestrictedUIInteraction , + OWeakObject , + DIRECT_INTERFACE(css::lang::XTypeProvider ) , + DIRECT_INTERFACE(css::task::XInteractionHandler) ) + +DEFINE_XTYPEPROVIDER_2( RestrictedUIInteraction , + css::lang::XTypeProvider , + css::task::XInteractionHandler ) + +//_________________________________________________________________________________________________________________ + +RestrictedUIInteraction::RestrictedUIInteraction( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + sal_Int32 nMaxRetry ) + : ThreadHelpBase ( &Application::GetSolarMutex() ) + , ::cppu::OWeakObject ( ) + , m_aRequest ( ) + , m_nIORetry ( 0 ) + , m_nNetworkRetry ( 0 ) + , m_nChaosRetry ( 0 ) + , m_nWrongMediumRetry ( 0 ) + , m_nWrongJavaVersionRetry( 0 ) + , m_nBadPartnershipRetry ( 0 ) + , m_nMaxRetry ( nMaxRetry ) +{ + m_xGenericUIHandler = css::uno::Reference< css::task::XInteractionHandler >( + xSMGR->createInstance(IMPLEMENTATIONNAME_UIINTERACTIONHANDLER), + css::uno::UNO_QUERY); +} + +//_________________________________________________________________________________________________________________ + +void SAL_CALL RestrictedUIInteraction::handle( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) throw( css::uno::RuntimeException ) +{ + // safe the request for outside analyzing everytime! + css::uno::Any aRequest = xRequest->getRequest(); + /* SAFE { */ + WriteGuard aWriteLock(m_aLock); + m_aRequest = aRequest; + aWriteLock.unlock(); + /* } SAFE */ + + // analyze the request + // We need XAbort as possible continuation as minimum! + // But we can use retry too, if it exist ... + css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations = xRequest->getContinuations(); + css::uno::Reference< css::task::XInteractionAbort > xAbort; + css::uno::Reference< css::task::XInteractionRetry > xRetry; + + sal_Int32 nCount=lContinuations.getLength(); + for (sal_Int32 i=0; i<nCount; ++i) + { + if ( ! xAbort.is() ) + xAbort = css::uno::Reference< css::task::XInteractionAbort >( lContinuations[i], css::uno::UNO_QUERY ); + + if ( ! xRetry.is() ) + xRetry = css::uno::Reference< css::task::XInteractionRetry >( lContinuations[i], css::uno::UNO_QUERY ); + } + + // differ between interactions for abort (io error) + // and other ones (ambigous filter) which can be forwarded + // to the generic UI handler + + // These interactions seams to inform the user only. + // They can't solve any conflict realy. + // But may some of them supports a retry. Then we use it. + // Otherwhise we abort it - so the load request will fail. + css::ucb::InteractiveIOException aIoException ; + css::ucb::InteractiveNetworkException aNetworkException ; + css::ucb::InteractiveCHAOSException aChaosException ; + css::ucb::InteractiveWrongMediumException aWrongMediumException ; + css::java::WrongJavaVersionException aWrongJavaVersionException ; + css::sync2::BadPartnershipException aBadPartnershipException ; + + sal_Int32 nTriesBefore = 0 ; + sal_Bool bForward = sal_True; + + /* SAFE { */ + aWriteLock.lock(); + + if (aRequest >>= aIoException) + { + ++m_nIORetry; + nTriesBefore = m_nIORetry; + bForward = sal_False; + } + else + if (aRequest >>= aNetworkException) + { + ++m_nNetworkRetry; + nTriesBefore = m_nNetworkRetry; + bForward = sal_False; + } + else + if (aRequest >>= aChaosException) + { + ++m_nChaosRetry; + nTriesBefore = m_nChaosRetry; + bForward = sal_False; + } + else + if (aRequest >>= aWrongMediumException) + { + ++m_nWrongMediumRetry; + nTriesBefore = m_nWrongMediumRetry; + bForward = sal_False; + } + else + if (aRequest >>= aWrongJavaVersionException) + { + ++m_nWrongJavaVersionRetry; + nTriesBefore = m_nWrongJavaVersionRetry; + bForward = sal_False; + } + else + if (aRequest >>= aBadPartnershipException) + { + ++m_nBadPartnershipRetry; + nTriesBefore = m_nBadPartnershipRetry; + bForward = sal_False; + } + + // By the way - use the lock to get threadsafe member copies. + sal_Int32 nMaxRetry = m_nMaxRetry; + css::uno::Reference< css::task::XInteractionHandler > xHandler = m_xGenericUIHandler; + + aWriteLock.unlock(); + /* } SAFE */ + + LOG_ASSERT(xHandler.is(), "RestrictedUIInteraction::handle()\nMiss generic UI handler to delegate request! Will do nothing ...") + + // It's a interaction which shouldn't be shown at the UI. + // Look for possible retries and use it. Otherwhise abort it. + if ( !bForward ) + { + LOG_ASSERT(xAbort.is(), "RestrictedUIInteraction::handle()\nMiss \"Abort\" continuation as minimum. Will do nothing ... ") + + // It's a interaction which shouldn't be shown at the UI. + // Look for possible retries and use it. Otherwhise abort it. + if (nTriesBefore <= nMaxRetry && xRetry.is()) + xRetry->select(); + else + if (xAbort.is()) + xAbort->select(); + } + else + // Otherwhise the request seams to show real dialogs to solve the conflict. + // Delegate it to the generic UI handler. + if (xHandler.is()) + xHandler->handle(xRequest); +} + +//_________________________________________________________________________________________________________________ + +css::uno::Any RestrictedUIInteraction::getRequest() const +{ + /* SAFE { */ + ReadGuard aReadLock(m_aLock); + return m_aRequest; + /* } SAFE */ +} + +//_________________________________________________________________________________________________________________ + +sal_Bool RestrictedUIInteraction::wasUsed() const +{ + /* SAFE { */ + ReadGuard aReadLock(m_aLock); + return m_aRequest.hasValue(); + /* } SAFE */ +} + +} // namespace framework diff --git a/framework/source/interaction/stillinteraction.cxx b/framework/source/interaction/stillinteraction.cxx new file mode 100644 index 0000000000..d85a898f5c --- /dev/null +++ b/framework/source/interaction/stillinteraction.cxx @@ -0,0 +1,208 @@ +/************************************************************************* + * + * $RCSfile: stillinteraction.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: as $ $Date: 2002-08-12 11:45:04 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "interaction/stillinteraction.hxx" + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_THREADHELP_READGUARD_HXX_ +#include <threadhelp/readguard.hxx> +#endif + +#ifndef __FRAMEWORK_THREADHELP_WRITEGUARD_HXX_ +#include <threadhelp/writeguard.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ +#include <macros/generic.hxx> +#endif + +#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_ +#include <macros/debug.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#ifndef _COM_SUN_STAR_TASK_XINTERACTIONABORT_HPP_ +#include <com/sun/star/task/XInteractionAbort.hpp> +#endif + +#ifndef _COM_SUN_STAR_DOCUMENT_XINTERACTIONFILTERSELECT_HPP_ +#include <com/sun/star/document/XInteractionFilterSelect.hpp> +#endif + +#ifndef _COM_SUN_STAR_DOCUMENT_AMBIGOUSFILTERREQUEST_HPP_ +#include <com/sun/star/document/AmbigousFilterRequest.hpp> +#endif + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _SV_SVAPP_HXX +#include <vcl/svapp.hxx> +#endif + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +DEFINE_XINTERFACE_2( StillInteraction , + OWeakObject , + DIRECT_INTERFACE(css::lang::XTypeProvider ) , + DIRECT_INTERFACE(css::task::XInteractionHandler) ) + +DEFINE_XTYPEPROVIDER_2( StillInteraction , + css::lang::XTypeProvider , + css::task::XInteractionHandler ) + +//_________________________________________________________________________________________________________________ + +StillInteraction::StillInteraction() + : ThreadHelpBase ( &Application::GetSolarMutex() ) + , ::cppu::OWeakObject( ) + , m_aRequest ( ) +{ +} + +//_________________________________________________________________________________________________________________ + +void SAL_CALL StillInteraction::handle( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) throw( css::uno::RuntimeException ) +{ + // safe the request for outside analyzing everytime! + css::uno::Any aRequest = xRequest->getRequest(); + /* SAFE { */ + WriteGuard aWriteLock(m_aLock); + m_aRequest = aRequest; + aWriteLock.unlock(); + /* } SAFE */ + + // analyze the request + // We need XAbort as possible continuation as minimum! + // An optional filter selection we can handle too. + css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations = xRequest->getContinuations(); + css::uno::Reference< css::task::XInteractionAbort > xAbort ; + css::uno::Reference< css::document::XInteractionFilterSelect > xFilter; + + sal_Int32 nCount=lContinuations.getLength(); + for (sal_Int32 i=0; i<nCount; ++i) + { + if ( ! xAbort.is() ) + xAbort = css::uno::Reference< css::task::XInteractionAbort >( lContinuations[i], css::uno::UNO_QUERY ); + + if ( ! xFilter.is() ) + xFilter = css::uno::Reference< css::document::XInteractionFilterSelect >( lContinuations[i], css::uno::UNO_QUERY ); + } + + // differ between abortable interactions (error, unknown filter ...) + // and other ones (ambigous but not unknown filter ...) + css::document::AmbigousFilterRequest aAmbigousFilterRequest; + if (aRequest>>=aAmbigousFilterRequest) + { + if (xFilter.is()) + { + // user selected filter wins everytime! + xFilter->setFilter( aAmbigousFilterRequest.SelectedFilter ); + xFilter->select(); + } + } + else + if (xAbort.is()) + { + xAbort->select(); + } +} + +//_________________________________________________________________________________________________________________ + +css::uno::Any StillInteraction::getRequest() const +{ + /* SAFE { */ + ReadGuard aReadLock(m_aLock); + return m_aRequest; + /* } SAFE */ +} + +//_________________________________________________________________________________________________________________ + +sal_Bool StillInteraction::wasUsed() const +{ + /* SAFE { */ + ReadGuard aReadLock(m_aLock); + return m_aRequest.hasValue(); + /* } SAFE */ +} + +} // namespace framework diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index db5da2e896..14000aa1e8 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -2,9 +2,9 @@ * * $RCSfile: frame.cxx,v $ * - * $Revision: 1.60 $ + * $Revision: 1.61 $ * - * last change: $Author: as $ $Date: 2002-07-31 11:03:28 $ + * last change: $Author: as $ $Date: 2002-08-12 11:45:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -472,11 +472,12 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL Frame::loadComponentFromUR { /* SAFE { */ ReadGuard aReadLock(m_aLock); - ComponentLoader aLoader(m_xFactory,this); + ComponentLoader* pLoader = new ComponentLoader(m_xFactory,this); aReadLock.unlock(); /* } SAFE */ - return aLoader.loadComponentFromURL(sURL,sTargetFrameName,nSearchFlags,lArguments); + css::uno::Reference< css::frame::XComponentLoader > xLoader(static_cast< ::cppu::OWeakObject* >(pLoader), css::uno::UNO_QUERY); + return xLoader->loadComponentFromURL(sURL,sTargetFrameName,nSearchFlags,lArguments); } /*-****************************************************************************************************//** @@ -2328,7 +2329,6 @@ void SAL_CALL Frame::windowDeactivated( const css::lang::EventObject& aEvent ) t Window* pFocusWindow = Application::GetFocusWindow(); if ( ( xContainerWindow.is() == sal_True ) && - ( pFocusWindow != NULL ) && ( xParent.is() == sal_True ) && ( (css::uno::Reference< css::frame::XDesktop >( xParent, css::uno::UNO_QUERY )).is() == sal_False ) ) @@ -2336,7 +2336,7 @@ void SAL_CALL Frame::windowDeactivated( const css::lang::EventObject& aEvent ) t css::uno::Reference< css::awt::XWindow > xParentWindow = xParent->getContainerWindow() ; Window* pOwnWindow = VCLUnoHelper::GetWindow( xContainerWindow ); Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow ); - if( pParentWindow->IsChild( pFocusWindow ) ) + if( pFocusWindow==NULL || pParentWindow->IsChild( pFocusWindow ) ) { css::uno::Reference< css::frame::XFramesSupplier > xSupplier( xParent, css::uno::UNO_QUERY ); if( xSupplier.is() == sal_True ) @@ -3137,7 +3137,7 @@ void Frame::implts_setIconOnWindow() if( xModel.is() == sal_True ) { ::rtl::OUString sFilter; - ArgumentAnalyzer aAnalyzer(xModel->getArgs(),(sal_Bool)sal_True); + ArgumentAnalyzer aAnalyzer(xModel->getArgs(),sal_True); aAnalyzer.getArgument( E_FILTERNAME, sFilter ); if( sFilter.getLength() > 0 ) diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk index 7dc23c6535..dc7cb48793 100644 --- a/framework/util/makefile.mk +++ b/framework/util/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.63 $ +# $Revision: 1.64 $ # -# last change: $Author: as $ $Date: 2002-07-29 08:25:50 $ +# last change: $Author: as $ $Date: 2002-08-12 11:47:27 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -241,6 +241,7 @@ SHL4OBJS= $(SLO)$/argumentanalyzer.obj \ $(SLO)$/dispatchrecorder.obj \ $(SLO)$/servicehandler.obj \ $(SLO)$/stillinteraction.obj \ + $(SLO)$/restricteduiinteraction.obj \ $(SLO)$/loadeventlistener.obj \ $(SLO)$/asyncloadthread.obj \ $(SLO)$/componentloader.obj \ |