summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schlüns <as@openoffice.org>2002-05-23 11:54:59 +0000
committerAndreas Schlüns <as@openoffice.org>2002-05-23 11:54:59 +0000
commit61f63512fe30f557af48e6ba309878c5bbc71774 (patch)
treef12329e17bb50fe133e4bbf3f39f14a3b0096fdf
parent08312b7ff3bf1c62ef8b8103d26122912d700423 (diff)
#91939# supports XClosable; remove deprecated task; ...
-rw-r--r--framework/inc/classes/framecontainer.hxx9
-rw-r--r--framework/inc/classes/targetfinder.hxx6
-rw-r--r--framework/inc/classes/taskcreator.hxx145
-rw-r--r--framework/inc/dispatch/dispatchprovider.hxx156
-rw-r--r--framework/inc/dispatch/menudispatcher.hxx8
-rw-r--r--framework/inc/helper/ocomponentenumeration.hxx8
-rw-r--r--framework/inc/services/desktop.hxx9
-rw-r--r--framework/inc/services/frame.hxx85
-rw-r--r--framework/inc/services/pluginframe.hxx179
-rw-r--r--framework/inc/services/task.hxx8
-rw-r--r--framework/source/classes/framecontainer.cxx13
-rw-r--r--framework/source/classes/menumanager.cxx56
-rw-r--r--framework/source/classes/targetfinder.cxx37
-rw-r--r--framework/source/classes/taskcreator.cxx334
-rw-r--r--framework/source/dispatch/dispatchprovider.cxx1195
-rw-r--r--framework/source/dispatch/helpagentdispatcher.cxx11
-rw-r--r--framework/source/dispatch/menudispatcher.cxx8
-rw-r--r--framework/source/helper/makefile.mk8
-rw-r--r--framework/source/helper/ocomponentenumeration.cxx5
-rw-r--r--framework/source/helper/oframes.cxx7
-rw-r--r--framework/source/register/registerservices.cxx10
-rw-r--r--framework/source/services/desktop.cxx276
-rw-r--r--framework/source/services/frame.cxx1460
-rw-r--r--framework/source/services/makefile.mk5
-rw-r--r--framework/util/makefile.mk7
25 files changed, 2286 insertions, 1759 deletions
diff --git a/framework/inc/classes/framecontainer.hxx b/framework/inc/classes/framecontainer.hxx
index 6f892fe463..332dcd7db2 100644
--- a/framework/inc/classes/framecontainer.hxx
+++ b/framework/inc/classes/framecontainer.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: framecontainer.hxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: as $ $Date: 2001-06-11 10:13:31 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:49:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -386,9 +386,8 @@ class FrameContainer : private ThreadHelpBase
@onerror A null reference is returned.
*//*-*****************************************************************************************************/
- css::uno::Reference< css::frame::XFrame > searchDeepDown ( const ::rtl::OUString& sName ) const;
- css::uno::Reference< css::frame::XFrame > searchFlatDown ( const ::rtl::OUString& sName ) const;
- css::uno::Reference< css::frame::XFrame > searchDirectChildren ( const ::rtl::OUString& sName ) const;
+ css::uno::Reference< css::frame::XFrame > searchOnAllChildrens ( const ::rtl::OUString& sName ) const;
+ css::uno::Reference< css::frame::XFrame > searchOnDirectChildrens( const ::rtl::OUString& sName ) const;
//-------------------------------------------------------------------------------------------------------------
// protected methods
diff --git a/framework/inc/classes/targetfinder.hxx b/framework/inc/classes/targetfinder.hxx
index cc3d2845a1..83b8963e05 100644
--- a/framework/inc/classes/targetfinder.hxx
+++ b/framework/inc/classes/targetfinder.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: targetfinder.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: mba $ $Date: 2001-11-28 11:03:50 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:49:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -185,7 +185,7 @@ struct TargetInfo
const ::rtl::OUString& sFrame ,
const ::rtl::OUString& sParent );
- EFrameType getFrameType( const css::uno::Reference< css::frame::XFrame >& xFrame );
+ static EFrameType getFrameType( const css::uno::Reference< css::frame::XFrame >& xFrame );
//-------------------------------------------------------------------------------------------------------------
// private methods
diff --git a/framework/inc/classes/taskcreator.hxx b/framework/inc/classes/taskcreator.hxx
index 537af95eea..cdca09deee 100644
--- a/framework/inc/classes/taskcreator.hxx
+++ b/framework/inc/classes/taskcreator.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: taskcreator.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: as $ $Date: 2001-08-10 11:54:21 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:49:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,8 +66,8 @@
// my own includes
//_________________________________________________________________________________________________________________
-#ifndef __FRAMEWORK_CLASSES_TARGETFINDER_HXX_
-#include <classes/targetfinder.hxx>
+#ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_
+#include <threadhelp/threadhelpbase.hxx>
#endif
#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_
@@ -86,14 +86,18 @@
// interface includes
//_________________________________________________________________________________________________________________
-#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
-#include <com/sun/star/frame/XFrame.hpp>
+#ifndef _COM_SUN_STAR_FRAME_XFRAMESSUPPLIER_HPP_
+#include <com/sun/star/frame/XFramesSupplier.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
+#ifndef _COM_SUN_STAR_MOZILLA_XPLUGININSTANCE_HPP_
+#include <com/sun/star/mozilla/XPluginInstance.hpp>
+#endif
+
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
@@ -120,120 +124,49 @@ namespace framework{
// exported definitions
//_________________________________________________________________________________________________________________
-struct TaskInfo
-{
- //-------------------------------------------------------------------------------------------------------------
- public:
- //---------------------------------------------------------------------------------------------------------
- // Create new info structure and fill it with valid values.
- inline TaskInfo( const css::uno::Reference< css::lang::XMultiServiceFactory >& xNewFactory ,
- const css::uno::Reference< css::frame::XFrame >& xNewParent ,
- const ::rtl::OUString& sNewName ,
- sal_Bool bNewVisible )
- {
- xFactory = xNewFactory ;
- xParent = css::uno::Reference< css::frame::XFramesSupplier >( xNewParent, css::uno::UNO_QUERY );
- sTaskName = impl_filterNames( sNewName ) ;
- bVisible = bNewVisible ;
- }
-
- //---------------------------------------------------------------------------------------------------------
- // Don't forget to release references and memory!
- inline ~TaskInfo()
- {
- xFactory = css::uno::Reference< css::lang::XMultiServiceFactory >();
- xParent = css::uno::Reference< css::frame::XFramesSupplier >() ;
- sTaskName = ::rtl::OUString() ;
- bVisible = sal_False ;
- }
-
- private:
- //---------------------------------------------------------------------------------------------------------
- // Filter special names which can't be a valid frame name!
- // Attention: "_beamer" is a valid name - because:
- // It exist one beamer for one task tree only.
- // If he exist, we can find it - otherwhise he will be created by our task-frame!
- inline ::rtl::OUString impl_filterNames( const ::rtl::OUString& sName )
- {
- ::rtl::OUString sFiltered( sName );
- if(
- ( sName == SPECIALTARGET_BLANK ) ||
- ( sName == SPECIALTARGET_SELF ) ||
- ( sName == SPECIALTARGET_PARENT ) ||
- ( sName == SPECIALTARGET_TOP ) ||
- ( sName == SPECIALTARGET_MENUBAR ) ||
- ( sName == SPECIALTARGET_HELPAGENT )
- )
- {
- sFiltered = ::rtl::OUString();
- }
- return sFiltered;
- }
-
- //-------------------------------------------------------------------------------------------------------------
- public:
- css::uno::Reference< css::lang::XMultiServiceFactory > xFactory ;
- css::uno::Reference< css::frame::XFramesSupplier > xParent ;
- ::rtl::OUString sTaskName ;
- sal_Bool bVisible ;
-};
-
/*-************************************************************************************************************//**
- @short a helper to create new tasks or plugin frames for "_blank" or FrameSearchFlag::CREATE at desktop
+ @short a helper to create new tasks, sub or plugin frames for "_blank" or FrameSearchFlag::CREATE
@descr There are different places to create new tasks/plugin frames. Its not easy to service this code!
Thats the reason for this helper. He capsulate asynchronous/synchronous creation by calling
a simple interface.
- @implements -
- @base -
-
@devstatus ready to use
- @threadsafe no
+ @threadsafe yes
+ @modified 16.05.2002 09:09, as96863
*//*-*************************************************************************************************************/
-class TaskCreator
+class TaskCreator : private ThreadHelpBase
{
- //-------------------------------------------------------------------------------------------------------------
- // public methods
- //-------------------------------------------------------------------------------------------------------------
- public:
+ //_______________________
+ // member
+ private:
- //---------------------------------------------------------------------------------------------------------
- // constructor / destructor
- //---------------------------------------------------------------------------------------------------------
- TaskCreator() {};
- virtual ~TaskCreator() {};
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
- static css::uno::Reference< css::frame::XFrame > createSystemTask ( const TaskInfo& aInfo );
- static css::uno::Reference< css::frame::XFrame > createBrowserTask( const TaskInfo& aInfo );
+ //_______________________
+ // interface
+ public:
- //-------------------------------------------------------------------------------------------------------------
- // protected methods
- //-------------------------------------------------------------------------------------------------------------
- protected:
+ TaskCreator( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
+ virtual ~TaskCreator( );
- //-------------------------------------------------------------------------------------------------------------
- // private methods
- //-------------------------------------------------------------------------------------------------------------
- private:
+ css::uno::Reference< css::frame::XFrame > createTask( const ::rtl::OUString& sName ,
+ sal_Bool bVisible );
- //-------------------------------------------------------------------------------------------------------------
- // debug methods
- // (should be private everyway!)
- //-------------------------------------------------------------------------------------------------------------
- #ifdef ENABLE_ASSERTIONS
- private:
- static sal_Bool implcp_createSystemTask ( const TaskInfo& aInfo );
- static sal_Bool implcp_createBrowserTask( const TaskInfo& aInfo );
- #endif // #ifdef ENABLE_ASSERTIONS
-
- //-------------------------------------------------------------------------------------------------------------
- // private variables
- // (should be private everyway!)
- //-------------------------------------------------------------------------------------------------------------
+ //_______________________
+ // helper
private:
-}; // class TaskCreator
+ css::uno::Reference< css::frame::XFrame > implts_createSystemTask ( const css::uno::Reference< css::frame::XFramesSupplier >& xDesktop ,
+ const ::rtl::OUString& sName ,
+ sal_Bool bVisible );
+ css::uno::Reference< css::frame::XFrame > implts_createBrowserTask( const css::uno::Reference< css::frame::XFramesSupplier >& xDesktop ,
+ const css::uno::Reference< css::mozilla::XPluginInstance >& xPlugin ,
+ const ::rtl::OUString& sName ,
+ sal_Bool bVisible );
+ static ::rtl::OUString impl_filterNames ( const ::rtl::OUString& sName );
+
+}; // class TaskCreator
-} // namespace framework
+} // namespace framework
-#endif // #ifndef __FRAMEWORK_CLASSES_TASKCREATOR_HXX_
+#endif // #ifndef __FRAMEWORK_CLASSES_TASKCREATOR_HXX_
diff --git a/framework/inc/dispatch/dispatchprovider.hxx b/framework/inc/dispatch/dispatchprovider.hxx
index c7c8e7856f..a8a4d62e46 100644
--- a/framework/inc/dispatch/dispatchprovider.hxx
+++ b/framework/inc/dispatch/dispatchprovider.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dispatchprovider.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: as $ $Date: 2002-05-03 07:58:43 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:50:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -124,6 +124,10 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#endif
+#ifndef _COM_SUN_STAR_MOZILLA_XPLUGININSTANCE_HPP_
+#include <com/sun/star/mozilla/XPluginInstance.hpp>
+#endif
+
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
@@ -143,9 +147,14 @@
namespace framework{
//_________________________________________________________________________________________________________________
-// exported const
-//_________________________________________________________________________________________________________________
+/**
+ @descr We know some special dispatch objects with diffrent functionality.
+ The can be created internaly by the following DispatchProvider.
+ Here we define some identifier to force creation of the right one.
+
+ @modified 17.05.2002 07:56, as96863
+*/
enum EDispatchHelper
{
E_DEFAULTDISPATCHER ,
@@ -158,103 +167,96 @@ enum EDispatchHelper
};
//_________________________________________________________________________________________________________________
-// exported definitions
-//_________________________________________________________________________________________________________________
-/*-************************************************************************************************************//**
+/**
@short implement a helper for XDispatchProvider interface
- @descr Use this class as member only! Never use it as baseclass.
+ @descr The result of a queryDispatch() call depends from the owner, which use an instance of this class.
+ (frame, task, plugin, desktop) All of them must provides different functionality.
+ E.g: - task can be created by the desktop only
+ - a plugin intercept some calls to forward it to the browser
+ - a task can have a beamer as direct child
+ - a normal frame never can create a new one by himself
+
+ @attention Use this class as member only! Never use it as baseclass.
XInterface will be ambigous and we hold a weakreference to ouer OWNER - not to ouer SUPERCLASS!
- @implements XInterface
- XDispatchProvider
- XEventListener
-
@base ThreadHelpBase
- TransactionBase
- OWeakObject
+ supports threadsafe mechanism
+ @base OWeakObject
+ provides ref count and weak mechanism
@devstatus ready to use
@threadsafe yes
-*//*-*************************************************************************************************************/
+ @modified 17.05.2002 07:56, as96863
+*/
class DispatchProvider : // interfaces
public css::lang::XTypeProvider ,
public css::frame::XDispatchProvider ,
- public css::lang::XEventListener ,
// baseclasses
// Order is neccessary for right initialization!
private ThreadHelpBase ,
private TransactionBase ,
public ::cppu::OWeakObject
{
- //-------------------------------------------------------------------------------------------------------------
- // public methods
- //-------------------------------------------------------------------------------------------------------------
+ /* member */
+ private:
+ /// reference to global service manager to create new services
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
+ /// weakreference to owner frame (Don't use a hard reference. Owner can't delete us then!)
+ css::uno::WeakReference< css::frame::XFrame > m_xFrame;
+ /// different dispatcher to handle special dispatch calls, protocols or URLs (they will be created on demand.)
+ css::uno::Reference< css::frame::XDispatch > m_xMenuDispatcher ;
+ css::uno::Reference< css::frame::XDispatch > m_xHelpAgentDispatcher;
+/* css::uno::Reference< css::frame::XDispatch > m_xBlankDispatcher ;
+ css::uno::Reference< css::frame::XDispatch > m_xSelfDispatcher ;
+ css::uno::Reference< css::frame::XDispatch > m_xPlugInDispatcher ;
+ css::uno::Reference< css::frame::XDispatch > m_xDefaultDispatcher ;*/
+ /// cache of some other dispatch provider which are registered inside configuration to handle special URL protocols
+ HandlerCache m_aProtocolHandlerCache;
+ // if we are running plugged inside a browser we must intercept some queryDispatch() calls and forward it to the browser
+ static css::uno::WeakReference< css::mozilla::XPluginInstance > m_xPluginInterceptor;
+
+ /* interface */
public:
- // constructor / destructor
- DispatchProvider( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ,
- const css::uno::Reference< css::frame::XFrame >& xFrame );
-
- // XInterface
DECLARE_XINTERFACE
DECLARE_XTYPEPROVIDER
- // XDispatchProvider
- virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL ,
- const ::rtl::OUString& sTargetFrameName ,
- sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException );
- virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches ( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptions ) throw( css::uno::RuntimeException );
+ DispatchProvider( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ,
+ const css::uno::Reference< css::frame::XFrame >& xFrame );
- // XEventListener
- virtual void SAL_CALL disposing ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
+ virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL ,
+ const ::rtl::OUString& sTargetFrameName ,
+ sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException );
+ virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptions ) throw( css::uno::RuntimeException );
- //-------------------------------------------------------------------------------------------------------------
- // protected methods
- //-------------------------------------------------------------------------------------------------------------
+ static void setPluginInterceptor( const css::uno::Reference< css::mozilla::XPluginInstance >& xPlugin );
+
+ /* helper */
protected:
- // Let him protected!
+ // Let him protected! So nobody can use us as base ...
virtual ~DispatchProvider();
- //-------------------------------------------------------------------------------------------------------------
- // private methods
- //-------------------------------------------------------------------------------------------------------------
- private:
- css::uno::Reference< css::frame::XDispatch > implts_getOrCreateDispatchHelper ( EDispatchHelper eHelper ,
- const css::uno::Any& aParameters = css::uno::Any() );
- sal_Bool implts_isLoadableContent ( const css::util::URL& aURL );
-
- //-------------------------------------------------------------------------------------------------------------
- // debug methods
- // (should be private everyway!)
- //-------------------------------------------------------------------------------------------------------------
- #ifdef ENABLE_ASSERTIONS
private:
- static sal_Bool implcp_ctor ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ,
- const css::uno::Reference< css::frame::XFrame >& xFrame );
- static sal_Bool implcp_queryDispatch ( const css::util::URL& aURL ,
- const ::rtl::OUString& sTargetFrameName,
- sal_Int32 nSearchFlags );
- static sal_Bool implcp_queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptions );
- static sal_Bool implcp_disposing ( const css::lang::EventObject& aEvent );
- #endif // #ifdef ENABLE_ASSERTIONS
-
- //-------------------------------------------------------------------------------------------------------------
- // variables
- // (should be private everyway!)
- //-------------------------------------------------------------------------------------------------------------
- private:
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// reference to global service manager to create new services
- css::uno::WeakReference< css::frame::XFrame > m_xFrame ; /// weakreference to owner frame (Don't use a hard reference. Owner can't delete us then!)
- css::uno::Reference< css::frame::XDispatch > m_xMenuDispatcher ; /// different dispatcher to handle special dispatch calls, protocols or URLs
- css::uno::Reference< css::frame::XDispatch > m_xHelpAgentDispatcher ;
- css::uno::Reference< css::frame::XDispatch > m_xBlankDispatcher ;
- css::uno::Reference< css::frame::XDispatch > m_xSelfDispatcher ;
- css::uno::Reference< css::frame::XDispatch > m_xPlugInDispatcher ;
- css::uno::Reference< css::frame::XDispatch > m_xDefaultDispatcher ;
- HandlerCache m_aProtocolHandlerCache ;
-
-}; // class DispatchProvider
-
-} // namespace framework
-
-#endif // #ifndef __FRAMEWORK_DISPATCH_DISPATCHPROVIDER_HXX_
+ css::uno::Reference< css::frame::XDispatch > implts_getOrCreateDispatchHelper ( EDispatchHelper eHelper ,
+ const css::uno::Reference< css::frame::XFrame >& xOwner ,
+ const css::uno::Any& aParameters = css::uno::Any() );
+ sal_Bool implts_isLoadableContent ( const css::util::URL& aURL );
+ css::uno::Reference< css::frame::XDispatch > implts_queryDesktopDispatch ( const css::uno::Reference< css::frame::XFrame > xDesktop ,
+ const css::util::URL& aURL ,
+ const ::rtl::OUString& sTargetFrameName ,
+ sal_Int32 nSearchFlags );
+ css::uno::Reference< css::frame::XDispatch > implts_queryFrameDispatch ( const css::uno::Reference< css::frame::XFrame > xFrame ,
+ const css::util::URL& aURL ,
+ const ::rtl::OUString& sTargetFrameName ,
+ sal_Int32 nSearchFlags );
+ css::uno::Reference< css::frame::XDispatch > implts_queryPluginDispatch ( const css::uno::Reference< css::frame::XFrame > xPlugin ,
+ const css::util::URL& aURL ,
+ const ::rtl::OUString& sTargetFrameName ,
+ sal_Int32 nSearchFlags );
+ css::uno::Reference< css::frame::XDispatch > implts_searchProtocolHandler ( const css::util::URL& aURL );
+
+}; // class DispatchProvider
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_DISPATCH_DISPATCHPROVIDER_HXX_
diff --git a/framework/inc/dispatch/menudispatcher.hxx b/framework/inc/dispatch/menudispatcher.hxx
index e6726b8c21..3198d2ac32 100644
--- a/framework/inc/dispatch/menudispatcher.hxx
+++ b/framework/inc/dispatch/menudispatcher.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: menudispatcher.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: as $ $Date: 2001-07-02 13:22:14 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:50:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -146,10 +146,6 @@
#include <com/sun/star/frame/XDesktop.hpp>
#endif
-#ifndef _COM_SUN_STAR_FRAME_XTASK_HPP_
-#include <com/sun/star/frame/XTask.hpp>
-#endif
-
#ifndef _COM_SUN_STAR_FRAME_FEATURESTATEEVENT_HPP_
#include <com/sun/star/frame/FeatureStateEvent.hpp>
#endif
diff --git a/framework/inc/helper/ocomponentenumeration.hxx b/framework/inc/helper/ocomponentenumeration.hxx
index bf0181ae3b..dba7b3a544 100644
--- a/framework/inc/helper/ocomponentenumeration.hxx
+++ b/framework/inc/helper/ocomponentenumeration.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ocomponentenumeration.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: as $ $Date: 2001-06-11 10:15:04 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:50:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -102,10 +102,6 @@
#include <com/sun/star/container/XEnumeration.hpp>
#endif
-#ifndef _COM_SUN_STAR_FRAME_XTASK_HPP_
-#include <com/sun/star/frame/XTask.hpp>
-#endif
-
#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
#include <com/sun/star/lang/XComponent.hpp>
#endif
diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx
index 72baaf1567..4b56f389aa 100644
--- a/framework/inc/services/desktop.hxx
+++ b/framework/inc/services/desktop.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: desktop.hxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: cd $ $Date: 2002-04-22 07:05:16 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:50:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -110,10 +110,6 @@
#include <com/sun/star/frame/XDesktop.hpp>
#endif
-#ifndef _COM_SUN_STAR_FRAME_XDESKTOPTASK_HPP_
-#include <com/sun/star/frame/XDesktopTask.hpp>
-#endif
-
#ifndef _COM_SUN_STAR_FRAME_WINDOWARRANGE_HPP_
#include <com/sun/star/frame/WindowArrange.hpp>
#endif
@@ -440,6 +436,7 @@ class Desktop : // interfaces
css::uno::Any m_aInteractionRequest ;
sal_Bool m_bSuspendQuickstartVeto ; /// don't ask quickstart for a veto
SvtCommandOptions m_aCommandOptions ; /// ref counted class to support disabling commands defined by configuration file
+ ::rtl::OUString m_sName ;
}; // class Desktop
diff --git a/framework/inc/services/frame.hxx b/framework/inc/services/frame.hxx
index 989f0f16da..0030ab8eaf 100644
--- a/framework/inc/services/frame.hxx
+++ b/framework/inc/services/frame.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: frame.hxx,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: as $ $Date: 2002-04-22 13:50:53 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:50:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -206,10 +206,18 @@
#include <com/sun/star/document/XActionLockable.hpp>
#endif
+#ifndef _COM_SUN_STAR_UTIL_XCLOSEABLE_HPP_
+#include <com/sun/star/util/XCloseable.hpp>
+#endif
+
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
+#ifndef _VCL_EVNTPOST_HXX
+#include <vcl/evntpost.hxx>
+#endif
+
#ifndef INCLUDED_SVTOOLS_CMDOPTIONS_HXX
#include <svtools/cmdoptions.hxx>
#endif
@@ -240,7 +248,7 @@ namespace framework{
// exported const
//_________________________________________________________________________________________________________________
-// This enum can be used to set differnt active states of frames, tasks.
+// This enum can be used to set differnt active states of frames
enum EActiveState
{
E_INACTIVE , // I'am not a member of active path in tree and i don't have the focus.
@@ -252,13 +260,10 @@ enum EActiveState
// exported definitions
//_________________________________________________________________________________________________________________
-//class FrameDataContainer;
-
/*-************************************************************************************************************//**
@short implements a normal frame of hierarchy
- @descr An instance of these class can be a normal node in frame tree only. The highest level to be allowed is 3!
- On 1 stand the desktop himself as the only one, on 2 are all tasks present ... and then comes frames only.
- A frame support influencing of his subtree, find of subframes, activate- and deactivate-mechanism as well as
+ @descr An instance of these class can be a normal node in frame tree. A frame support influencing of his
+ subtree, find of subframes, activate- and deactivate-mechanism as well as
set/get of a frame window, component or controller.
@attention This implementation supports three states: a)uninitialized, b)working, c)disposed
@@ -270,36 +275,20 @@ enum EActiveState
iv) dispose object by calling XComponent::dispose()
After iv) all further requests are rejected by exceptions! (DisposedException)
- @implements XInterface
- XTypeProvider
- XServiceInfo
- XFramesSupplier
- XFrame
- XComponent
- XStatusIndicatorFactory
- XDispatchProvider
- XDispatchInformationProvider
- XDispatchProviderInterception
- XMultiPropertySet
- XFastPropertySet
- XPropertySet
- XWindowListener
- XTopWindowListener
- XFocusListener
- XEventListener
- XActionLockable
-
- @base MutexBase
- ThreadHelpBase
- TransactionBase
- OBroadcastHelper
+ @base ThreadHelpBase
+ help to guarantee correct initialized lock member at startup
+ @base TransactionBase
+ help to implement unbreakable interface calls
+ @base OBroadcastHelper
OPropertySetHelper
- OWeakObject
+ implements the property set
+ @base OWeakObject
+ provides the refcount and XInterface, XWeak
@devstatus ready to use
@threadsafe yes
+ @modified 08.05.2002 09:38, as96863
*//*-*************************************************************************************************************/
-
class Frame : // interfaces
public css::lang::XTypeProvider ,
public css::lang::XServiceInfo ,
@@ -312,6 +301,7 @@ class Frame : // interfaces
public css::awt::XTopWindowListener ,
public css::awt::XFocusListener ,
public css::document::XActionLockable ,
+ public css::util::XCloseable , // => XCloseBroadcaster
// base classes
// Order is neccessary for right initialization of this class!
public ThreadHelpBase , // helper for own threadsafe code
@@ -414,12 +404,12 @@ class Frame : // interfaces
//---------------------------------------------------------------------------------------------------------
// XTopWindowListener
- // Attention: windowActivated() and windowDeactivated() are implement only! All other are empty!
+ // Attention: windowActivated(), windowDeactivated() and windowClosing() are implement only! All other are empty!
//---------------------------------------------------------------------------------------------------------
virtual void SAL_CALL windowActivated ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
virtual void SAL_CALL windowDeactivated ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
virtual void SAL_CALL windowOpened ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ) {};
- virtual void SAL_CALL windowClosing ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ) {};
+ virtual void SAL_CALL windowClosing ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
virtual void SAL_CALL windowClosed ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ) {};
virtual void SAL_CALL windowMinimized ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ) {};
virtual void SAL_CALL windowNormalized ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ) {};
@@ -446,6 +436,18 @@ class Frame : // interfaces
virtual void SAL_CALL setActionLocks ( sal_Int16 nLock ) throw( css::uno::RuntimeException );
virtual sal_Int16 SAL_CALL resetActionLocks( ) throw( css::uno::RuntimeException );
+ //---------------------------------------------------------------------------------------------------------
+ // XCloseable
+ //---------------------------------------------------------------------------------------------------------
+ virtual void SAL_CALL close( sal_Bool bDeliverOwnerShip ) throw( css::util::CloseVetoException,
+ css::uno::RuntimeException );
+
+ //---------------------------------------------------------------------------------------------------------
+ // XCloseable
+ //---------------------------------------------------------------------------------------------------------
+ virtual void SAL_CALL addCloseListener ( const css::uno::Reference< css::util::XCloseListener >& xListener ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL removeCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) throw (css::uno::RuntimeException);
+
//-------------------------------------------------------------------------------------------------------------
// protected methods
//-------------------------------------------------------------------------------------------------------------
@@ -480,10 +482,6 @@ class Frame : // interfaces
*//*-*****************************************************************************************************/
// threadsafe
-// void implts_setContainerWindow ( const css::uno::Reference< css::awt::XWindow >& xWindow );
- void implts_setComponentWindow ( const css::uno::Reference< css::awt::XWindow >& xWindow );
- sal_Bool implts_setComponent ( const css::uno::Reference< css::awt::XWindow >& xComponentWindow ,
- const css::uno::Reference< css::frame::XController >& xController );
void implts_sendFrameActionEvent ( const css::frame::FrameAction& aAction );
void implts_resizeComponentWindow ( );
void implts_setTitleOnWindow ( const ::rtl::OUString& sTitle );
@@ -491,6 +489,12 @@ class Frame : // interfaces
void implts_setIconOnWindow ( );
void implts_startWindowListening ( );
void implts_stopWindowListening ( );
+ void implts_saveWindowAttributes ( );
+ void implts_checkSuicide ( );
+ DECL_LINK( implts_windowClosing, void* );
+
+sal_Bool impl_setComponent( const css::uno::Reference< css::awt::XWindow >& xComponentWindow ,
+ const css::uno::Reference< css::frame::XController >& xController ) throw( css::uno::RuntimeException );
// non threadsafe
void impl_disposeContainerWindow ( css::uno::Reference< css::awt::XWindow >& xWindow );
@@ -576,9 +580,12 @@ class Frame : // interfaces
sal_Int16 m_nExternalLockCount ;
css::uno::Reference< css::frame::XDispatchRecorderSupplier > m_xDispatchRecorderSupplier ; /// is used for dispatch recording and will be set/get from outside. Frame provide it only!
SvtCommandOptions m_aCommandOptions ; /// ref counted class to support disabling commands defined by configuration file
+ sal_Bool m_bSelfClose ; /// in case of CloseVetoException on method close() wqs thrown by ourself - we must close ourself later if no internal processes are running
+ ::vcl::EventPoster m_aPoster ;
protected:
+ sal_Bool m_bIsPlugIn ; /// In objects of these class this member is set to FALSE. But in derived class PlugInFrame it's overwritten with TRUE!
FrameContainer m_aChildFrameContainer ; /// array of child frames
inline css::uno::Reference< css::lang::XMultiServiceFactory > impl_getFactory()
diff --git a/framework/inc/services/pluginframe.hxx b/framework/inc/services/pluginframe.hxx
index 61dbce7ddf..ee6da7a642 100644
--- a/framework/inc/services/pluginframe.hxx
+++ b/framework/inc/services/pluginframe.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: pluginframe.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: cd $ $Date: 2002-05-16 13:28:34 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:50:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,8 +66,8 @@
// my own includes
//_________________________________________________________________________________________________________________
-#ifndef __FRAMEWORK_SERVICES_TASK_HXX_
-#include <services/task.hxx>
+#ifndef __FRAMEWORK_SERVICES_FRAME_HXX_
+#include <services/frame.hxx>
#endif
//_________________________________________________________________________________________________________________
@@ -144,13 +144,13 @@ namespace framework{
@implements XInitialization
XPluginInstance
XDispatchResultListener
- @base Task
+ @base Frame
*//*-*************************************************************************************************************/
-class PlugInFrame : public css::lang::XInitialization ,
- public css::mozilla::XPluginInstance,
+class PlugInFrame : public css::lang::XInitialization ,
+ public css::mozilla::XPluginInstance ,
public css::frame::XDispatchResultListener , // => XEVENTLISTENER
- public Task // Order of baseclasses is neccessary for right initialization!
+ public Frame // Order of baseclasses is neccessary for right initialization!
{
//-------------------------------------------------------------------------------------------------------------
// public methods
@@ -203,18 +203,6 @@ class PlugInFrame : public css::lang::XInitialization ,
// XInitialization
//---------------------------------------------------------------------------------------------------------
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& seqArguments ) throw( css::uno::Exception ,
css::uno::RuntimeException );
@@ -222,80 +210,16 @@ class PlugInFrame : public css::lang::XInitialization ,
// XPluginInstance
//---------------------------------------------------------------------------------------------------------
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
void SAL_CALL start () throw( css::uno::RuntimeException );
void SAL_CALL implcb_start () throw( css::uno::RuntimeException );
-
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
void SAL_CALL stop () throw( css::uno::RuntimeException );
void SAL_CALL implcb_stop () throw( css::uno::RuntimeException );
-
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
void SAL_CALL destroy () throw( css::uno::RuntimeException );
void SAL_CALL implcb_destroy() throw( css::uno::RuntimeException );
-
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
void SAL_CALL createWindow ( const css::uno::Any& aPlatformWindowHandle ,
sal_Bool bEmbedded ) throw( css::uno::RuntimeException );
void SAL_CALL implcb_createWindow ( const css::uno::Any& aPlatformWindowHandle ,
sal_Bool bEmbedded ) throw( css::uno::RuntimeException );
-
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
void SAL_CALL newStream ( const ::rtl::OUString& sMIMEDescription,
const ::rtl::OUString& sURL ,
const ::rtl::OUString& sFilter ,
@@ -307,19 +231,6 @@ class PlugInFrame : public css::lang::XInitialization ,
const ::rtl::OUString& sFilter ,
const css::uno::Reference< css::io::XInputStream >& xStream ,
const css::uno::Any& aSessionId ) throw( css::uno::RuntimeException );
-
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
void SAL_CALL newURL ( const ::rtl::OUString& sMIMEDescription,
const ::rtl::OUString& sURL ,
const ::rtl::OUString& sFilter ,
@@ -328,19 +239,6 @@ class PlugInFrame : public css::lang::XInitialization ,
const ::rtl::OUString& sURL ,
const ::rtl::OUString& sFilter ,
const css::uno::Any& aSessionId ) throw( css::uno::RuntimeException );
-
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
virtual void SAL_CALL getHttpServerURL( ::rtl::OUString& sHost ,
sal_uInt16& nPort ,
::rtl::OUString& sPrefix ) throw( css::uno::RuntimeException );
@@ -349,70 +247,21 @@ class PlugInFrame : public css::lang::XInitialization ,
// XDispatchProvider
//---------------------------------------------------------------------------------------------------------
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& aURL ,
const ::rtl::OUString& sTargetFrameName,
sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException );
-
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& seqDescripts ) throw( css::uno::RuntimeException );
//---------------------------------------------------------------------------------------------------------
// XDispatchResultListener
//---------------------------------------------------------------------------------------------------------
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
virtual void SAL_CALL dispatchFinished ( const css::frame::DispatchResultEvent& aEvent ) throw( css::uno::RuntimeException );
//---------------------------------------------------------------------------------------------------------
// XEventListener
//---------------------------------------------------------------------------------------------------------
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
//-------------------------------------------------------------------------------------------------------------
@@ -427,18 +276,6 @@ class PlugInFrame : public css::lang::XInitialization ,
private:
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
void impl_tryToLoadDocument();
sal_Bool impl_registerRemoteFactories( const css::uno::Reference< css::lang::XMultiServiceFactory >& xRemoteServiceManager );
diff --git a/framework/inc/services/task.hxx b/framework/inc/services/task.hxx
index a700de04cd..30f34ec0d7 100644
--- a/framework/inc/services/task.hxx
+++ b/framework/inc/services/task.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: task.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: mba $ $Date: 2001-08-27 16:11:06 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:51:00 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -600,7 +600,7 @@ class Task : public css::frame::XTask , // => XFrame => XComponent
DECL_LINK( Close_Impl, void* );
- void impl_SaveWindowAttributes();
+// void impl_SaveWindowAttributes();
/* sal_Bool impl_tryToChangeProperty( sal_Bool bProperty ,
const css::uno::Any& aValue ,
@@ -657,7 +657,7 @@ class Task : public css::frame::XTask , // => XFrame => XComponent
protected:
// But some values are neede by derived classes!
- sal_Bool m_bIsPlugIn ; /// In objects of these class this member is set to FALSE.
+// sal_Bool m_bIsPlugIn ; /// In objects of these class this member is set to FALSE.
/// But in derived class PlugInFrame it's overwrited with TRUE!
private:
diff --git a/framework/source/classes/framecontainer.cxx b/framework/source/classes/framecontainer.cxx
index 8110906b1d..06acb3adda 100644
--- a/framework/source/classes/framecontainer.cxx
+++ b/framework/source/classes/framecontainer.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: framecontainer.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: mba $ $Date: 2001-08-22 08:13:27 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:51:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -408,7 +408,7 @@ void FrameContainer::disableQuitTimer()
//*****************************************************************************************************************
// public method
//*****************************************************************************************************************
-Reference< XFrame > FrameContainer::searchDeepDown( const OUString& sName ) const
+Reference< XFrame > FrameContainer::searchOnAllChildrens( const OUString& sName ) const
{
// Check incoming parameter.
LOG_ASSERT2( implcp_searchDeepDown( sName ), "FrameContainer::searchDeepDown()", "Invalid parameter detected!" )
@@ -440,7 +440,7 @@ Reference< XFrame > FrameContainer::searchDeepDown( const OUString& sName ) cons
}
return xSearchedFrame;
}
-
+/*
//*****************************************************************************************************************
// public method
//*****************************************************************************************************************
@@ -452,7 +452,6 @@ Reference< XFrame > FrameContainer::searchFlatDown( const OUString& sName ) cons
// Register transaction. Reject wrong calls.
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
ReadGuard aReadLock( m_aLock );
// Step over all direct child frames first.
@@ -480,11 +479,11 @@ Reference< XFrame > FrameContainer::searchFlatDown( const OUString& sName ) cons
}
return xSearchedFrame;
}
-
+*/
//*****************************************************************************************************************
// public method
//*****************************************************************************************************************
-Reference< XFrame > FrameContainer::searchDirectChildren( const OUString& sName ) const
+Reference< XFrame > FrameContainer::searchOnDirectChildrens( const OUString& sName ) const
{
// Check incoming parameter.
LOG_ASSERT2( implcp_searchDirectChildren( sName ), "FrameContainer::searchDirectChildren()", "Invalid parameter detected!" )
diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx
index 6c3d0aa3a1..a57319d809 100644
--- a/framework/source/classes/menumanager.cxx
+++ b/framework/source/classes/menumanager.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: menumanager.cxx,v $
*
- * $Revision: 1.26 $
+ * $Revision: 1.27 $
*
- * last change: $Author: cd $ $Date: 2002-04-22 07:41:25 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:51:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -103,8 +103,8 @@
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
-#ifndef _COM_SUN_STAR_FRAME_XTASKSSUPPLIER_HPP_
-#include <com/sun/star/frame/XTasksSupplier.hpp>
+#ifndef _COM_SUN_STAR_FRAME_XFRAMESSUPPLIER_HPP_
+#include <com/sun/star/frame/XFramesSupplier.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XDESKTOP_HPP_
#include <com/sun/star/frame/XDesktop.hpp>
@@ -240,7 +240,7 @@ MenuManager::MenuManager( REFERENCE< XFRAME >& rFrame, Menu* pMenu, sal_Bool bDe
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
m_bWasHiContrast = rSettings.GetMenuColor().IsDark();
m_bShowMenuImages = SvtMenuOptions().IsMenuIconsEnabled();
-
+
::std::vector< USHORT > aQueryLabelItemIdVector;
int nItemCount = pMenu->GetItemCount();
@@ -366,7 +366,7 @@ MenuManager::MenuManager( REFERENCE< XFRAME >& rFrame, BmkMenu* pBmkMenu, sal_Bo
m_xFrame = rFrame;
m_bInitialized = sal_False;
m_bIsBookmarkMenu = sal_True;
-
+
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
m_bWasHiContrast = rSettings.GetMenuColor().IsDark();
@@ -783,20 +783,21 @@ void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu )
if ( xDesktop.is() )
{
- Reference< XTasksSupplier > xTasksSupplier( xDesktop, UNO_QUERY );
+ Reference< XFramesSupplier > xTasksSupplier( xDesktop, UNO_QUERY );
Reference< XFrame > xCurrentFrame = xDesktop->getCurrentFrame();
- Reference< XEnumeration > xList = xTasksSupplier->getTasks()->createEnumeration();
- while (( xList->hasMoreElements() == sal_True ))
+ Reference< XIndexAccess > xList( xTasksSupplier->getFrames(), UNO_QUERY );
+ sal_Int32 nCount = xList->getCount();
+ for (sal_Int32 i=0; i<nCount; ++i )
{
- Reference< XTask > xTask;
- xList->nextElement() >>= xTask;
- if ( xTask.is() )
+ Any aItem = xList->getByIndex(i);
+ Reference< XFrame > xFrame;
+ aItem >>= xFrame;
+ if (xFrame.is())
{
- Reference< XFrame > xFrame( xTask, UNO_QUERY );
if ( xFrame == xCurrentFrame )
nActiveItemId = nItemId;
- Window* pWin = VCLUnoHelper::GetWindow( xTask->getContainerWindow() );
+ Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
if ( pWin && pWin->IsVisible() )
{
aNewWindowListVector.push_back( pWin->GetText() );
@@ -906,7 +907,7 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
// Remove protocol part from command so we can use an easier comparision method
aCommand = aCommand.copy( UNO_COMMAND.getLength() );
}
-
+
if ( m_aMenuItemCommand == aSpecialFileMenu ||
m_aMenuItemCommand == aSlotSpecialFileMenu ||
aCommand == aSpecialFileCommand )
@@ -919,13 +920,13 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
// Check if some modes have changed so we have to update our menu images
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
sal_Bool bIsHiContrast = rSettings.GetMenuColor().IsDark();
-
+
if ( m_bWasHiContrast != bIsHiContrast || bShowMenuImages != m_bShowMenuImages )
{
// The mode changed so we have to replace all images
m_bWasHiContrast = bIsHiContrast;
m_bShowMenuImages = bShowMenuImages;
-
+
for ( USHORT nPos = 0; nPos < pMenu->GetItemCount(); nPos++ )
{
USHORT nId = pMenu->GetItemId( nPos );
@@ -935,7 +936,7 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
{
sal_Bool bImageSet = sal_False;
::rtl::OUString aImageId;
-
+
::framework::MenuConfiguration::Attributes* pMenuAttributes =
(::framework::MenuConfiguration::Attributes*)pMenu->GetUserValue( nId );
@@ -960,7 +961,7 @@ IMPL_LINK( MenuManager, Activate, Menu *, pMenu )
}
}
}
-
+
if ( m_bInitialized )
return 0;
else
@@ -1050,22 +1051,23 @@ IMPL_LINK( MenuManager, Select, Menu *, pMenu )
nCurItemId <= END_ITEMID_WINDOWLIST )
{
// window list menu item selected
- Reference< XTasksSupplier > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
+ Reference< XFramesSupplier > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
DESKTOP_SERVICE ), UNO_QUERY );
USHORT nWindowItemId = START_ITEMID_WINDOWLIST;
if ( xDesktop.is() )
{
USHORT nTaskId = START_ITEMID_WINDOWLIST;
- Reference< XEnumeration > xList = xDesktop->getTasks()->createEnumeration();
- while (( xList->hasMoreElements() == sal_True ))
+ Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY );
+ sal_Int32 nCount = xList->getCount();
+ for ( sal_Int32 i=0; i<nCount; ++i )
{
- Reference< XTask > xTask;
- xList->nextElement() >>= xTask;
-
- if ( xTask.is() && nTaskId == nCurItemId )
+ Any aItem = xList->getByIndex(i);
+ Reference< XFrame > xFrame;
+ aItem >>= xFrame;
+ if ( xFrame.is() && nTaskId == nCurItemId )
{
- Window* pWin = VCLUnoHelper::GetWindow( xTask->getContainerWindow() );
+ Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
pWin->GrabFocus();
break;
}
diff --git a/framework/source/classes/targetfinder.cxx b/framework/source/classes/targetfinder.cxx
index 0f7877f27b..fdf5b6ff19 100644
--- a/framework/source/classes/targetfinder.cxx
+++ b/framework/source/classes/targetfinder.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: targetfinder.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: mba $ $Date: 2001-11-28 11:08:13 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:51:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -83,10 +83,6 @@
#include <com/sun/star/mozilla/XPluginInstance.hpp>
#endif
-#ifndef _COM_SUN_STAR_FRAME_XTASK_HPP_
-#include <com/sun/star/frame/XTask.hpp>
-#endif
-
#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
#include <com/sun/star/frame/XFrame.hpp>
#endif
@@ -248,18 +244,27 @@ EFrameType TargetInfo::getFrameType( const css::uno::Reference< css::frame::XFra
// Try to cast it to right interfaces to get informations about right frame type.
css::uno::Reference< css::frame::XDesktop > xDesktopCheck( xFrame, css::uno::UNO_QUERY );
css::uno::Reference< css::mozilla::XPluginInstance > xPlugInCheck ( xFrame, css::uno::UNO_QUERY );
- css::uno::Reference< css::frame::XTask > xTaskCheck ( xFrame, css::uno::UNO_QUERY );
css::uno::Reference< css::frame::XFrame > xFrameCheck ( xFrame, css::uno::UNO_QUERY );
- EFrameType eType;
+ EFrameType eType = E_UNKNOWNFRAME;
+
+ if (xDesktopCheck.is())
+ eType=E_DESKTOP;
+ else
+ if (xPlugInCheck.is())
+ eType=E_PLUGINFRAME;
+ else
+ if (xFrameCheck.is())
+ {
+ eType=E_FRAME;
+ // But may it's a special task frame.
+ // Such frames have the desktop as direct parent!
+ css::uno::Reference< ::com::sun::star::frame::XDesktop > xDesktopParentCheck( xFrame->getCreator(), css::uno::UNO_QUERY );
+ if (xDesktopParentCheck.is())
+ eType=E_TASK;
+ }
- if( xDesktopCheck.is() == sal_True ) { eType = E_DESKTOP ; } else
- if( xPlugInCheck.is () == sal_True ) { eType = E_PLUGINFRAME; } else
- if( xTaskCheck.is () == sal_True ) { eType = E_TASK ; } else
- if( xFrameCheck.is () == sal_True ) { eType = E_FRAME ; }
- #ifdef ENABLE_WARNINGS
- else LOG_WARNING( "TargetFinder::getFrameType()", "Unknown frame implementation detected!" )
- #endif
+ LOG_ASSERT2( eType==E_UNKNOWNFRAME, "TargetFinder::getFrameType()", "Unknown frame implementation detected!" )
return eType;
}
@@ -683,7 +688,7 @@ ETargetClass TargetFinder::impl_classifyForTask_findFrame( sal_Bool
}
//*********************************************************************************************************
- // II.II) Look for PARENT.
+ // II.III) Look for PARENT.
// Is allowed on tasks if outside search of it is allowed!
// Don't check name of parent here - otherwise we return the desktop as result ...
//*********************************************************************************************************
diff --git a/framework/source/classes/taskcreator.cxx b/framework/source/classes/taskcreator.cxx
index deb82c8985..55a4800721 100644
--- a/framework/source/classes/taskcreator.cxx
+++ b/framework/source/classes/taskcreator.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: taskcreator.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: mba $ $Date: 2001-09-19 08:06:50 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:51:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,6 +67,14 @@
#include <classes/taskcreator.hxx>
#endif
+#ifndef __FRAMEWORK_THREADHELP_READGUARD_HXX_
+#include <threadhelp/readguard.hxx>
+#endif
+
+#ifndef __FRAMEWORK_TARGETS_H_
+#include <targets.h>
+#endif
+
#ifndef __FRAMEWORK_SERVICES_H_
#include <services.h>
#endif
@@ -134,139 +142,243 @@ namespace framework{
//_________________________________________________________________________________________________________________
/*-****************************************************************************************************//**
+ @short initialize instance with neccessary informations
+ @descr We need a valid uno service manager to create or instanciate new services.
+ All other informations to create frames or tasks come in on right interface methods.
+
+ @param xSMGR
+ points to the valid uno service manager
+
+ @modified 16.05.2002 09:25, as96863
+*//*-*****************************************************************************************************/
+TaskCreator::TaskCreator( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR )
+ : ThreadHelpBase( )
+ , m_xSMGR ( xSMGR )
+{
+}
+
+/*-****************************************************************************************************//**
+ @short deinitialize instance
+ @descr We should release all used ressource which are not needed any longer.
+
+ @modified 16.05.2002 09:33, as96863
+*//*-*****************************************************************************************************/
+TaskCreator::~TaskCreator()
+{
+ m_xSMGR = NULL;
+}
+
+/*-****************************************************************************************************//**
+ @short create a new task on desktop
+ @descr We use the global desktop instance as parent of the new created frame
+ and initialize it with some state values (name, visible).
+ But this function don't create such task directly. It decide only if it must be
+ a system or browser task. Because it depends from th office environment which one
+ is required.
+
+ @param sName
+ the name of this new created frame
+ Note: Special ones like e.g. "_blank" are not allowed here. We check it and ignore
+ such names.
+
+ @param bVisible
+ We use it to show or hide the new created container window inside this frame.
+
+ @modified 16.05.2002 09:36, as96863
+*//*-*****************************************************************************************************/
+css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const ::rtl::OUString& sName ,
+ sal_Bool bVisible )
+{
+ // Check incoming parameter. We don't allow special target names like e.g. "_blank"
+ ::rtl::OUString sRightName = impl_filterNames(sName);
+
+ /* SAFE { */
+ ReadGuard aReadLock( m_aLock );
+ css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
+ aReadLock.unlock();
+ /* } SAFE */
+
+ css::uno::Reference< css::frame::XFramesSupplier > xDesktop( xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY );
+ if ( ! xDesktop.is())
+ return NULL;
+
+ css::uno::Reference< css::frame::XFrames > xContainer( xDesktop->getFrames(), css::uno::UNO_QUERY );
+ css::uno::Reference< css::container::XIndexAccess > xAccess ( xContainer , css::uno::UNO_QUERY );
+
+ // search for any plugin frame to decide which type the new created task must have
+ css::uno::Reference< css::mozilla::XPluginInstance > xPlugin ;
+ sal_Bool bPluginMode = sal_False;
+ sal_Int32 nCount = xAccess->getCount();
+ for( sal_Int32 i=0; i<nCount; ++i )
+ {
+ css::uno::Any aFrame = xAccess->getByIndex(i);
+ css::uno::Reference< css::frame::XFrame > xFrame ;
+ if ( !(aFrame>>=xFrame) || !xFrame.is() )
+ continue;
+
+ xPlugin = css::uno::Reference< css::mozilla::XPluginInstance >( xFrame, css::uno::UNO_QUERY );
+ if (xPlugin.is())
+ {
+ bPluginMode = sal_True;
+ break;
+ }
+ }
+
+ // If information about plugin mode exists - we can call right creation helper
+ css::uno::Reference< css::frame::XFrame > xTask;
+ if (bPluginMode)
+ xTask = implts_createBrowserTask(xDesktop, xPlugin, sRightName, bVisible);
+ else
+ xTask = implts_createSystemTask(xDesktop, sRightName, bVisible);
+
+ return xTask;
+}
+
+/*-****************************************************************************************************//**
@short create a new task with a system window inside
@descr With this method you can create a new empty system task. We create the task and the container
- window inside of it. Created node will be a child of given parent frame.
+ window inside of it. Created node will be a child of given parent - which can be the desktop only.
- @seealso method createBrowserTask()
+ @param xDesktop
+ only the desktop can be the parent of such new created task frame
+ @param sName
+ the new name for this task (filtered!)
+ @param bVisible
+ used to set the state of frame container window after creation
- @param "aInfo", collection of information, which are used to create task
- @return A reference to the new created task.
+ @return A reference to the new created task or <NULL/> if it failed.
- @onerror We return a null-reference.
- @threadsafe no
+ @threadsafe yes
+ @modified 16.05.2002 10:44, as96863
*//*-*****************************************************************************************************/
-css::uno::Reference< css::frame::XFrame > TaskCreator::createSystemTask( const TaskInfo& aInfo )
+css::uno::Reference< css::frame::XFrame > TaskCreator::implts_createSystemTask( const css::uno::Reference< css::frame::XFramesSupplier >& xDesktop ,
+ const ::rtl::OUString& sName ,
+ sal_Bool bVisible )
{
- // Safe impossible cases.
- // Method is not designed for all incoming parameter!
- LOG_ASSERT2( implcp_createSystemTask( aInfo ), "TaskCreator::createNewSystemTask()", "Invalid parameter detected!" )
-
- // Set default return value to NULL!
css::uno::Reference< css::frame::XFrame > xTask;
- // Get toolkit to create task container window.
- css::uno::Reference< css::awt::XToolkit > xToolkit( aInfo.xFactory->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY );
- if( xToolkit.is() == sal_True )
+ // get toolkit to create task container window
+ /* SAFE { */
+ ReadGuard aReadLock( m_aLock );
+ css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
+ aReadLock.unlock();
+ /* } SAFE */
+ css::uno::Reference< css::awt::XToolkit > xToolkit( xSMGR->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY );
+ if ( ! xToolkit.is() )
+ return NULL;
+
+ // describe window properties.
+ css::awt::WindowDescriptor aDescriptor;
+ aDescriptor.Type = css::awt::WindowClass_TOP ;
+ aDescriptor.WindowServiceName = DECLARE_ASCII("window") ;
+ aDescriptor.ParentIndex = -1 ;
+ aDescriptor.Parent = css::uno::Reference< css::awt::XWindowPeer >() ;
+ aDescriptor.Bounds = css::awt::Rectangle(0,0,0,0) ;
+ aDescriptor.WindowAttributes = css::awt::WindowAttribute::BORDER |
+ css::awt::WindowAttribute::MOVEABLE |
+ css::awt::WindowAttribute::SIZEABLE |
+ css::awt::WindowAttribute::CLOSEABLE ;
+ // create a new blank container window and get access to parent container to append new created task.
+ css::uno::Reference< css::awt::XWindowPeer > xPeer = xToolkit->createWindow( aDescriptor );
+ css::uno::Reference< css::awt::XWindow > xWindow ( xPeer, css::uno::UNO_QUERY );
+ xPeer->setBackground( 0xFFFFFFFF );
+ css::uno::Reference< css::frame::XFrames > xContainer = xDesktop->getFrames();
+ if (
+ ( xWindow.is() ) &&
+ ( xContainer.is() )
+ )
{
- // Describe window properties.
- css::awt::WindowDescriptor aDescriptor;
- aDescriptor.Type = css::awt::WindowClass_TOP ;
- aDescriptor.WindowServiceName = DECLARE_ASCII("window") ;
- aDescriptor.ParentIndex = -1 ;
- aDescriptor.Parent = css::uno::Reference< css::awt::XWindowPeer >() ;
- aDescriptor.Bounds = css::awt::Rectangle(0,0,0,0) ;
- aDescriptor.WindowAttributes = css::awt::WindowAttribute::BORDER |
- css::awt::WindowAttribute::MOVEABLE |
- css::awt::WindowAttribute::SIZEABLE |
- css::awt::WindowAttribute::CLOSEABLE ;
- // Create a new blank container window and get access to parent container to append new created task.
- css::uno::Reference< css::awt::XWindowPeer > xPeer = xToolkit->createWindow( aDescriptor );
- css::uno::Reference< css::awt::XWindow > xWindow ( xPeer, css::uno::UNO_QUERY );
- xPeer->setBackground( 0xFFFFFFFF );
- css::uno::Reference< css::frame::XFrames > xContainer = aInfo.xParent->getFrames();
- if(
- ( xWindow.is() == sal_True ) &&
- ( xContainer.is() == sal_True )
- )
+ // create new top level frame.
+ xTask = css::uno::Reference< css::frame::XFrame >( xSMGR->createInstance( SERVICENAME_FRAME ), css::uno::UNO_QUERY );
+ if (xTask.is())
{
- // Create new system task.
- xTask = css::uno::Reference< css::frame::XFrame >( aInfo.xFactory->createInstance( SERVICENAME_TASK ), css::uno::UNO_QUERY );
- if( xTask.is() == sal_True )
- {
- // Set window on task.
- // Do it before you call other interface methods on task-object ...
- // because this object must be initialized before you can do such things.
- // Otherwise he throw an exception for UNINITIALIZED working mode!
-
- // Don't forget to create tree-bindings! use given parent as parent node of new task ...
- // ... and append it to his container.
- // (task member xParent will automaticly set by "append()" call!)
-
- // ! sTaskName already filtered by TaskInfo structure! Special targets are not allowed here ...
-
- // Disable task window first! Otherwise it's visible during showing of any progress
- // and user interaction could make some trouble ... GPF is possible!
- // So we disable it here ... and our loading proccess enable it after successfully operation.
- xTask->initialize ( xWindow );
- xTask->setName ( aInfo.sTaskName );
- xContainer->append ( xTask );
- }
+ // Set window on task.
+ // Do it before you call other interface methods on task-object ...
+ // because this object must be initialized before you can do such things.
+ // Otherwise he throw an exception for UNINITIALIZED working mode!
+
+ // Don't forget to create tree-bindings! use given parent as parent node of new task ...
+ // ... and append it to his container.
+ // (task member xParent will automaticly set by "append()" call!)
+
+ xTask->initialize ( xWindow );
+ xTask->setName ( sName );
+ xContainer->append ( xTask );
+
+ if (bVisible)
+ xWindow->setVisible(bVisible);
}
}
- // Return result of this operation.
return xTask;
}
-//*****************************************************************************************************************
-css::uno::Reference< css::frame::XFrame > TaskCreator::createBrowserTask( const TaskInfo& aInfo )
+/*-****************************************************************************************************//**
+ @short create a new task by using browser window as parent for own one
+ @descr With this method you can create a new empty browser task. We create the task and the container
+ window inside of it. Created node will be a child of given parent - which can be the desktop only.
+
+ @attention Currently it's not possible to create such browser tasks - because the browser doesn't support
+ synchronous creation of a new empty window. So we create system tasks here too , till
+ a solution exists.
+
+ @param xDesktop
+ only the desktop can be the parent of such new created task frame
+ @param xPlugin
+ we need this instance as "gateway" to the browser
+ @param sName
+ the new name for this task (filtered!)
+ @param bVisible
+ used to set the state of frame container window after creation
+
+ @return A reference to the new created task or <NULL/> if it failed.
+
+ @threadsafe yes
+ @modified 16.05.2002 10:37, as96863
+*//*-*****************************************************************************************************/
+css::uno::Reference< css::frame::XFrame > TaskCreator::implts_createBrowserTask( const css::uno::Reference< css::frame::XFramesSupplier >& xDesktop ,
+ const css::uno::Reference< css::mozilla::XPluginInstance >& xPlugin ,
+ const ::rtl::OUString& sName ,
+ sal_Bool bVisible )
{
- LOG_ERROR( "TaskCreator::createNewBrowserTask()", "Not supported yet! Return empty reference." )
- return css::uno::Reference< css::frame::XFrame >();
+ LOG_WARNING("TaskCreator::implts_createBrowserTask()", "Not supported yet. I create a system task instead of a real browser task.")
+ return implts_createSystemTask(xDesktop, sName, bVisible);
}
-//_________________________________________________________________________________________________________________
-// debug methods
-//_________________________________________________________________________________________________________________
+/*-****************************************************************************************************//**
+ @short decide which names are correct frame names
+ @descr Not all names are allowed as frame name. e.g. special targets like "_blank" are forbidden.
+ They are used to force creation of new tasks and can make trouble during search off already
+ existing ones.
-/*-----------------------------------------------------------------------------------------------------------------
- The follow methods checks the parameter for other functions. If a parameter or his value is non valid,
- we return "sal_False". (else sal_True) This mechanism is used to throw an ASSERT!
------------------------------------------------------------------------------------------------------------------*/
+ @attention "_beamer" is a valid name - because:
+ It exist one beamer for one task tree only.
+ If he exist, we can find it - otherwhise he will be created by our task-frame!
-#ifdef ENABLE_ASSERTIONS
+ @param sName
+ whished name by user
-//*****************************************************************************************************************
-sal_Bool TaskCreator::implcp_createSystemTask( const TaskInfo& aInfo )
-{
- return(
- ( &aInfo == NULL ) ||
- ( aInfo.xFactory.is() == sal_False ) ||
- ( aInfo.xParent.is() == sal_False ) ||
- ( aInfo.sTaskName == SPECIALTARGET_SELF ) ||
- ( aInfo.sTaskName == SPECIALTARGET_BLANK ) ||
- ( aInfo.sTaskName == SPECIALTARGET_PARENT ) ||
- ( aInfo.sTaskName == SPECIALTARGET_TOP ) ||
- ( aInfo.sTaskName == SPECIALTARGET_MENUBAR ) ||
- ( aInfo.sTaskName == SPECIALTARGET_HELPAGENT ) ||
- (
- ( aInfo.bVisible != sal_True ) &&
- ( aInfo.bVisible != sal_False )
- )
- );
-}
+ @return The given name of user if it is an allowed one - or an empty string if not.
-//*****************************************************************************************************************
-sal_Bool TaskCreator::implcp_createBrowserTask( const TaskInfo& aInfo )
+ @threadsafe not neccessary
+ @modified 16.05.2002 10:32, as96863
+*//*-*****************************************************************************************************/
+::rtl::OUString TaskCreator::impl_filterNames( const ::rtl::OUString& sName )
{
- return(
- ( &aInfo == NULL ) ||
- ( aInfo.xFactory.is() == sal_False ) ||
- ( aInfo.xParent.is() == sal_False ) ||
- ( aInfo.sTaskName == SPECIALTARGET_SELF ) ||
- ( aInfo.sTaskName == SPECIALTARGET_BLANK ) ||
- ( aInfo.sTaskName == SPECIALTARGET_PARENT ) ||
- ( aInfo.sTaskName == SPECIALTARGET_TOP ) ||
- ( aInfo.sTaskName == SPECIALTARGET_MENUBAR ) ||
- ( aInfo.sTaskName == SPECIALTARGET_HELPAGENT ) ||
- (
- ( aInfo.bVisible != sal_True ) &&
- ( aInfo.bVisible != sal_False )
- )
- );
+ ::rtl::OUString sFiltered( sName );
+ if(
+ ( sName == SPECIALTARGET_BLANK ) ||
+ ( sName == SPECIALTARGET_DEFAULT ) ||
+ ( sName == SPECIALTARGET_SELF ) ||
+ ( sName == SPECIALTARGET_PARENT ) ||
+ ( sName == SPECIALTARGET_TOP ) ||
+ ( sName == SPECIALTARGET_MENUBAR ) ||
+ ( sName == SPECIALTARGET_HELPAGENT )
+ )
+ {
+ sFiltered = ::rtl::OUString();
+ }
+ return sFiltered;
}
-#endif // #ifdef ENABLE_ASSERTIONS
-
-} // namespace framework
+} // namespace framework
diff --git a/framework/source/dispatch/dispatchprovider.cxx b/framework/source/dispatch/dispatchprovider.cxx
index e156ec95ae..116f44323c 100644
--- a/framework/source/dispatch/dispatchprovider.cxx
+++ b/framework/source/dispatch/dispatchprovider.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dispatchprovider.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: as $ $Date: 2002-05-03 08:00:14 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:52:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -131,10 +131,6 @@
#include <com/sun/star/document/XTypeDetection.hpp>
#endif
-#ifndef _COM_SUN_STAR_MOZILLA_XPLUGININSTANCE_HPP_
-#include <com/sun/star/mozilla/XPluginInstance.hpp>
-#endif
-
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
@@ -179,20 +175,20 @@ namespace framework{
//*****************************************************************************************************************
// XInterface, XTypeProvider
//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( DispatchProvider ,
- OWeakObject ,
- DIRECT_INTERFACE(css::lang::XTypeProvider ),
- DIRECT_INTERFACE(css::frame::XDispatchProvider ),
- DIRECT_INTERFACE(css::lang::XEventListener )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( DispatchProvider ,
- css::lang::XTypeProvider ,
- css::frame::XDispatchProvider ,
- css::lang::XEventListener
- )
-
-/*-************************************************************************************************************//**
+DEFINE_XINTERFACE_2( DispatchProvider ,
+ OWeakObject ,
+ DIRECT_INTERFACE(css::lang::XTypeProvider ),
+ DIRECT_INTERFACE(css::frame::XDispatchProvider)
+ )
+
+DEFINE_XTYPEPROVIDER_2( DispatchProvider ,
+ css::lang::XTypeProvider ,
+ css::frame::XDispatchProvider
+ )
+
+//_________________________________________________________________________________________________________________
+
+/**
@short standard ctor/dtor
@descr These initialize a new instance of tihs class with needed informations for work.
We hold a weakreference to our owner frame which start dispatches at us.
@@ -201,248 +197,89 @@ DEFINE_XTYPEPROVIDER_3 ( DispatchProvider ,
@seealso using at owner
- @param "xFactory", reference to servicemanager to create new services.
- @param "xFrame" , reference to our owner frame.
- @return -
+ @param xFactory
+ reference to servicemanager to create new services.
+ @param xFrame
+ reference to our owner frame.
- @onerror -
-*//*-*************************************************************************************************************/
+ @modified 17.05.2002 10:07, as96863
+*/
DispatchProvider::DispatchProvider( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ,
const css::uno::Reference< css::frame::XFrame >& xFrame )
// Init baseclasses first
- : ThreadHelpBase ( &Application::GetSolarMutex() )
- , TransactionBase ( )
- , OWeakObject ( )
+ : ThreadHelpBase( &Application::GetSolarMutex() )
+ , OWeakObject ( )
// Init member
- , m_xFrame ( xFrame )
- , m_xFactory ( xFactory )
- // Don't initialize dispatch helper ...
- // because we create it on demand!
+ , m_xFrame ( xFrame )
+ , m_xFactory ( xFactory )
{
- // Safe impossible cases
- // We need valid informations about ouer owner for working.
- LOG_ASSERT2( implcp_ctor( xFactory, xFrame ), "DispatchProvider::DispatchProvider()", "Invalid parameter detected!\n" )
-
- // Open object for working!
- m_aTransactionManager.setWorkingMode( E_WORK );
}
-//*****************************************************************************************************************
+css::uno::WeakReference< css::mozilla::XPluginInstance > DispatchProvider::m_xPluginInterceptor=NULL;
+
+//_________________________________________________________________________________________________________________
+
+/**
+ @short protected(!) dtor for deinitializing
+ @descr We made it protected to prevent using of us as base class instead as a member.
+
+ @modified 17.05.2002 10:05, as96863
+ */
DispatchProvider::~DispatchProvider()
{
- // A dtor isn't a good place to make anything ...
- // Do it in dispose/ing()!
- // We are listener on our owner frame ...
}
-/*-************************************************************************************************************//**
+//_________________________________________________________________________________________________________________
+
+/**
@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 doesn'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 plugin or 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!).
- @seealso -
-
- @param "aURL" , URL to dispatch.
- @param "sTargetFrameName" , name of searched frame.
- @param "nSearchFlags" , flags for searching.
- @return A reference a dispatcher for these URL (if someone was found!).
-
- @onerror We return a NULL-reference.
@threadsafe yes
-*//*-*************************************************************************************************************/
+ @modified 17.05.2002 10:59, as96863
+*/
css::uno::Reference< css::frame::XDispatch > SAL_CALL DispatchProvider::queryDispatch( const css::util::URL& aURL ,
const ::rtl::OUString& sTargetFrameName ,
sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Check incoming parameter ...
- LOG_ASSERT2( implcp_queryDispatch( aURL, sTargetFrameName, nSearchFlags ), "DispatchProvider::queryDispatch()", "Invalid Parameter detected!" )
- // Register operation as transaction and reject wrong calls!
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
+ css::uno::Reference< css::frame::XDispatch > xDispatcher;
- // Set default return value if query failed.
- css::uno::Reference< css::frame::XDispatch > xReturn;
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ /* SAFE { */
ReadGuard aReadLock( m_aLock );
-
- // Make snapshot of neccessary member by using a read lock.
- // Resolve weakreference to owner and hold a normal reference till the end of this method.
- // So he couldn't die .-)
- css::uno::Reference< css::frame::XFrame > xOwner ( m_xFrame.get(), css::uno::UNO_QUERY );
- css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory;
-
+ css::uno::Reference< css::frame::XFrame > xOwner( m_xFrame.get(), css::uno::UNO_QUERY );
aReadLock.unlock();
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
+ /* } SAFE */
- if (xOwner.is())
- {
- // Classify target of this dispatch call to find right dispatch helper!
- // Try to get neccessary informations from tree environment.
- TargetInfo aInfo ( xOwner, sTargetFrameName, nSearchFlags );
- ETargetClass eResult= TargetFinder::classifyQueryDispatch( aInfo );
- switch( eResult )
- {
- //-----------------------------------------------------------------------------------------------------
- case E_SELF : {
- // 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!
- // Attention: Desktop has no controller - don't ask him!
- if( aInfo.eFrameType != E_DESKTOP )
- {
- css::uno::Reference< css::frame::XDispatchProvider > xController( xOwner->getController(), css::uno::UNO_QUERY );
- if( xController.is() == sal_True )
- {
- xReturn = xController->queryDispatch( aURL, sTargetFrameName, nSearchFlags );
- }
- }
- // If controller has no fun to dispatch these URL - we must search another right dispatcher.
- // Search for any registered protocol handler first.
- // Note: member "m_aProtocolHandlerCache" use singleton mechanism to implement an internal threadsafe data container
- // and use a ref count member too. On the other side he lives till we die. So we can use it without a lock.
- if (!xReturn.is())
- {
- ProtocolHandler aHandler;
- if (m_aProtocolHandlerCache.search(aURL,&aHandler))
- {
- css::uno::Reference< css::frame::XDispatchProvider > xHandler(
- xFactory->createInstance(aHandler.m_sUNOName),
- css::uno::UNO_QUERY);
- if (xHandler.is())
- xReturn = xHandler->queryDispatch(aURL,SPECIALTARGET_SELF,0);
- }
- // Not for controller - not for protocol handler
- // It should be a loadable content - may be a file. Check it ...
- // This check is neccessary 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 (!xReturn.is() && implts_isLoadableContent(aURL))
- {
- xReturn = implts_getOrCreateDispatchHelper( E_SELFDISPATCHER );
- }
- }
- }
- break;
- //-----------------------------------------------------------------------------------------------------
- case E_CREATETASK : {
- // Check ucb support before you create dispatch helper.
- // He could do nothing then ... but it doesnt perform, if we try it!
- if( implts_isLoadableContent( aURL ) == sal_True )
- {
- css::uno::Reference < css::frame::XFramesSupplier > xDesktop( xOwner, css::uno::UNO_QUERY );
- css::uno::Reference < css::frame::XFrame > xTask = xDesktop->getActiveFrame();
- css::uno::Reference < css::mozilla::XPluginInstance > xPlug( xTask, css::uno::UNO_QUERY );
- if ( xPlug.is() )
- {
- css::uno::Reference < css::frame::XDispatchProvider > xProv( xTask, css::uno::UNO_QUERY );
- xReturn = xProv->queryDispatch( aURL, sTargetFrameName, nSearchFlags );
- }
- else
- xReturn = implts_getOrCreateDispatchHelper( E_BLANKDISPATCHER );
- }
- }
- break;
- //-----------------------------------------------------------------------------------------------------
- case E_DEFAULT : {
- // Check ucb support before you create dispatch helper.
- // He could do nothing then ... but it doesnt perform, if we try it!
- if( implts_isLoadableContent( aURL ) == sal_True )
- {
- css::uno::Reference < css::frame::XFramesSupplier > xDesktop( xOwner, css::uno::UNO_QUERY );
- css::uno::Reference < css::frame::XFrame > xTask = xDesktop->getActiveFrame();
- css::uno::Reference < css::mozilla::XPluginInstance > xPlug( xTask, css::uno::UNO_QUERY );
- if ( xPlug.is() )
- {
- css::uno::Reference < css::frame::XDispatchProvider > xProv( xTask, css::uno::UNO_QUERY );
- xReturn = xProv->queryDispatch( aURL, SPECIALTARGET_SELF, 0 );
- }
- else
- xReturn = implts_getOrCreateDispatchHelper( E_DEFAULTDISPATCHER );
- }
- }
- break;
- //-----------------------------------------------------------------------------------------------------
- case E_PARENT :
- case E_FORWARD_UP : {
- css::uno::Reference< css::frame::XDispatchProvider > xParent( xOwner->getCreator(), css::uno::UNO_QUERY );
- if( xParent.is() == sal_True )
- {
- xReturn = xParent->queryDispatch( aURL, sTargetFrameName, nSearchFlags );
- }
- }
- break;
- //-----------------------------------------------------------------------------------------------------
- case E_BEAMER : {
- css::uno::Reference< css::frame::XDispatchProvider > xBeamer( xOwner->findFrame( SPECIALTARGET_BEAMER, css::frame::FrameSearchFlag::CHILDREN || css::frame::FrameSearchFlag::SELF ), css::uno::UNO_QUERY );
- if( xBeamer.is() == sal_True )
- {
- xReturn = xBeamer->queryDispatch( aURL, SPECIALTARGET_SELF, 0 );
- }
- else
- {
- css::uno::Reference< css::frame::XDispatchProvider > xController( xOwner->getController(), css::uno::UNO_QUERY );
- if( xController.is() == sal_True )
- {
- xReturn = xController->queryDispatch( aURL, sTargetFrameName, nSearchFlags );
- }
- }
- }
- break;
- //-----------------------------------------------------------------------------------------------------
- case E_MENUBAR : {
- xReturn = implts_getOrCreateDispatchHelper( E_MENUDISPATCHER );
- }
- break;
- //-----------------------------------------------------------------------------------------------------
- case E_HELPAGENT : {
- xReturn = implts_getOrCreateDispatchHelper( E_HELPAGENTDISPATCHER );
- }
- break;
- //-----------------------------------------------------------------------------------------------------
- case E_TASKS :
- case E_DEEP_DOWN :
- case E_FLAT_DOWN :
- case E_DEEP_BOTH :
- case E_FLAT_BOTH : {
- sal_Int32 nNewFlags = nSearchFlags ;
- nNewFlags &= ~css::frame::FrameSearchFlag::CREATE;
- css::uno::Reference< css::frame::XFrame > xFrame = xOwner->findFrame( sTargetFrameName, nNewFlags );
- if( xFrame.is() == sal_True )
- {
- xReturn = css::uno::Reference< css::frame::XDispatchProvider >( xFrame, css::uno::UNO_QUERY )->queryDispatch( aURL, SPECIALTARGET_SELF, 0 );
- }
- else
- if(
- ( aInfo.bCreationAllowed == sal_True ) &&
- ( implts_isLoadableContent( aURL ) == sal_True )
- )
- {
- css::uno::Any aParameter;
- aParameter <<= sTargetFrameName;
- xReturn = implts_getOrCreateDispatchHelper( E_CREATEDISPATCHER, aParameter );
- }
- }
- break;
- //-----------------------------------------------------------------------------------------------------
- #ifdef ENABLE_WARNINGS
- default : {
- if( eResult != E_UNKNOWN )
- {
- LOG_WARNING( "DispatchProvider::queryDispatch()", "No valid result found ... could it be an algorithm error?!" )
- }
- }
- break;
- #endif
- }
- }
+ css::uno::Reference< css::frame::XDesktop > xDesktopCheck( xOwner, css::uno::UNO_QUERY );
+ css::uno::Reference< css::mozilla::XPluginInstance > xPluginCheck ( xOwner, css::uno::UNO_QUERY );
+
+ if (xDesktopCheck.is())
+ xDispatcher = implts_queryDesktopDispatch(xOwner, aURL, sTargetFrameName, nSearchFlags);
+ else
+ if (xPluginCheck.is())
+ xDispatcher = implts_queryPluginDispatch(xOwner, aURL, sTargetFrameName, nSearchFlags);
+ else
+ xDispatcher = implts_queryFrameDispatch(xOwner, aURL, sTargetFrameName, nSearchFlags);
- // Return result of this operation.
- return xReturn;
+ 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.
@@ -451,292 +288,642 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL DispatchProvider::queryDis
@seealso method queryDispatch()
- @param "aURL" , URL to dispatch.
- @param "sTargetFrameName" , name of searched frame.
- @param "nSearchFlags" , flags for searching.
- @return A reference a dispatcher for these URL (if someone was found!).
+ @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.
- @onerror We return a NULL-reference.
@threadsafe yes
-*//*-*************************************************************************************************************/
+ @modified 17.05.2002 09:55, as96863
+*/
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 )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Check incoming parameter ...
- LOG_ASSERT2( implcp_queryDispatches( lDescriptions ), "DispatchProvider::queryDispatches()", "Invalid Parameter detected!" )
- // Register operation as transaction and reject wrong calls!
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
+ // 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 );
- // Set default return value if query failed.
- css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > lDispatcher;
+ // 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 );
+ }
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- ReadGuard aReadLock( m_aLock );
+ return lDispatcher;
+}
- // Make snapshot of neccessary member by using a read lock.
- // Resolve weakreference to owner and hold a normal reference till the end of this method.
- // So he couldn't die .-)
- css::uno::Reference< css::frame::XFrame > xOwner( m_xFrame.get(), css::uno::UNO_QUERY );
+//_________________________________________________________________________________________________________________
- aReadLock.unlock();
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
+/**
+ @short set a new plugin frame for intercepting special queryDispatch() requests directly
+ @descr Some requests (e.g. creation of new tasks) must be done by forwarding it to the
+ used browser. Normaly we can start a search for any existing plugin instance on our
+ desktop container to detect (a) if we run in plugin mode and (b) to use one of such
+ plugins to send the request to the browser. It can be very expensive. So
+ we optimize this process. If the desktop gets a new child frame which represent a plugin
+ he set it as a static member on this class. So all dispatch objects inside the frame tree
+ knows them and can can use it. But we hold a weak reference only. So we the plugin mustn't
+ be deregistered again. We can try to get the real reference and if it failed we don't use it.
+
+ @threadsafe yes
+ @modified 17.05.2002 08:25, as96863
+ */
+void DispatchProvider::setPluginInterceptor( const css::uno::Reference< css::mozilla::XPluginInstance >& xPlugin )
+{
+ /* STATIC SAFE { */
+ WriteGuard aExclusivLock( LockHelper::getGlobalLock() );
+ m_xPluginInterceptor = xPlugin;
+ aExclusivLock.unlock();
+ /* } STATIC SAFE */
+}
- if( xOwner.is() == sal_True )
+//_________________________________________________________________________________________________________________
+
+/**
+ @short helper for queryDispatch()
+ @descr Every member of the frame tree (frame, task, plugin, desktop) must handle such request
+ in another way. So we implement different specialized metods for every one.
+
+ @threadsafe yes
+ @modified 17.05.2002 08:38, as96863
+ */
+css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryDesktopDispatch( const css::uno::Reference< css::frame::XFrame > xDesktop ,
+ const css::util::URL& aURL ,
+ const ::rtl::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_HELPAGENT) || // 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
+ )
{
- // Get count of all given discriptors ...
- sal_Int32 nCount = lDescriptions.getLength();
- if( nCount > 0 )
+ return NULL;
+ }
+
+ // If we must load such URL we should check if ucb support it.
+ // Otherwhise we create some dispatch objects which can't handle them.
+ sal_Bool bIsLoadable = implts_isLoadableContent(aURL);
+
+ /* TODO: In special plugin mode we must use the already found plugin frame to forward the request
+ to the browser. Thats the only solution till we get the functionality to create
+ an emtpy browser task synchronously.
+ */
+
+ /* STATIC SAFE { */
+ ReadGuard aGlobalReadLock( LockHelper::getGlobalLock() );
+ css::uno::Reference< css::frame::XDispatchProvider > xPlugin( m_xPluginInterceptor.get(), css::uno::UNO_QUERY );
+ aGlobalReadLock.unlock();
+ /* } STATIC SAFE */
+
+ //-----------------------------------------------------------------------------------------------------
+ // 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 (bIsLoadable)
{
- // ... to get enough memory for expected dispatcher list
- // We can't get more dispatcher as descriptors exist!
- lDispatcher.realloc( nCount );
- // Step over all descriptors and try to get any dispatcher for it.
- for( sal_Int32 nPosition=0; nPosition<nCount; ++nPosition )
+ if (xPlugin.is())
+ {
+ css::uno::Reference< css::frame::XDispatchProvider > xProvider( xPlugin, css::uno::UNO_QUERY );
+ xDispatcher = xProvider->queryDispatch(aURL,SPECIALTARGET_BLANK,0); // ask him for _blank ... not for _self!
+ }
+ else
{
- lDispatcher[nPosition] = queryDispatch( lDescriptions[nPosition].FeatureURL ,
- lDescriptions[nPosition].FrameName ,
- lDescriptions[nPosition].SearchFlags );
+ xDispatcher = implts_getOrCreateDispatchHelper( E_BLANKDISPATCHER, xDesktop );
}
}
}
- return lDispatcher;
+ //-----------------------------------------------------------------------------------------------------
+ // I.II) "_default"
+ // This is a combination of search an empty task for recycling - or create a new one.
+ // Normaly we can use a specialized dispatch object for that ... but not for plugin mode.
+ // Such search isn't provided there.
+ //-----------------------------------------------------------------------------------------------------
+ else
+ if (sTargetFrameName==SPECIALTARGET_DEFAULT)
+ {
+ if (bIsLoadable)
+ {
+ if (xPlugin.is())
+ {
+ css::uno::Reference< css::frame::XDispatchProvider > xProvider( xPlugin, css::uno::UNO_QUERY );
+ xDispatcher = xProvider->queryDispatch(aURL,SPECIALTARGET_BLANK,0); // ask him for _blank ... not for _default!
+ }
+ else
+ {
+ xDispatcher = implts_getOrCreateDispatchHelper( E_DEFAULTDISPATCHER, 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.getLength()<1 )
+ )
+ {
+ if (!bIsLoadable)
+ 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);
+ }
+ else
+ // if it couldn't be found - but creation was allowed
+ // use special dispatcher for creatio or froward it to the browser
+ if (nSearchFlags & css::frame::FrameSearchFlag::CREATE)
+ {
+ if (xPlugin.is())
+ {
+ css::uno::Reference< css::frame::XDispatchProvider > xProvider( xPlugin, css::uno::UNO_QUERY );
+ xDispatcher = xProvider->queryDispatch(aURL,SPECIALTARGET_BLANK,0);
+ }
+ else
+ {
+ css::uno::Any aParameter;
+ aParameter <<= sTargetFrameName;
+ xDispatcher = implts_getOrCreateDispatchHelper( E_CREATEDISPATCHER, xDesktop, aParameter );
+ }
+ }
+ }
+
+ return xDispatcher;
}
-/*-****************************************************************************************************//**
- @interface XEventListener
- @short release this object
- @descr This implementation is used as a helper of a Task, PlugInFrame or Frame.
- These services could get a dispose() call from his owner.
- We should die at the same time - disposed by our owner frame!
- That's why we are a listener for disposing events ...
+//_________________________________________________________________________________________________________________
+
+css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryFrameDispatch( const css::uno::Reference< css::frame::XFrame > xFrame ,
+ const css::util::URL& aURL ,
+ const ::rtl::OUString& sTargetFrameName ,
+ sal_Int32 nSearchFlags )
+{
+ css::uno::Reference< css::frame::XDispatch > xDispatcher;
+
+ // If we must load such URL we should check if ucb support it.
+ // Otherwhise we create some dispatch objects which can't handle them.
+ sal_Bool bIsLoadable = implts_isLoadableContent(aURL);
+
+ /* TODO: In special plugin mode we must use the already found plugin frame to forward the request
+ to the browser. Thats the only solution till we get the functionality to create
+ an emtpy browser task synchronously.
+ */
+
+ /* STATIC SAFE { */
+ ReadGuard aGlobalReadLock( LockHelper::getGlobalLock() );
+ css::uno::Reference< css::frame::XDispatchProvider > xPlugin( m_xPluginInterceptor.get(), css::uno::UNO_QUERY );
+ aGlobalReadLock.unlock();
+ /* } STATIC SAFE */
+
+ //-----------------------------------------------------------------------------------------------------
+ // 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.
+ // Another eason is a possible plugin mode!
+ //-----------------------------------------------------------------------------------------------------
+ if (
+ (sTargetFrameName==SPECIALTARGET_BLANK ) ||
+ (sTargetFrameName==SPECIALTARGET_DEFAULT)
+ )
+ {
+ if (xPlugin.is())
+ {
+ css::uno::Reference< css::frame::XDispatchProvider > xProvider( xPlugin, css::uno::UNO_QUERY );
+ xDispatcher = xProvider->queryDispatch(aURL,SPECIALTARGET_BLANK,0); // ask him for _blank ... not for _default!
+ }
+ else
+ {
+ css::uno::Reference< css::frame::XDispatchProvider > xParent( xFrame->getCreator(), css::uno::UNO_QUERY );
+ if (xParent.is())
+ xDispatcher = xParent->queryDispatch(aURL, sTargetFrameName, 0); // its a special target - ignore search flags
+ }
+ }
- @attention We accept disposing events of our owner frame only!
+ //-----------------------------------------------------------------------------------------------------
+ // I.II) "_menubar"
+ // Special mode on frame or task to receive the local menu. Not supported by findFrame()
+ //-----------------------------------------------------------------------------------------------------
+ else
+ if (sTargetFrameName==SPECIALTARGET_MENUBAR)
+ {
+ xDispatcher = implts_getOrCreateDispatchHelper( E_MENUDISPATCHER, xFrame );
+ }
- @seealso method Frame::dispose()
+ //-----------------------------------------------------------------------------------------------------
+ // I.III) "_helpagent"
+ // Special mode on frame or task to start the help agent inside this frame. Not supported by findFrame()
+ //-----------------------------------------------------------------------------------------------------
+ else
+ if (sTargetFrameName==SPECIALTARGET_HELPAGENT)
+ {
+ xDispatcher = implts_getOrCreateDispatchHelper( E_HELPAGENTDISPATCHER, xFrame );
+ }
- @param "aEvent", describe the source of this event and should be the owner of this object.
- @return -
+ //-----------------------------------------------------------------------------------------------------
+ // I.IV) "_helpagent"
+ // 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 (sTargetFrameName==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);
+ }
+ }
- @onerror We do nothing.
- @threadsafe yes
-*//*-*****************************************************************************************************/
-void SAL_CALL DispatchProvider::disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException )
+ //-----------------------------------------------------------------------------------------------------
+ // I.V) "_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 (
+ (sTargetFrameName==SPECIALTARGET_SELF) ||
+ (sTargetFrameName.getLength()<1 )
+ )
+ {
+ // 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.
+ // Note: member "m_aProtocolHandlerCache" use singleton mechanism to implement an internal threadsafe data container
+ // and use a ref count member too. On the other side he lives till we die. So we can use it without a lock.
+ if ( ! xDispatcher.is() )
+ {
+ ProtocolHandler aHandler;
+ if (m_aProtocolHandlerCache.search(aURL,&aHandler))
+ {
+ /* SAFE { */
+ ReadGuard aReadLock( m_aLock );
+ css::uno::Reference< css::frame::XDispatchProvider > xHandler( m_xFactory->createInstance(aHandler.m_sUNOName), css::uno::UNO_QUERY);
+ aReadLock.unlock();
+ /* } SAFE */
+ if (xHandler.is())
+ xDispatcher = xHandler->queryDispatch(aURL,SPECIALTARGET_SELF,0);
+ }
+ }
+ // Not for controller - not for protocol handler
+ // It should be a loadable content - may be a file. Check it ...
+ // This check is neccessary 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() ) &&
+ ( bIsLoadable )
+ )
+ {
+ 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(sTargetFrameName, 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 browser (for plugin mode) or to the desktop
+ // (for nomal mode).
+ // 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)
+ {
+ if (xPlugin.is())
+ {
+ css::uno::Reference< css::frame::XDispatchProvider > xProvider( xPlugin, css::uno::UNO_QUERY );
+ xDispatcher = xProvider->queryDispatch(aURL, sTargetFrameName, css::frame::FrameSearchFlag::CREATE);
+ }
+ else
+ {
+ css::uno::Reference< css::frame::XDispatchProvider > xParent( xFrame->getCreator(), css::uno::UNO_QUERY );
+ if (xParent.is())
+ xDispatcher = xParent->queryDispatch(aURL, sTargetFrameName, css::frame::FrameSearchFlag::CREATE);
+ }
+ }
+ }
+
+ return xDispatcher;
+}
+
+//_________________________________________________________________________________________________________________
+
+css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_queryPluginDispatch( const css::uno::Reference< css::frame::XFrame > xPlugin ,
+ const css::util::URL& aURL ,
+ const ::rtl::OUString& sTargetFrameName ,
+ sal_Int32 nSearchFlags )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Safe impossible cases
- // This method is not defined for all incoming parameter.
- LOG_ASSERT2( implcp_disposing( aEvent ), "DispatchProvider::disposing()", "Invalid parameter detected!" )
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- WriteGuard aWriteLock( m_aLock );
- // Try to get access on our owner frame. If he already died ... we will get some trouble.
- // But normaly HE sended this event ... if we should handle it.
- css::uno::Reference< css::frame::XFrame > xOwner( m_xFrame.get(), css::uno::UNO_QUERY );
- // Ignore event, if source isn't our owner frame!
- // Nobody should dispose us ... if he isn't our real owner.
- sal_Bool bIgnore = sal_True;
- if(
- ( xOwner.is() == sal_True ) &&
- ( aEvent.Source == xOwner )
- )
+ css::uno::Reference< css::frame::XDispatch > xDispatcher;
+
+ // If we must load such URL we should check if ucb support it.
+ // Otherwhise we create some dispatch objects which can't handle them.
+ sal_Bool bIsLoadable = implts_isLoadableContent(aURL);
+
+ //-----------------------------------------------------------------------------------------------------
+ // I.I) "_blank", "_default", "_self", ""
+ // Such requests must be forwarded to the browser!
+ // Normaly the _default mode search for any target which can be recycled or try to find out
+ // if requested ressource was already loaded. But currently we can't support that for plugin mode.
+ //-----------------------------------------------------------------------------------------------------
+ if (
+ (sTargetFrameName==SPECIALTARGET_BLANK ) ||
+ (sTargetFrameName==SPECIALTARGET_DEFAULT) ||
+ (sTargetFrameName==SPECIALTARGET_SELF ) ||
+ (sTargetFrameName.getLength()<1 )
+ )
+ {
+ if (bIsLoadable)
+ xDispatcher = implts_getOrCreateDispatchHelper( E_PLUGINDISPATCHER, xPlugin );
+ }
+
+ //-----------------------------------------------------------------------------------------------------
+ // I.II) Most other targets or flags can be handled by the base class functionality
+ // of a PlugInFrame - the Frame. But look for case of not found target in combination with
+ // the CREATE flag. Such request must be forwarded to the browser too!
+ //-----------------------------------------------------------------------------------------------------
+ else
{
- bIgnore = sal_False;
+ sal_Int32 nRightFlags = nSearchFlags;
+ nRightFlags &= ~css::frame::FrameSearchFlag::CREATE;
+
+ xDispatcher = implts_queryFrameDispatch(xPlugin, aURL, sTargetFrameName, nRightFlags);
+ if (
+ ( ! xDispatcher.is() ) &&
+ ( nSearchFlags & css::frame::FrameSearchFlag::CREATE )
+ )
+ {
+ if (bIsLoadable)
+ xDispatcher = implts_getOrCreateDispatchHelper( E_PLUGINDISPATCHER, xPlugin );
+ }
}
- aWriteLock.unlock();
- if( bIgnore == sal_False )
+ return xDispatcher;
+}
+
+//_________________________________________________________________________________________________________________
+
+/**
+ @short search for a registered protocol handler and ask him for a dispatch object
+ @descr Such protocol handler doesn't need any target frame. They handle special URL protocols.
+
+ @param aURL
+ the dispatch URL for which may a handler is registered
+ @return A dispatch object if a handler was found or <NULL/> if not.
+
+ @threadsafe yes
+ @modified 16.05.2002 15:52, as96863
+*/
+css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_searchProtocolHandler( const css::util::URL& aURL )
+{
+ css::uno::Reference< css::frame::XDispatch > xDispatcher;
+ ProtocolHandler aHandler ;
+ if (m_aProtocolHandlerCache.search(aURL,&aHandler)) // This member is threadsafe by himself and lives if we live - we doesn't need any mutex here.
{
- // Follow lines are safe too - because our transaction helper are threadsafe by herself ...
- // and after "setWorkingMode() we are alone!
-
- /* Disposing of a service is a special procedure.
- We have registered all interface operations as non breakable ones.
- So we must disable this object for working - further requests will be rejected then.
- After that we can release our internal structures ... and die :_(
- */
-
- // It's a good idea to hold usself alive ... Because we should prevent us against dieing during tis operation.
- // Other people could release there references to use ... and then our dtor is called automaticly!
- css::uno::Reference< css::uno::XInterface > xThis( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
-
- // Register operation as transaction and reject wrong calls!
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
- // Now we should disable object for real working.
- // Don't forget to disable current running transaction of THIS method.
- // setWorkingMode() will wait for all current registered transactions ...
- // and will wait for ever then!
- aTransaction.stop();
- m_aTransactionManager.setWorkingMode( E_BEFORECLOSE );
-
- // Now we are allone. Further calls are rejected by E_HARDEXCEPTIONS ... see before.
- // We can work on our member without any lock!
-
- /* Attention
- If you call some internal impl methods during follow lines ... you should
- think about it again. Because: These internal methods could úse E_SOFTEXCEPTIONS to work
- during this disposing call ... and use some internal member too.
- So you must synchronize it!
- */
-
- // Release our internal dispatch helper ... BUT DON'T dispose it!
- // They are listener on our owner frame too. So they will get same event from it and die herself.
- // But we should release our references and stop working on it.
- m_xMenuDispatcher = css::uno::Reference< css::frame::XDispatch >();
- m_xHelpAgentDispatcher = css::uno::Reference< css::frame::XDispatch >();
- m_xBlankDispatcher = css::uno::Reference< css::frame::XDispatch >();
- m_xDefaultDispatcher = css::uno::Reference< css::frame::XDispatch >();
- m_xSelfDispatcher = css::uno::Reference< css::frame::XDispatch >();
-
- // Forget all other references too.
- m_xFactory = css::uno::Reference< css::lang::XMultiServiceFactory >();
- m_xFrame = css::uno::WeakReference< css::frame::XFrame >() ;
-
- // Disable object for working ... Do it for ever .-)
- m_aTransactionManager.setWorkingMode( E_CLOSE );
+ /* SAFE { */
+ css::uno::Reference< css::frame::XDispatchProvider > xHandler( m_xFactory->createInstance(aHandler.m_sUNOName), css::uno::UNO_QUERY );
+ /* } SAFE */
+ 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 methods. They return an already existing helper or create a new one otherwise.
-
- @seealso -
-
- @param "eHelper", specify type of helper
+ Thats why we implement this method. It return an already existing helper or create a new one otherwise.
+
+ @param eHelper
+ specify the requested dispatch helper
+ @param xOwner
+ the target of possible dispatch() call on created dispatch helper
+ @param aParameters
+ some of such helpers need special (optional) parameters
@return A reference to a dispatch helper.
- @onerror We return a NULL-reference.
@threadsafe yes
-*//*-*************************************************************************************************************/
-css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreateDispatchHelper( EDispatchHelper eHelper, const css::uno::Any& aParameters )
+ @modified 17.05.2002 10:14, as96863
+*/
+css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_getOrCreateDispatchHelper( EDispatchHelper eHelper ,
+ const css::uno::Reference< css::frame::XFrame >& xOwner ,
+ const css::uno::Any& aParameters )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Register operation as transaction and reject wrong calls!
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- WriteGuard aWriteLock( m_aLock );
-
css::uno::Reference< css::frame::XDispatch > xDispatchHelper;
- css::uno::Reference< css::frame::XFrame > xOwner( m_xFrame.get(), css::uno::UNO_QUERY );
- if( xOwner.is() == sal_True )
+ /* SAFE { */
+ ReadGuard aReadLock( m_aLock );
+ css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory;
+ aReadLock.unlock();
+ /* } SAFE */
+
+ switch (eHelper)
{
- switch( eHelper )
- {
- //-----------------------------------------------------------------------------------------------------
- case E_MENUDISPATCHER : {
- if( m_xMenuDispatcher.is() == sal_False )
- {
- MenuDispatcher* pDispatcher = new MenuDispatcher( m_xFactory, xOwner );
- m_xMenuDispatcher = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
- }
- xDispatchHelper = m_xMenuDispatcher;
- }
- break;
- //-----------------------------------------------------------------------------------------------------
- case E_HELPAGENTDISPATCHER : {
- if( m_xHelpAgentDispatcher.is() == sal_False )
- {
- HelpAgentDispatcher* pDispatcher = new HelpAgentDispatcher( xOwner );
- m_xHelpAgentDispatcher = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
- }
- xDispatchHelper = m_xHelpAgentDispatcher;
- }
- break;
- //-----------------------------------------------------------------------------------------------------
- case E_CREATEDISPATCHER : {
- // Don't hold these dispatch helper! Create it on demand for every given target name.
- // He could handle one target frame at one time only!
- ::rtl::OUString sTargetName;
- aParameters >>= sTargetName;
- CreateDispatcher* pDispatcher = new CreateDispatcher( m_xFactory, xOwner, sTargetName );
- xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
- }
- break;
- //-----------------------------------------------------------------------------------------------------
- case E_BLANKDISPATCHER : {
- if( m_xBlankDispatcher.is() == sal_False )
- {
- css::uno::Reference< css::frame::XFrame > xDesktop( xOwner, css::uno::UNO_QUERY );
- BlankDispatcher* pDispatcher = new BlankDispatcher( m_xFactory, xDesktop, sal_False );
- m_xBlankDispatcher = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
- }
- xDispatchHelper = m_xBlankDispatcher;
- }
- break;
- //-----------------------------------------------------------------------------------------------------
- case E_DEFAULTDISPATCHER : {
- if( m_xDefaultDispatcher.is() == sal_False )
- {
- css::uno::Reference< css::frame::XFrame > xDesktop( xOwner, css::uno::UNO_QUERY );
- BlankDispatcher* pDispatcher = new BlankDispatcher( m_xFactory, xDesktop, sal_True );
- m_xDefaultDispatcher = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
- }
- xDispatchHelper = m_xDefaultDispatcher;
- }
- break;
- //-----------------------------------------------------------------------------------------------------
- case E_SELFDISPATCHER : {
- if( m_xSelfDispatcher.is() == sal_False )
- {
- SelfDispatcher* pDispatcher = new SelfDispatcher( m_xFactory, xOwner );
- m_xSelfDispatcher = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
- }
- xDispatchHelper = m_xSelfDispatcher;
- }
- break;
- //-----------------------------------------------------------------------------------------------------
- case E_PLUGINDISPATCHER : {
- LOG_WARNING( "DispatchProvider::implts_getOrCreateDispatchHelper( E_PLUGINDISPATCHER )", "Not implemented yet!" )
- }
- break;
- }
+ case E_MENUDISPATCHER :
+ {
+ // Attention: Such menue dispatcher must be a singleton for this frame - means our owner frame.
+ // Otherwhise he can make some trouble.
+ /* SAFE { */
+ WriteGuard aWriteLock( m_aLock );
+ if ( ! m_xMenuDispatcher.is() )
+ {
+ MenuDispatcher* pDispatcher = new MenuDispatcher( xFactory, xOwner );
+ m_xMenuDispatcher = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
+ }
+ xDispatchHelper = m_xMenuDispatcher;
+ aWriteLock.unlock();
+ /* } SAFE */
+ }
+ break;
+
+ case E_HELPAGENTDISPATCHER :
+ {
+ // Attention: It's not a good idea to create this help agent twice for the same frame (window)
+ // May it will be shown twice too - and user activate the first one. Then he get the corresponding
+ // help window ... but there exist another help agent window on bottom side of the frame window.
+ // It's superflous. Create it on demand - but hold it alive till this provider dies.
+ /* SAFE { */
+ WriteGuard aWriteLock( m_aLock );
+ if ( ! m_xHelpAgentDispatcher.is() )
+ {
+ HelpAgentDispatcher* pDispatcher = new HelpAgentDispatcher( xOwner );
+ m_xHelpAgentDispatcher = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
+ }
+ xDispatchHelper = m_xHelpAgentDispatcher;
+ aWriteLock.unlock();
+ /* } SAFE */
+ }
+ break;
+
+ case E_CREATEDISPATCHER :
+ {
+ ::rtl::OUString sTargetName;
+ aParameters >>= sTargetName;
+ CreateDispatcher* pDispatcher = new CreateDispatcher( xFactory, xOwner, sTargetName );
+ 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())
+ {
+ BlankDispatcher* pDispatcher = new BlankDispatcher( xFactory, xDesktop, sal_False );
+ 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())
+ {
+ BlankDispatcher* pDispatcher = new BlankDispatcher( xFactory, xDesktop, sal_True );
+ xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
+ }
+ }
+ break;
+
+ case E_SELFDISPATCHER :
+ {
+ SelfDispatcher* pDispatcher = new SelfDispatcher( xFactory, xOwner );
+ xDispatchHelper = css::uno::Reference< css::frame::XDispatch >( static_cast< ::cppu::OWeakObject* >(pDispatcher), css::uno::UNO_QUERY );
+ }
+ break;
+
+ case E_PLUGINDISPATCHER :
+ {
+ LOG_WARNING( "DispatchProvider::implts_getOrCreateDispatchHelper( E_PLUGINDISPATCHER )", "Not implemented yet!" )
+ }
+ 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 to detect!
+ will be detected ... but there exist nothing for ral loading into a target frame!
- @seealso method queryDispatch()
-
- @param "aURL", URL which should be "detected"
- @return True , if somewhere could handle that
- False , otherwise
+ @param aURL
+ URL which should be "detected"
+ @return <TRUE/> if somewhere could handle that - <FALSE/> otherwise.
- @onerror We return False.
@threadsafe yes
-*//*-*************************************************************************************************************/
+ @modified 17.05.2002 09:47, as96863
+*/
sal_Bool DispatchProvider::implts_isLoadableContent( const css::util::URL& aURL )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Register operation as transaction and reject wrong calls!
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ /* SAFE { */
ReadGuard aReadLock( m_aLock );
css::uno::Reference< css::document::XTypeDetection > xDetection( m_xFactory->createInstance( SERVICENAME_TYPEDETECTION ), css::uno::UNO_QUERY );
css::uno::Reference< css::ucb::XContentProviderManager > xUCB ( m_xFactory->createInstance( SERVICENAME_UCBCONTENTBROKER ), css::uno::UNO_QUERY );
aReadLock.unlock();
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
+ /* } SAFE */
sal_Bool bLoadable = sal_False;
- if( xUCB.is() == sal_True )
- {
+ // (a) a UCB provide loadable contents only
+ if (xUCB.is())
bLoadable = xUCB->queryContentProvider( aURL.Complete ).is();
- }
// no else here!
+ // (b) if we can detect a type for given URL - it must be loadable too
if(
( bLoadable == sal_False ) &&
( xDetection.is() == sal_True )
@@ -746,6 +933,7 @@ sal_Bool DispatchProvider::implts_isLoadableContent( const css::util::URL& aURL
bLoadable = (sTypeName.getLength()>0);
}
// 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 )
@@ -757,97 +945,4 @@ sal_Bool DispatchProvider::implts_isLoadableContent( const css::util::URL& aURL
return bLoadable;
}
-/*-************************************************************************************************************//**
- @short debug-method to check incoming parameter of some other mehods of this class
- @descr The following methods are used to check parameters for other methods
- of this class. The return value is used directly for an ASSERT(...).
-
- @attention These methods are threadsafe ...
- because they don't work on internal member...
- they are static functions!
-
- @seealso ASSERTs in implementation!
-
- @param references to checking variables
- @return sal_True on invalid parameter<BR>
- sal_False otherway
-
- @onerror -
- @threadsafe yes
-*//*-*************************************************************************************************************/
-
-#ifdef ENABLE_ASSERTIONS
-
-//*****************************************************************************************************************
-sal_Bool DispatchProvider::implcp_ctor( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ,
- const css::uno::Reference< css::frame::XFrame >& xFrame )
-{
- return(
- ( &xFactory == NULL ) ||
- ( &xFrame == NULL ) ||
- ( xFactory.is() == sal_False ) ||
- ( xFrame.is() == sal_False )
- );
-}
-
-//*****************************************************************************************************************
-// Please don't check for empty strings on URL or target name. They are allowed!
-sal_Bool DispatchProvider::implcp_queryDispatch( const css::util::URL& aURL ,
- const ::rtl::OUString& sTargetFrameName,
- sal_Int32 nSearchFlags )
-{
- return(
- ( &aURL == NULL ) ||
- ( &sTargetFrameName == NULL ) ||
- (
- ( nSearchFlags != css::frame::FrameSearchFlag::AUTO ) &&
- ( !( nSearchFlags & css::frame::FrameSearchFlag::PARENT ) ) &&
- ( !( nSearchFlags & css::frame::FrameSearchFlag::SELF ) ) &&
- ( !( nSearchFlags & css::frame::FrameSearchFlag::CHILDREN ) ) &&
- ( !( nSearchFlags & css::frame::FrameSearchFlag::CREATE ) ) &&
- ( !( nSearchFlags & css::frame::FrameSearchFlag::SIBLINGS ) ) &&
- ( !( nSearchFlags & css::frame::FrameSearchFlag::TASKS ) ) &&
- ( !( nSearchFlags & css::frame::FrameSearchFlag::ALL ) ) &&
- ( !( nSearchFlags & css::frame::FrameSearchFlag::GLOBAL ) )
- )
- );
-}
-
-//*****************************************************************************************************************
-// Use implcp_queryDispatch() for every descriptor item to check parameter!
-sal_Bool DispatchProvider::implcp_queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptions )
-{
- sal_Bool bFail = sal_False;
- if( &lDescriptions == NULL )
- {
- bFail = sal_True;
- }
- else
- {
- sal_Int32 nCount = lDescriptions.getLength();
- for( sal_Int32 nPosition=0; nPosition<nCount; ++nPosition )
- {
- if( implcp_queryDispatch( lDescriptions[nPosition].FeatureURL ,
- lDescriptions[nPosition].FrameName ,
- lDescriptions[nPosition].SearchFlags ) == sal_False )
- {
- bFail = sal_True;
- break;
- }
- }
- }
- return bFail;
-}
-
-//*****************************************************************************************************************
-sal_Bool DispatchProvider::implcp_disposing( const css::lang::EventObject& aEvent )
-{
- return(
- ( &aEvent == NULL ) ||
- ( aEvent.Source.is() == sal_False )
- );
-}
-
-#endif // #ifdef ENABLE_ASSERTIONS
-
-} // namespace framework
+} // namespace framework
diff --git a/framework/source/dispatch/helpagentdispatcher.cxx b/framework/source/dispatch/helpagentdispatcher.cxx
index 510764d141..b0681f4ec6 100644
--- a/framework/source/dispatch/helpagentdispatcher.cxx
+++ b/framework/source/dispatch/helpagentdispatcher.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: helpagentdispatcher.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: oj $ $Date: 2001-11-05 10:06:23 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:52:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -213,6 +213,8 @@ namespace framework
//--------------------------------------------------------------------
void SAL_CALL HelpAgentDispatcher::disposing( const EventObject& _rSource ) throw (RuntimeException)
{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xSelfHold( static_cast< ::com::sun::star::frame::XDispatch* >(this), ::com::sun::star::uno::UNO_QUERY );
+
// not interested in case the container window is closed (this should be handled by our owner)
// interested in case our agent window is closed (we're the only instance allowed to close it)
@@ -334,6 +336,8 @@ namespace framework
//--------------------------------------------------------------------
void HelpAgentDispatcher::closeAgentWindow()
{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xSelfHold( static_cast< ::com::sun::star::frame::XDispatch* >(this), ::com::sun::star::uno::UNO_QUERY );
+
// now acquire the SolarMutex ...
::vos::OGuard aSolarGuard(Application::GetSolarMutex());
// ... and our own mutex
@@ -425,6 +429,9 @@ namespace framework
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
+ * Revision 1.4 2001/11/05 10:06:23 oj
+ * #94279# set Listener to NULL in dtor
+ *
* Revision 1.3 2001/10/11 09:21:51 pb
* fix: #93014# dont show tooltip
*
diff --git a/framework/source/dispatch/menudispatcher.cxx b/framework/source/dispatch/menudispatcher.cxx
index 25b5bc8bc3..b97efee4c0 100644
--- a/framework/source/dispatch/menudispatcher.cxx
+++ b/framework/source/dispatch/menudispatcher.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: menudispatcher.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: as $ $Date: 2001-07-02 13:26:10 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:52:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -123,10 +123,6 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
-#ifndef _COM_SUN_STAR_FRAME_XTASKSSUPPLIER_HPP_
-#include <com/sun/star/frame/XTasksSupplier.hpp>
-#endif
-
#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATION_HPP_
#include <com/sun/star/container/XEnumeration.hpp>
#endif
diff --git a/framework/source/helper/makefile.mk b/framework/source/helper/makefile.mk
index 6d9999d7ff..e338172342 100644
--- a/framework/source/helper/makefile.mk
+++ b/framework/source/helper/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.17 $
+# $Revision: 1.18 $
#
-# last change: $Author: cd $ $Date: 2001-12-04 07:46:09 $
+# last change: $Author: as $ $Date: 2002-05-23 12:53:02 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -81,9 +81,7 @@ CDEFS+=-DCOMPMOD_NAMESPACE=framework
# --- Generate -----------------------------------------------------
SLOFILES= $(SLO)$/timerhelper.obj \
- $(SLO)$/otasksaccess.obj \
- $(SLO)$/otasksenumeration.obj \
- $(SLO)$/ocomponentaccess.obj \
+ $(SLO)$/ocomponentaccess.obj \
$(SLO)$/ocomponentenumeration.obj \
$(SLO)$/oframes.obj \
$(SLO)$/opluginframedispatcher.obj \
diff --git a/framework/source/helper/ocomponentenumeration.cxx b/framework/source/helper/ocomponentenumeration.cxx
index 65aefa2e75..cab69e20b9 100644
--- a/framework/source/helper/ocomponentenumeration.cxx
+++ b/framework/source/helper/ocomponentenumeration.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ocomponentenumeration.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: as $ $Date: 2001-06-11 10:28:39 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:53:11 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -90,7 +90,6 @@
namespace framework{
using namespace ::com::sun::star::container ;
-using namespace ::com::sun::star::frame ;
using namespace ::com::sun::star::lang ;
using namespace ::com::sun::star::uno ;
using namespace ::cppu ;
diff --git a/framework/source/helper/oframes.cxx b/framework/source/helper/oframes.cxx
index 59dd34159b..5b541126de 100644
--- a/framework/source/helper/oframes.cxx
+++ b/framework/source/helper/oframes.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: oframes.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: as $ $Date: 2001-06-11 10:29:50 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:53:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -365,7 +365,8 @@ Any SAL_CALL OFrames::getByIndex( sal_Int32 nIndex ) throw( IndexOutOfBoundsExce
{
// Get element form container.
// (If index not valid, FrameContainer return NULL!)
- aReturnValue <<= (*m_pFrameContainer)[nIndex];
+ if (m_pFrameContainer->getCount()>nIndex)
+ aReturnValue <<= (*m_pFrameContainer)[nIndex];
}
// Return result of this operation.
diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx
index 32ebf086f0..6a915f62a9 100644
--- a/framework/source/register/registerservices.cxx
+++ b/framework/source/register/registerservices.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: registerservices.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: as $ $Date: 2002-05-02 11:41:56 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:53:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -110,10 +110,6 @@
#include <services/documentproperties.hxx>
#endif
-#ifndef __FRAMEWORK_SERVICES_TASK_HXX_
-#include <services/task.hxx>
-#endif
-
#ifndef __FRAMEWORK_SERVICES_FRAME_HXX_
#include <services/frame.hxx>
#endif
@@ -147,7 +143,6 @@ COMPONENTGETIMPLEMENTATIONENVIRONMENT
COMPONENTWRITEINFO ( COMPONENTINFO( ::framework::URLTransformer )
COMPONENTINFO( ::framework::PlugInFrame )
COMPONENTINFO( ::framework::Desktop )
- COMPONENTINFO( ::framework::Task )
COMPONENTINFO( ::framework::Frame )
COMPONENTINFO( ::framework::DocumentProperties )
COMPONENTINFO( ::framework::SoundHandler )
@@ -161,7 +156,6 @@ COMPONENTWRITEINFO ( COMPONENTINFO( ::framework::URLTransformer
COMPONENTGETFACTORY ( IFFACTORY( ::framework::URLTransformer ) else
IFFACTORY( ::framework::PlugInFrame ) else
IFFACTORY( ::framework::Desktop ) else
- IFFACTORY( ::framework::Task ) else
IFFACTORY( ::framework::Frame ) else
IFFACTORY( ::framework::DocumentProperties ) else
IFFACTORY( ::framework::SoundHandler ) else
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index 026b85ddd9..6ce0b2bde9 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: desktop.cxx,v $
*
- * $Revision: 1.37 $
+ * $Revision: 1.38 $
*
- * last change: $Author: cd $ $Date: 2002-04-22 07:18:26 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:53:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,10 +67,6 @@
#include <services/desktop.hxx>
#endif
-#ifndef __FRAMEWORK_HELPER_OTASKSACCESS_HXX_
-#include <helper/otasksaccess.hxx>
-#endif
-
#ifndef __FRAMEWORK_HELPER_OCOMPONENTACCESS_HXX_
#include <helper/ocomponentaccess.hxx>
#endif
@@ -189,6 +185,10 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#endif
+#ifndef _COM_SUN_STAR_UTIL_XCLOSEABLE_HPP_
+#include <com/sun/star/util/XCloseable.hpp>
+#endif
+
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
@@ -524,24 +524,30 @@ sal_Bool SAL_CALL Desktop::terminate() throw( css::uno::RuntimeException )
for( sal_Int32 nPosition=0; nPosition<nCount; ++nPosition )
{
// Get an element from container and cast it to task.
- // IT MUST BE A TASK! Childs of desktop everytime tasks. No pure frames accepted!
- // It can be a plugin too, but a plugin is derived from a task ...!
- css::uno::Reference< css::frame::XTask > xTask( lTasks[nPosition], css::uno::UNO_QUERY );
+ css::uno::Reference< css::util::XCloseable > xTask( lTasks[nPosition], css::uno::UNO_QUERY );
// Ask task for terminating. If anyone say "NO" ...
- // ... we must reset oer default return value to "NO" too!
+ // ... we must reset our default return value to "NO" too!
try
{
- if( xTask->close() == sal_False )
- {
- bTaskVeto = sal_True;
- break;
- }
+ // Don't deliver ownershipt of this task to any other one! => means call close(sal_False).
+ xTask->close(sal_False);
+ // Don't remove the task from our child container!
+ // A task do it by herself inside close ...
+ }
+ catch( css::util::CloseVetoException& )
+ {
+ // Any internal process of this task disagree with our request.
+ // Safe this state and break this loop. Following task willn't be asked!
+ bTaskVeto = sal_True;
+ break;
}
catch( css::lang::DisposedException& )
{
// Task already closed by another thread or user ...
// It doesn't matter! Because dead is dead is dead ...!
// Do nothing and try to close next one.
+ // But may it's agood idea to release this task from our container
+ m_aChildTaskContainer.remove( lTasks[nPosition] );
}
}
}
@@ -931,7 +937,7 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL Desktop::loadComponentFrom
// ... but nothing is perfect here ... it's a hack currently and shouldn't occure in current
// implementation.
LOG_WARNING("Desktop::loadComponentFromURL()", "Missing interface XNotifyingDispatch. Return NULL!")
- css::uno::Reference< css::frame::XTask > xClosable( xSysTask, css::uno::UNO_QUERY );
+ css::uno::Reference< css::util::XCloseable > xClosable( xSysTask, css::uno::UNO_QUERY );
if(
bPlugin &&
xClosable.is() &&
@@ -941,7 +947,13 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL Desktop::loadComponentFrom
)
)
{
- xClosable->close();
+ try
+ {
+ xClosable->close(sal_True);
+ }
+ catch( css::util::CloseVetoException& )
+ {
+ }
}
return xComponent;
}
@@ -1026,13 +1038,15 @@ But; Don't forget - you will be the owner of returned object and must release it
*//*-*************************************************************************************************************/
css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL Desktop::getTasks() throw( css::uno::RuntimeException )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Register transaction and reject wrong calls.
+ LOG_WARNING("Desktop::getTasks()", "Use of obsolete interface XTaskSupplier")
+ return NULL;
+ /*
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
OTasksAccess* pTasksAccess = new OTasksAccess( this, &m_aChildTaskContainer );
css::uno::Reference< css::container::XEnumerationAccess > xAccess( static_cast< ::cppu::OWeakObject* >(pTasksAccess), css::uno::UNO_QUERY );
return xAccess;
+ */
}
/*-************************************************************************************************************//**
@@ -1055,11 +1069,13 @@ css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL Desktop::getT
*//*-*************************************************************************************************************/
css::uno::Reference< css::frame::XTask > SAL_CALL Desktop::getActiveTask() throw( css::uno::RuntimeException )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Register transaction and reject wrong calls.
+ /*
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
return css::uno::Reference< css::frame::XTask >( m_aChildTaskContainer.getActive(), css::uno::UNO_QUERY );
+ */
+ LOG_WARNING("Desktop::getActiveTask()", "Use of obsolete interface XTaskSupplier")
+ return NULL;
}
/*-************************************************************************************************************//**
@@ -1209,46 +1225,47 @@ css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::getActiveFrame() thr
*//*-*************************************************************************************************************/
void SAL_CALL Desktop::initialize( const css::uno::Reference< css::awt::XWindow >& xWindow ) throw( css::uno::RuntimeException )
{
- LOG_ERROR( "Desktop::initialize()", "Not implemented! Desktop has no window." )
}
//*****************************************************************************************************************
css::uno::Reference< css::awt::XWindow > SAL_CALL Desktop::getContainerWindow() throw( css::uno::RuntimeException )
{
- LOG_ERROR( "Desktop::getContainerWindow()", "Not implemented! Desktop has no window." )
return css::uno::Reference< css::awt::XWindow >();
}
//*****************************************************************************************************************
void SAL_CALL Desktop::setCreator( const css::uno::Reference< css::frame::XFramesSupplier >& xCreator ) throw( css::uno::RuntimeException )
{
- LOG_ERROR( "Desktop::setCreator()", "Not implemented! Desktop has no parent." )
}
//*****************************************************************************************************************
css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL Desktop::getCreator() throw( css::uno::RuntimeException )
{
- LOG_ERROR( "Desktop::getCreator()", "Not implememted! Desktop has no parent." )
return css::uno::Reference< css::frame::XFramesSupplier >();
}
//*****************************************************************************************************************
::rtl::OUString SAL_CALL Desktop::getName() throw( css::uno::RuntimeException )
{
- LOG_ERROR( "Desktop::getName()", "Not implemented! Desktop could not have any valid name!" )
- return ::rtl::OUString();
+ /* SAFE { */
+ ReadGuard aReadLock( m_aLock );
+ return m_sName;
+ /* } SAFE */
}
//*****************************************************************************************************************
void SAL_CALL Desktop::setName( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException )
{
- LOG_ERROR( "Desktop::setName()", "Not implemented! Desktop could not have any valid name!" )
+ /* SAFE { */
+ WriteGuard aWriteLock( m_aLock );
+ m_sName = sName;
+ aWriteLock.unlock();
+ /* } SAFE */
}
//*****************************************************************************************************************
sal_Bool SAL_CALL Desktop::isTop() throw( css::uno::RuntimeException )
{
- LOG_ERROR( "Desktop::isTop()", "Not implemented! Desktop is top every time!" )
return sal_True;
}
@@ -1271,7 +1288,6 @@ void SAL_CALL Desktop::deactivate() throw( css::uno::RuntimeException )
//*****************************************************************************************************************
sal_Bool SAL_CALL Desktop::isActive() throw( css::uno::RuntimeException )
{
- LOG_ERROR( "Desktop::isActive()", "Not implemented! Desktop is active every time!" )
return sal_True;
}
@@ -1279,34 +1295,29 @@ sal_Bool SAL_CALL Desktop::isActive() throw( css::uno::RuntimeException )
sal_Bool SAL_CALL Desktop::setComponent( const css::uno::Reference< css::awt::XWindow >& xComponentWindow ,
const css::uno::Reference< css::frame::XController >& xController ) throw( css::uno::RuntimeException )
{
- LOG_ERROR( "Desktop::setComponent()", "Not implemented! No component allowed on desktop." )
return sal_False;
}
//*****************************************************************************************************************
css::uno::Reference< css::awt::XWindow > SAL_CALL Desktop::getComponentWindow() throw( css::uno::RuntimeException )
{
- LOG_ERROR( "Desktop::getComponentWindow()", "Not implemented! No component allowed on desktop." )
return css::uno::Reference< css::awt::XWindow >();
}
//*****************************************************************************************************************
css::uno::Reference< css::frame::XController > SAL_CALL Desktop::getController() throw( css::uno::RuntimeException )
{
- LOG_ERROR( "Desktop::getController()", "Not implemented! No controller allowed on desktop." )
return css::uno::Reference< css::frame::XController >();
}
//*****************************************************************************************************************
void SAL_CALL Desktop::contextChanged() throw( css::uno::RuntimeException )
{
- LOG_ERROR( "Desktop::contextChanged()", "Not implemented! Desktop has no component." )
}
//*****************************************************************************************************************
void SAL_CALL Desktop::addFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException )
{
- LOG_ERROR( "Desktop::addFrameActionListener()", "Not implemented! There is no component inside." )
}
//*****************************************************************************************************************
@@ -1314,7 +1325,6 @@ void SAL_CALL Desktop::addFrameActionListener( const css::uno::Reference< css::f
//*****************************************************************************************************************
void SAL_CALL Desktop::removeFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException )
{
- LOG_ERROR( "Desktop::addFrameActionListener()", "Not implemented! There is no component inside." )
}
/*-************************************************************************************************************//**
@@ -1347,76 +1357,152 @@ void SAL_CALL Desktop::removeFrameActionListener( const css::uno::Reference< css
css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::findFrame( const ::rtl::OUString& sTargetFrameName ,
sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Safe impossible cases
- LOG_ASSERT2( implcp_findFrame( sTargetFrameName, nSearchFlags ), "Desktop::findFrame()", "Invalid parameter detected." )
- // Register transaction and reject wrong calls.
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
- // Log some important informations in special debug mode!
- LOG_PARAMETER_FINDFRAME( "Desktop", ::rtl::OUString(), sTargetFrameName, nSearchFlags )
+ css::uno::Reference< css::frame::XFrame > xTarget;
+
+ //-----------------------------------------------------------------------------------------------------
+ // 0) Ignore wrong parameter!
+ // We doesn't support search for following special targets.
+ // If we reject this requests - we mustnt check for such names
+ // in following code again and again. If we do not so -wrong
+ // search results can occure!
+ //-----------------------------------------------------------------------------------------------------
+ if (
+ (sTargetFrameName==SPECIALTARGET_DEFAULT ) || // valid for dispatches - not for findFrame()!
+ (sTargetFrameName==SPECIALTARGET_MENUBAR ) || // valid for dispatches - not for findFrame()!
+ (sTargetFrameName==SPECIALTARGET_HELPAGENT) || // valid for dispatches - not for findFrame()!
+ (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;
+ }
- // Set default return value if method failed.
- css::uno::Reference< css::frame::XFrame > xSearchedFrame;
+ //-----------------------------------------------------------------------------------------------------
+ // I) check for special defined targets first which must be handled exclusive.
+ // force using of "if() else if() ..."
+ //-----------------------------------------------------------------------------------------------------
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ // get threadsafe some neccessary member which are neccessary for following functionality
+ /* SAFE { */
ReadGuard aReadLock( m_aLock );
-
css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory;
- css::uno::Reference< css::frame::XFrame > xThis ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
-
aReadLock.unlock();
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
+ /* } SAFE */
+
+ //-----------------------------------------------------------------------------------------------------
+ // I.I) "_blank"
+ // create a new task as child of this desktop instance
+ // Note: Used helper TaskCreator use us automaticly ...
+ //-----------------------------------------------------------------------------------------------------
+ if ( sTargetFrameName==SPECIALTARGET_BLANK )
+ {
+ TaskCreator aCreator(xFactory);
+ xTarget = aCreator.createTask(::rtl::OUString(),sal_False);
+ }
- // Ask helper for right decision for given parameter.
- TargetInfo aInfo ( sTargetFrameName, nSearchFlags, E_DESKTOP, m_aChildTaskContainer.hasElements(), sal_False, ::rtl::OUString(), ::rtl::OUString() );
- ETargetClass eResult = TargetFinder::classifyFindFrame( aInfo );
- switch( eResult )
+ //-----------------------------------------------------------------------------------------------------
+ // I.II) "_top"
+ // We are top by definition
+ //-----------------------------------------------------------------------------------------------------
+ else
+ if ( sTargetFrameName==SPECIALTARGET_TOP )
{
- case E_CREATETASK : {
- // Set visible state to FALSE - because; we cant support headless office otherwise!
- // No additional informations are available ... so we should use a compromise ...
- TaskInfo aCreateInfo( xFactory, xThis, sTargetFrameName, sal_False );
- xSearchedFrame = TaskCreator::createSystemTask( aCreateInfo );
- }
- break;
- case E_TASKS : {
- xSearchedFrame = m_aChildTaskContainer.searchDirectChildren( sTargetFrameName );
- }
- break;
- case E_DEEP_DOWN : {
- xSearchedFrame = m_aChildTaskContainer.searchDeepDown( sTargetFrameName );
- }
- break;
- case E_FLAT_DOWN : {
- xSearchedFrame = m_aChildTaskContainer.searchFlatDown( sTargetFrameName );
- }
- break;
- #ifdef ENABLE_WARNINGS
- default : {
- if( eResult != E_UNKNOWN )
- {
- LOG_ERROR( "Desktop::findFrame()", "Unexpected result of TargetFinder::classify() detected!" )
- }
- }
- break;
- #endif
+ xTarget = this;
}
- // If no right target could be found - but CREATE flag was set ... do it; create a new task.
- if (
- ( xSearchedFrame.is() == sal_False ) &&
- ( aInfo.bCreationAllowed == sal_True )
- )
+ //-----------------------------------------------------------------------------------------------------
+ // I.III) "_self", ""
+ // This mean this "frame" in every case.
+ //-----------------------------------------------------------------------------------------------------
+ else
+ if (
+ ( sTargetFrameName==SPECIALTARGET_SELF ) ||
+ ( sTargetFrameName.getLength()<1 )
+ )
{
- TaskInfo aCreateInfo( xFactory, xThis, sTargetFrameName, sal_False );
- xSearchedFrame = TaskCreator::createSystemTask( aCreateInfo );
+ xTarget = this;
}
- LOG_RESULT_FINDFRAME( "Desktop", m_sName, xSearchedFrame )
+ else
+ {
+ //-------------------------------------------------------------------------------------------------
+ // II) otherwhise use optional given search flags
+ // force using of combinations of such flags. means no "else" part of use if() statements.
+ // But we ust break further searches if target was already found.
+ // Order of using flags is fix: SELF - CHILDREN - SIBLINGS - PARENT
+ // TASK and CREATE are handled special.
+ // But note: Such flags are not valid for the desktop - especialy SIBLINGS or PARENT.
+ //-------------------------------------------------------------------------------------------------
+
+ // get threadsafe some neccessary member which are neccessary for following functionality
+ /* SAFE { */
+ aReadLock.lock();
+ ::rtl::OUString sOwnName = m_sName;
+ aReadLock.unlock();
+ /* } SAFE */
+
+ //-------------------------------------------------------------------------------------------------
+ // II.I) SELF
+ // Check for right name. If it's the searched one return ourself - otherwhise
+ // ignore this flag.
+ //-------------------------------------------------------------------------------------------------
+ if (
+ (nSearchFlags & css::frame::FrameSearchFlag::SELF) &&
+ (sOwnName == sTargetFrameName )
+ )
+ {
+ xTarget = this;
+ }
+
+ //-------------------------------------------------------------------------------------------------
+ // II.II) TASKS
+ // This is a special flag. Normaly it regulate search inside tasks and forbid access to parent trees.
+ // But the desktop exists outside such task trees. They are our sub trees. So the desktop implement
+ // a special feature: We use it to start search on our direct childrens only. That means we supress
+ // search on ALL child frames. May that can be usefull to get access on opened document tasks
+ // only without filter out all non realy required sub frames ...
+ // Used helper method on our container doesn't create any frame - its a search only.
+ //-------------------------------------------------------------------------------------------------
+ if (
+ ( ! xTarget.is() ) &&
+ (nSearchFlags & css::frame::FrameSearchFlag::TASKS)
+ )
+ {
+ xTarget = m_aChildTaskContainer.searchOnDirectChildrens(sTargetFrameName);
+ }
- // return result of operation.
- return xSearchedFrame;
+ //-------------------------------------------------------------------------------------------------
+ // II.III) CHILDREN
+ // Search on all children for the given target name.
+ // An empty name value can't occure here - because it must be already handled as "_self"
+ // before. Used helper function of container doesn't create any frame.
+ // It makes a deep search only.
+ //-------------------------------------------------------------------------------------------------
+ if (
+ ( ! xTarget.is() ) &&
+ (nSearchFlags & css::frame::FrameSearchFlag::CHILDREN)
+ )
+ {
+ xTarget = m_aChildTaskContainer.searchOnAllChildrens(sTargetFrameName);
+ }
+
+ //-------------------------------------------------------------------------------------------------
+ // II.IV) CREATE
+ // If we haven't found any valid target frame by using normal flags - but user allowed us to create
+ // a new one ... we should do that. Used TaskCreator use us automaticly as parent!
+ //-------------------------------------------------------------------------------------------------
+ if (
+ ( ! xTarget.is() ) &&
+ (nSearchFlags & css::frame::FrameSearchFlag::CREATE)
+ )
+ {
+ TaskCreator aCreator(xFactory);
+ xTarget = aCreator.createTask(sTargetFrameName,sal_False);
+ }
+ }
+
+ return xTarget;
}
/*-************************************************************************************************************//**
@@ -1888,11 +1974,7 @@ void SAL_CALL Desktop::getFastPropertyValue( css::uno::Any& aValue ,
@onerror -
@threadsafe yes
*//*-*************************************************************************************************************/
-#if SUPD>640
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL Desktop::getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException)
-#else
-css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL Desktop::getPropertySetInfo()
-#endif
{
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Register transaction and reject wrong calls.
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index 1392d439a5..c5d88e24b7 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: frame.cxx,v $
*
- * $Revision: 1.48 $
+ * $Revision: 1.49 $
*
- * last change: $Author: as $ $Date: 2002-05-15 12:13:38 $
+ * last change: $Author: as $ $Date: 2002-05-23 12:54:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -99,6 +99,10 @@
#include <classes/droptargetlistener.hxx>
#endif
+#ifndef __FRAMEWORK_CLASSES_TASKCREATOR_HXX_
+#include <classes/taskcreator.hxx>
+#endif
+
#ifndef __FRAMEWORK_THREADHELP_TRANSACTIONGUARD_HXX_
#include <threadhelp/transactionguard.hxx>
#endif
@@ -123,10 +127,6 @@
#include <com/sun/star/awt/XTopWindow.hpp>
#endif
-#ifndef _COM_SUN_STAR_FRAME_XTASK_HPP_
-#include <com/sun/star/frame/XTask.hpp>
-#endif
-
#ifndef _COM_SUN_STAR_FRAME_XDESKTOP_HPP_
#include <com/sun/star/frame/XDesktop.hpp>
#endif
@@ -179,6 +179,10 @@
#include <com/sun/star/awt/WindowAttribute.hpp>
#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
+#include <com/sun/star/container/XIndexAccess.hpp>
+#endif
+
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
@@ -266,7 +270,7 @@ namespace framework{
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XINTERFACE_17 ( Frame ,
+DEFINE_XINTERFACE_19 ( Frame ,
OWeakObject ,
DIRECT_INTERFACE(css::lang::XTypeProvider ),
DIRECT_INTERFACE(css::lang::XServiceInfo ),
@@ -284,10 +288,12 @@ DEFINE_XINTERFACE_17 ( Frame
DIRECT_INTERFACE(css::awt::XTopWindowListener ),
DIRECT_INTERFACE(css::awt::XFocusListener ),
DERIVED_INTERFACE(css::lang::XEventListener, css::awt::XWindowListener ),
- DIRECT_INTERFACE(css::document::XActionLockable )
+ DIRECT_INTERFACE(css::document::XActionLockable ),
+ DIRECT_INTERFACE(css::util::XCloseable ),
+ DIRECT_INTERFACE(css::util::XCloseBroadcaster )
)
-DEFINE_XTYPEPROVIDER_16 ( Frame ,
+DEFINE_XTYPEPROVIDER_18 ( Frame ,
css::lang::XTypeProvider ,
css::lang::XServiceInfo ,
css::frame::XFramesSupplier ,
@@ -303,7 +309,9 @@ DEFINE_XTYPEPROVIDER_16 ( Frame
css::awt::XWindowListener ,
css::awt::XTopWindowListener ,
css::awt::XFocusListener ,
- css::lang::XEventListener
+ css::lang::XEventListener ,
+ css::util::XCloseable ,
+ css::util::XCloseBroadcaster
)
DEFINE_XSERVICEINFO_MULTISERVICE ( Frame ,
@@ -400,6 +408,9 @@ Frame::Frame( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFac
, m_bIsFrameTop ( sal_True ) // I think we are top without a parent ... and there is no parent yet!
, m_bConnected ( sal_False ) // There exist no component inside of use => sal_False, we are not connected!
, m_nExternalLockCount ( 0 )
+ , m_bSelfClose ( sal_False ) // Important!
+ , m_bIsPlugIn ( sal_False )
+ , m_aPoster ( LINK( this, Frame, implts_windowClosing ) )
{
// Check incoming parameter to avoid against wrong initialization.
LOG_ASSERT2( implcp_ctor( xFactory ), "Frame::Frame()", "Invalid parameter detected!" )
@@ -656,45 +667,33 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL Frame::getContainerWindow() th
/*-****************************************************************************************************//**
@short set parent frame
@descr We need a parent to support some functionality! e.g. findFrame()
+ By the way we use the chance to set an internal information about our top state.
+ So we must not check this information during every isTop() call.
+ We are top, if our parent is the desktop instance or we havent any parent.
- @seealso method getCreator()
- @seealso method findFrame()
- @seealso method queryDispatch()
+ @seealso getCreator()
+ @seealso findFrame()
+ @seealso isTop()
+ @seealos m_bIsFrameTop
- @param "xCreator", valid reference to our owner frame, which should implement a supplier interface.
- @return -
+ @param xCreator
+ valid reference to our new owner frame, which should implement a supplier interface
- @onerror We do nothing.
+ @threadsafe yes
+ @modified 08.05.2002 09:35, as96863
*//*-*****************************************************************************************************/
void SAL_CALL Frame::setCreator( const css::uno::Reference< css::frame::XFramesSupplier >& xCreator ) throw( css::uno::RuntimeException )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Check incoming parameter.
- LOG_ASSERT2( implcp_setCreator( xCreator ), "Frame::setCreator()", "Invalid parameter detected!" )
- // Register transaction and reject wrong calls.
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- WriteGuard aWriteLock( m_aLock );
+ /* SAFE { */
+ WriteGuard aWriteLock( m_aLock );
+ m_xParent = xCreator;
+ aWriteLock.unlock();
+ /* } SAFE */
- // Safe new reference to different parent.
- m_xParent = xCreator;
- // Set/reset "IsTop" flag, if ouer new parent is a frame, task or desktop ....
- // or if no parent exist!
- css::uno::Reference< css::frame::XTask > xIsTask ( m_xParent, css::uno::UNO_QUERY );
- css::uno::Reference< css::frame::XDesktop > xIsDesktop ( m_xParent, css::uno::UNO_QUERY );
- if (
- ( xIsTask.is() == sal_True ) ||
- ( xIsDesktop.is() == sal_True ) ||
- ( m_xParent.is() == sal_False )
- )
- {
- m_bIsFrameTop = sal_True;
- }
- else
- {
- m_bIsFrameTop = sal_False;
- }
+ css::uno::Reference< css::frame::XDesktop > xIsDesktop( xCreator, css::uno::UNO_QUERY );
+ m_bIsFrameTop = ( xIsDesktop.is() || ! xCreator.is() );
}
/*-****************************************************************************************************//**
@@ -733,14 +732,10 @@ css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL Frame::getCreator()
*//*-*****************************************************************************************************/
::rtl::OUString SAL_CALL Frame::getName() throw( css::uno::RuntimeException )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Register transaction and reject wrong calls.
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ /* SAFE { */
ReadGuard aReadLock( m_aLock );
-
return m_sName;
+ /* } SAFE */
}
/*-****************************************************************************************************//**
@@ -759,19 +754,14 @@ css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL Frame::getCreator()
*//*-*****************************************************************************************************/
void SAL_CALL Frame::setName( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Check incoming parameter.
- LOG_ASSERT2( implcp_setName( sName ), "Frame::setName()", "Invalid parameter detected!" )
- // Register transaction and reject wrong calls.
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ /* SAFE { */
WriteGuard aWriteLock( m_aLock );
-
// Set new name ... but look for invalid special target names!
// They are not allowed to set.
m_sName = sName;
impl_filterSpecialTargets( m_sName );
+ aWriteLock.unlock();
+ /* } SAFE */
}
/*-****************************************************************************************************//**
@@ -781,126 +771,287 @@ void SAL_CALL Frame::setName( const ::rtl::OUString& sName ) throw( css::uno::Ru
be contained in other frames. This hierarchie ist searched by
this method.
First some special names are taken into account, i.e. "",
- "_self", "_top", "_active" etc. The nSearchFlags are ignored
+ "_self", "_top", "_blank" etc. The nSearchFlags are ignored
when comparing these names with sTargetFrameName, further steps are
controlled by the search flags. If allowed, the name of the frame
itself is compared with the desired one, then ( again if allowed )
- the method findFrame() is called for all children of the frame.
- At last findFrame may be called for the parent frame ( if allowed ).
+ the method findFrame() is called for all children, for siblings
+ and as last for the parent frame.
If no frame with the given name is found until the top frames container,
a new top one is created, if this is allowed by a special
flag. The new frame also gets the desired name.
- @seealso class TargetFinder
-
- @param "sTargetFrameName", special names (_blank, _self) or real name of target frame
- @return css::uno::Reference to found or may be new created frame.
+ @param sTargetFrameName
+ special names (_blank, _self) or real name of target frame
+ @param nSearchFlags
+ optional flags which regulate search for non special target frames
- @onerror A null reference is returned.
+ @return A reference to found or may be new created frame.
+ @threadsafe yes
+ @modified 16.05.2002 11:08, as96863
*//*-*****************************************************************************************************/
css::uno::Reference< css::frame::XFrame > SAL_CALL Frame::findFrame( const ::rtl::OUString& sTargetFrameName,
sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException )
{
- /*ATTENTION
- This method has a problem!
- Sometimes we must search recursive if user combine flags PARENT and CHILDREN.
- We search at our children first and forward findFrame() to our parent then.
- It could be that he call us back. But we have already searched at our children!
- I think it's a problem of performance ... errors couldn't occure.
- Please don't use a bool "bProtectRecursivSearches" or something like that
- in this method. Otherwise some calls failed or blocked if findFrame() is called
- from different threads! First call set bool to "true" all other threads
- do nothing and return NULL as search result due to first caller reset this bool.
- This will be a bug. Without this bool-member may be we have some performance problems
- but no errors!!!
- */
+ css::uno::Reference< css::frame::XFrame > xTarget;
+
+ //-----------------------------------------------------------------------------------------------------
+ // 0) Ignore wrong parameter!
+ // We doesn't support search for following special targets.
+ // If we reject this requests - we mustnt check for such names
+ // in following code again and again. If we do not so -wrong
+ // search results can occure!
+ //-----------------------------------------------------------------------------------------------------
+ if (
+ (sTargetFrameName==SPECIALTARGET_DEFAULT ) || // valid for dispatches - not for findFrame()!
+ (sTargetFrameName==SPECIALTARGET_MENUBAR ) || // valid for dispatches - not for findFrame()!
+ (sTargetFrameName==SPECIALTARGET_HELPAGENT) // valid for dispatches - not for findFrame()!
+ )
+ {
+ return NULL;
+ }
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Check incoming parameter.
- LOG_ASSERT2( implcp_findFrame( sTargetFrameName, nSearchFlags ), "Frame::findFrame()", "Invalid parameter detected." )
- // Register transaction and reject wrong calls.
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
+ //-----------------------------------------------------------------------------------------------------
+ // I) check for special defined targets first which must be handled exclusive.
+ // force using of "if() else if() ..."
+ //-----------------------------------------------------------------------------------------------------
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ // get threadsafe some neccessary member which are neccessary for following functionality
+ /* SAFE { */
ReadGuard aReadLock( m_aLock );
+ css::uno::Reference< css::frame::XFrame > xParent ( m_xParent, css::uno::UNO_QUERY );
+ css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory;
+ aReadLock.unlock();
+ /* } SAFE */
+
+ //-----------------------------------------------------------------------------------------------------
+ // I.I) "_blank"
+ // Not allowed for a normal frame - but for the desktop.
+ // Use helper class to do so. It use the desktop automaticly.
+ //-----------------------------------------------------------------------------------------------------
+ if ( sTargetFrameName==SPECIALTARGET_BLANK )
+ {
+ TaskCreator aCreator(xFactory);
+ xTarget = aCreator.createTask(::rtl::OUString(),sal_False);
+ }
- // Copy neccessary member and unlock the read lock ...
- // It's not neccessary for m_aChildFrameContainer ... because
- // he is threadsafe himself and live if we live.
- // We use a registered transaction to prevent us against
- // breaks during this operation!
- css::uno::Reference< css::frame::XFrame > xSearchedFrame ;
- css::uno::Reference< css::frame::XFrame > xThis ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
- css::uno::Reference< css::frame::XFrame > xParent ( m_xParent, css::uno::UNO_QUERY ) ;
- sal_Bool bParentExist = xParent.is() ;
- sal_Bool bChildrenExist = m_aChildFrameContainer.hasElements() ;
- ::rtl::OUString sMyName = m_sName ;
- ::rtl::OUString sParentName ;
- if( bParentExist == sal_True )
+ //-----------------------------------------------------------------------------------------------------
+ // I.II) "_parent"
+ // It doesn't matter if we have a valid parent or not. User ask for him and get it.
+ // An empty result is a valid result too.
+ //-----------------------------------------------------------------------------------------------------
+ else
+ if ( sTargetFrameName==SPECIALTARGET_PARENT )
{
- sParentName = xParent->getName();
+ xTarget = xParent;
}
- aReadLock.unlock();
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
+ //-----------------------------------------------------------------------------------------------------
+ // I.III) "_top"
+ // If we are not the top frame in this hierarchy, we must forward request to our parent.
+ // Otherwhise we must return ourself.
+ //-----------------------------------------------------------------------------------------------------
+ else
+ if ( sTargetFrameName==SPECIALTARGET_TOP )
+ {
+ if (isTop())
+ xTarget = this;
+ else
+ if (xParent.is()) // If we are not top - the parent MUST exist. But may it's better to check it again .-)
+ xTarget = xParent->findFrame(SPECIALTARGET_TOP,0);
+ }
- LOG_PARAMETER_FINDFRAME( "Frame", sMyName, sTargetFrameName, nSearchFlags )
+ //-----------------------------------------------------------------------------------------------------
+ // I.IV) "_self", ""
+ // This mean this frame in every case.
+ //-----------------------------------------------------------------------------------------------------
+ else
+ if (
+ ( sTargetFrameName==SPECIALTARGET_SELF ) ||
+ ( sTargetFrameName.getLength()<1 )
+ )
+ {
+ xTarget = this;
+ }
- // Use helper to classify search direction.
- // Attention: If he return ...BOTH -> please search down first ... and upper direction then!
- TargetInfo aInfo ( sTargetFrameName, nSearchFlags, E_FRAME, bChildrenExist, bParentExist, sMyName, sParentName );
- ETargetClass eResult = TargetFinder::classifyFindFrame( aInfo );
- switch( eResult )
+ //-----------------------------------------------------------------------------------------------------
+ // I.V) "_beamer"
+ // This is a special sub frame of any task. We must return it if we found it on our direct childrens
+ // or create it there if it not already exists.
+ // Note: Such beamer exists for task(top) frames only!
+ //-----------------------------------------------------------------------------------------------------
+ else
+ if ( sTargetFrameName==SPECIALTARGET_BEAMER )
{
- case E_SELF : {
- xSearchedFrame = xThis;
- }
- break;
- case E_PARENT : {
- xSearchedFrame = xParent;
- }
- break;
- case E_FORWARD_UP : {
- xSearchedFrame = xParent->findFrame( sTargetFrameName, nSearchFlags );
- }
- break;
- case E_DEEP_DOWN : {
- xSearchedFrame = m_aChildFrameContainer.searchDeepDown( sTargetFrameName );
- }
- break;
- case E_DEEP_BOTH : {
- xSearchedFrame = m_aChildFrameContainer.searchDeepDown( sTargetFrameName );
- if( xSearchedFrame.is() == sal_False )
- {
- xSearchedFrame = xParent->findFrame( sTargetFrameName, nSearchFlags );
- }
- }
- break;
- case E_FLAT_DOWN : {
- xSearchedFrame = m_aChildFrameContainer.searchFlatDown( sTargetFrameName );
- }
- break;
- case E_FLAT_BOTH : {
- xSearchedFrame = m_aChildFrameContainer.searchFlatDown( sTargetFrameName );
- if( xSearchedFrame.is() == sal_False )
- {
- xSearchedFrame = xParent->findFrame( sTargetFrameName, nSearchFlags );
- }
- }
- break;
- #ifdef ENABLE_WARNINGS
- default : {
- if( eResult != E_UNKNOWN )
- {
- LOG_ERROR( "Frame::findFrame()", "Unexpected result of TargetFinder::classify() detected!" )
- }
- }
+ // We are a task => search or create the beamer
+ if (isTop())
+ {
+ xTarget = m_aChildFrameContainer.searchOnDirectChildrens(SPECIALTARGET_BEAMER);
+ if ( ! xTarget.is() )
+ {
+ /* TODO
+ Creation not supported yet!
+ Wait for new layout manager service because we can't plug it
+ inside already opened document of this frame ...
+ */
+ }
+ }
+ // We arent a task => forward request to our parent or ignore it.
+ else
+ if (xParent.is())
+ xTarget = xParent->findFrame(SPECIALTARGET_BEAMER,0);
+ }
+
+ else
+ {
+ //-------------------------------------------------------------------------------------------------
+ // II) otherwhise use optional given search flags
+ // force using of combinations of such flags. means no "else" part of use if() statements.
+ // But we ust break further searches if target was already found.
+ // Order of using flags is fix: SELF - CHILDREN - SIBLINGS - PARENT
+ // TASK and CREATE are handled special.
+ //-------------------------------------------------------------------------------------------------
+
+ // get threadsafe some neccessary member which are neccessary for following functionality
+ /* SAFE { */
+ aReadLock.lock();
+ ::rtl::OUString sOwnName = m_sName;
+ aReadLock.unlock();
+ /* } SAFE */
+
+ //-------------------------------------------------------------------------------------------------
+ // II.I) SELF
+ // Check for right name. If it's the searched one return ourself - otherwhise
+ // ignore this flag.
+ //-------------------------------------------------------------------------------------------------
+ if (
+ (nSearchFlags & css::frame::FrameSearchFlag::SELF) &&
+ (sOwnName == sTargetFrameName )
+ )
+ {
+ xTarget = this;
+ }
+
+ //-------------------------------------------------------------------------------------------------
+ // II.II) CHILDREN
+ // Search on all children for the given target name.
+ // An empty name value can't occure here - because it must be already handled as "_self"
+ // before. Used helper function of container doesn't create any frame.
+ // It makes a deep search only.
+ //-------------------------------------------------------------------------------------------------
+ if (
+ ( ! xTarget.is() ) &&
+ (nSearchFlags & css::frame::FrameSearchFlag::CHILDREN)
+ )
+ {
+ xTarget = m_aChildFrameContainer.searchOnAllChildrens(sTargetFrameName);
+ }
+
+ //-------------------------------------------------------------------------------------------------
+ // II.III) TASKS
+ // This is a special flag. It regulate search on this task tree only or allow search on
+ // all other ones (which are sibling trees of us) too.
+ // Upper search must stop at this frame if we are the topest one and the TASK flag isn't set
+ // or we can ignore it if we have no valid parent.
+ //-------------------------------------------------------------------------------------------------
+ if (
+ ( isTop() && (nSearchFlags & css::frame::FrameSearchFlag::TASKS) ) ||
+ ( !isTop() )
+ )
+ {
+ //-------------------------------------------------------------------------------------------------
+ // II.III.I) SIBLINGS
+ // Search on all our direct siblings - means all childrens of our parent.
+ // Use this flag in combination with TASK. We must supress such upper search if
+ // user has not set it and if we are a top frame.
+ //
+ // Attention: Don't forward this request to our parent as a findFrame() call.
+ // In such case we must protect us against recursive calls.
+ // Use snapshot of our parent. But don't use queryFrames() of XFrames interface.
+ // Because it's return all siblings and all her childrens including our children too
+ // if we call it with the CHILDREN flag. We doesn't need that - we need the direct container
+ // items of our parent only to start searches there. So we must use the container interface
+ // XIndexAccess instead of XFrames.
+ //-------------------------------------------------------------------------------------------------
+ if (
+ ( ! xTarget.is() ) &&
+ (nSearchFlags & css::frame::FrameSearchFlag::SIBLINGS) &&
+ ( xParent.is() ) // search on siblings is impossible without a parent
+ )
+ {
+ css::uno::Reference< css::frame::XFramesSupplier > xSupplier( xParent, css::uno::UNO_QUERY );
+ if (xSupplier.is())
+ {
+ css::uno::Reference< css::container::XIndexAccess > xContainer( xSupplier->getFrames(), css::uno::UNO_QUERY );
+ if (xContainer.is())
+ {
+ sal_Int32 nCount = xContainer->getCount();
+ for( sal_Int32 i=0; i<nCount; ++i )
+ {
+ css::uno::Any aItem = xContainer->getByIndex(i);
+ css::uno::Reference< css::frame::XFrame > xSibling;
+ if (
+ ( !(aItem>>=xSibling) ) || // control unpacking
+ ( ! xSibling.is() ) || // check for valid items
+ ( xSibling==static_cast< ::cppu::OWeakObject* >(this) ) // ignore ourself! (We are a part of this container too - but search on our children was already done.)
+ )
+ {
+ continue;
+ }
+
+ // Don't allow upper search here! Use rigth flags to regulate it.
+ // And allow deep search on children only - if it was allowed for us too.
+ sal_Int32 nRightFlags = css::frame::FrameSearchFlag::SELF;
+ if (nSearchFlags & css::frame::FrameSearchFlag::CHILDREN)
+ nRightFlags |= css::frame::FrameSearchFlag::CHILDREN;
+ xTarget = xSibling->findFrame(sTargetFrameName, nRightFlags );
+ // perform search be breaking further search if a result exist.
+ if (xTarget.is())
break;
- #endif
+ }
+ }
+ }
+ }
+
+ //-------------------------------------------------------------------------------------------------
+ // II.III.II) PARENT
+ // Forward search to our parent (if he exists.)
+ // To prevent us against recursive and superflous calls (which can occure if we allow him
+ // to search on his childrens too) we must change used search flags.
+ //-------------------------------------------------------------------------------------------------
+ if (
+ ( ! xTarget.is() ) &&
+ (nSearchFlags & css::frame::FrameSearchFlag::PARENT) &&
+ ( xParent.is() )
+ )
+ {
+ if (xParent->getName() == sTargetFrameName)
+ xTarget = xParent;
+ else
+ {
+ sal_Int32 nRightFlags = nSearchFlags;
+ nRightFlags &= ~css::frame::FrameSearchFlag::CHILDREN;
+ xTarget = xParent->findFrame(sTargetFrameName, nRightFlags);
+ }
+ }
+ }
+
+ //-------------------------------------------------------------------------------------------------
+ // II.IV) CREATE
+ // If we haven't found any valid target frame by using normal flags - but user allowed us to create
+ // a new one ... we should do that. Used TaskCreator use Desktop instance automaticly as parent!
+ //-------------------------------------------------------------------------------------------------
+ if (
+ ( ! xTarget.is() ) &&
+ (nSearchFlags & css::frame::FrameSearchFlag::CREATE)
+ )
+ {
+ TaskCreator aCreator(xFactory);
+ xTarget = aCreator.createTask(sTargetFrameName,sal_False);
+ }
}
- LOG_RESULT_FINDFRAME( "Frame", sMyName, xSearchedFrame )
- // Return result of operation.
- return xSearchedFrame;
+
+ return xTarget;
}
/*-****************************************************************************************************//**
@@ -1185,30 +1336,333 @@ void SAL_CALL Frame::contextChanged() throw( css::uno::RuntimeException )
We accept null references! The xComponentWindow will be a child of our container window
and get all window events from us.
- @attention A current set component can disagree with suspending call!
- We don't set the new one and return with false.
+ @attention (a) A current set component can disagree with the suspend() request!
+ We don't set the new one and return with false then.
+ (b) It's possible to set:
+ (b1) a simple component here which supports the window only - no controller;
+ (b2) a full featured component which supports window and controller;
+ (b3) or both to NULL if outside code which to forget this component.
@seealso method getComponentWindow()
@seealso method getController()
- @param "xComponentWindow" , valid reference to new component window as child of internal container window
- @param "xController" , valid reference to new component controller
- @return true if operation was successful, false otherwise.
+ @param xComponentWindow
+ valid reference to new component window which will be a child of internal container window
+ May <NULL/> for releasing.
+ @param xController
+ reference to new component controller
+ (may <NULL/> for relasing or setting of a simple component)
- @onerror -
+ @return <TRUE/> if operation was successful, <FALSE/> otherwise.
+
+ @onerror We return <FALSE/>.
+ @threadsafe yes
+ @modified 06.05.2002 11:39, as96863
*//*-*****************************************************************************************************/
-sal_Bool SAL_CALL Frame::setComponent( const css::uno::Reference< css::awt::XWindow >& xComponentWindow ,
+sal_Bool SAL_CALL Frame::setComponent( const css::uno::Reference< css::awt::XWindow >& xComponentWindow ,
const css::uno::Reference< css::frame::XController >& xController ) throw( css::uno::RuntimeException )
{
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Check incoming parameter.
- LOG_ASSERT2( implcp_setComponent( xComponentWindow, xController ), "Frame::setComponent()", "Invalid parameter detected." )
- // Register transaction and reject wrong calls.
+ // Sometimes used by dispose() => soft exceptions!
+ TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS );
+
+ /*HACK
+ ... for sfx2! Sometimes he call me by using this combination.
+ */
+
+ return impl_setComponent(xComponentWindow, xController);
+
+ if (
+ (
+ ( xController.is() == sal_True ) &&
+ ( xComponentWindow.is() == sal_False )
+ ) == sal_False
+ )
+ {
+ /* SAFE AREA ------------------------------------------------------------------------------------------- */
+ // Normaly a ReadLock is enough ... but we need some write locks at later time.
+ // It's better to create it yet und use it later to create read AND write locks!!!
+ WriteGuard aWriteLock( m_aLock );
+
+ // Make snapshot of our internal member and states and release lock!
+ css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow ;
+ css::uno::Reference< css::awt::XWindow > xOldComponentWindow = m_xComponentWindow ;
+ css::uno::Reference< css::frame::XController > xOldController = m_xController ;
+ sal_Bool bControllerChange = ( m_xController != xController ) ;
+ sal_Bool bWindowChange = ( m_xComponentWindow != xComponentWindow ) ;
+ sal_Bool bConnected = m_bConnected ;
+ sal_Bool bHasFocus = ( m_eActiveState==E_FOCUS && m_xComponentWindow.is()==sal_True ) ;
+
+ aWriteLock.unlock();
+ /* UNSAFE AREA ----------------------------------------------------------------------------------------- */
+
+ // Release current component, if there is any.
+ if (
+ ( xOldComponentWindow.is() == sal_True ) ||
+ ( xOldController.is() == sal_True )
+ )
+ {
+ implts_sendFrameActionEvent( css::frame::FrameAction_COMPONENT_DETACHING );
+ }
+
+ // Always release controller before releasing window, because controller may want to access its window!
+ if( bControllerChange == sal_True )
+ {
+ if( xOldController.is() == sal_True )
+ {
+ /* SAFE AREA ----------------------------------------------------------------------------------- */
+ aWriteLock.lock();
+ m_xController->dispose();
+ m_xController = css::uno::Reference< css::frame::XController >();
+ xOldController = css::uno::Reference< css::frame::XController >(); // Don't forget to release last reference to m_xController!
+ aWriteLock.unlock();
+ /* UNSAFE AREA --------------------------------------------------------------------------------- */
+ }
+ }
+
+ // Release component window.
+ if( bWindowChange == sal_True )
+ {
+ // Set new one ...
+ // resize it to fill our containerwindow ...
+ // and dispose the old one.
+
+ /* SAFE AREA --------------------------------------------------------------------------------------- */
+ aWriteLock.lock();
+ // We can set the new one here ... because we hold it as xOldComponentWindow too!
+ m_xComponentWindow = xComponentWindow;
+ aWriteLock.unlock();
+ /* UNSAFE AREA ------------------------------------------------------------------------------------- */
+
+ implts_resizeComponentWindow();
+ if( xOldComponentWindow.is() == sal_True )
+ {
+ // All VclComponents are XComponents; so call dispose before discarding
+ // a css::uno::Reference< XVclComponent >, because this frame is the owner of the Component.
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ Window* pOldComponentWindow = VCLUnoHelper::GetWindow( xOldComponentWindow );
+ if (
+ ( pOldComponentWindow != NULL ) &&
+ ( Application::GetDefModalDialogParent() == pOldComponentWindow )
+ )
+ {
+ Application::SetDefModalDialogParent( pContainerWindow );
+ }
+ aSolarGuard.clear();
+ xOldComponentWindow->dispose();
+ xOldComponentWindow = css::uno::Reference< css::awt::XWindow >();
+ }
+ }
+
+ // Set new controller.
+ if( bControllerChange == sal_True )
+ {
+ /* SAFE AREA --------------------------------------------------------------------------------------- */
+ aWriteLock.lock();
+ m_xController = xController;
+ aWriteLock.unlock();
+ /* UNSAFE AREA ------------------------------------------------------------------------------------- */
+ }
+
+ // Send action events to all listener - depends from our connect state
+ if (
+ ( xController.is() == sal_True ) ||
+ ( xComponentWindow.is() == sal_True )
+ )
+ {
+ if( bConnected == sal_True )
+ {
+ implts_sendFrameActionEvent( css::frame::FrameAction_COMPONENT_REATTACHED );
+ }
+ else
+ {
+ implts_sendFrameActionEvent( css::frame::FrameAction_COMPONENT_ATTACHED );
+ }
+ }
+
+ // A new component doesn't know anything about current active/focus states.
+ // Give her this information!
+ if (
+ ( bHasFocus == sal_True ) &&
+ ( xComponentWindow.is() == sal_True )
+ )
+ {
+ xComponentWindow->setFocus();
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ Window* pWindow = VCLUnoHelper::GetWindow( xComponentWindow );
+ if( pWindow != NULL )
+ {
+ Application::SetDefModalDialogParent( pWindow );
+ }
+ aSolarGuard.clear();
+ }
+
+ // New component should change our current icon ...
+ implts_setIconOnWindow();
+
+ /* SAFE AREA ------------------------------------------------------------------------------------------- */
+ aWriteLock.lock();
+ m_bConnected = sal_True;
+ aWriteLock.unlock();
+ /* UNSAFE AREA ----------------------------------------------------------------------------------------- */
+ }
+
+ return sal_True;
+}
+
+sal_Bool Frame::impl_setComponent( const css::uno::Reference< css::awt::XWindow >& xComponentWindow ,
+ const css::uno::Reference< css::frame::XController >& xController ) throw( css::uno::RuntimeException )
+{
+ //_____________________________________________________________________________________________________
+ // Ignore this HACK of sfx2!
+ // He call us with an valid controller without a valid window ... Thats not allowed!
+ if ( xController.is() && ! xComponentWindow.is() )
+ return sal_True;
+
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- // Use threadsafe impl-method!
- return implts_setComponent( xComponentWindow, xController );
+ //_____________________________________________________________________________________________________
+ // Get threadsafe some copies of used members.
+ /* SAFE { */
+ ReadGuard aReadLock( m_aLock );
+ css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow;
+ css::uno::Reference< css::awt::XWindow > xOldComponentWindow = m_xComponentWindow;
+ css::uno::Reference< css::frame::XController > xOldController = m_xController;
+ sal_Bool bHadFocus = ( m_eActiveState==E_FOCUS && m_xComponentWindow.is() );
+ sal_Bool bWasConnected = m_bConnected;
+ aReadLock.unlock();
+ /* } SAFE */
+
+ //_____________________________________________________________________________________________________
+ // stop listening on old window
+ // May it produce some trouble.
+ // But don't forget to listen on new window again ... or reactivate listening
+ // if we reject this setComponent() request and leave this method without changing the old window.
+ implts_stopWindowListening();
+
+ // Notify all listener, that this component (if current one exist) will be unloaded.
+ if (bWasConnected)
+ implts_sendFrameActionEvent( css::frame::FrameAction_COMPONENT_DETACHING );
+
+ //_____________________________________________________________________________________________________
+ // otherwhise release old component first
+ // Always release controller before releasing window,
+ // because controller may want to access its window!
+ // But check for real changes - may the new controller is the old one.
+ if (
+ (xOldController.is() ) &&
+ (xOldController != xController)
+ )
+ {
+ // try to suspend him
+ // If he disagree with that - return false.
+ if ( ! xOldController->suspend(sal_True) )
+ {
+ // It was disabled before - reactivate it!
+ implts_startWindowListening();
+ return sal_False;
+ }
+
+ // Before we dispose this controller we should hide it inside this frame instance.
+ // We hold it alive for next calls by using xOldController!
+ /* SAFE {*/
+ WriteGuard aWriteLock( m_aLock );
+ m_xController = NULL;
+ aWriteLock.unlock();
+ /* } SAFE */
+
+ css::uno::Reference< css::lang::XComponent > xDisposable( xOldController, css::uno::UNO_QUERY );
+ if (xDisposable.is())
+ xDisposable->dispose();
+ xOldController = NULL;
+ }
+
+ //_____________________________________________________________________________________________________
+ // Now it's time to release the component window.
+ // If controller wasn't released successfully - this code line shouldn't be reached.
+ // Because in case of "suspend()==false" we return immediately with false ...
+ // see before
+ // Check for real changes too.
+ if (
+ (xOldComponentWindow.is() ) &&
+ (xOldComponentWindow != xComponentWindow)
+ )
+ {
+ // Before dispose() of this window we must search another def modal dialog parent.
+ // Set the container window of this frame as the new one - but do it only if our old
+ // component window was this special dialog parent realy.
+ /* SOLAR SAFE { */
+ ::vos::OClearableGuard aGlobalSolarLock( Application::GetSolarMutex() );
+ Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ Window* pOldComponentWindow = VCLUnoHelper::GetWindow( xOldComponentWindow );
+ if (
+ ( pOldComponentWindow != NULL ) &&
+ ( Application::GetDefModalDialogParent() == pOldComponentWindow )
+ )
+ {
+ Application::SetDefModalDialogParent( pContainerWindow );
+ }
+ aGlobalSolarLock.clear();
+ /* } SAFE */
+
+ /* SAFE { */
+ WriteGuard aWriteLock( m_aLock );
+ m_xComponentWindow = NULL;
+ aWriteLock.unlock();
+ /* } SAFE */
+
+ css::uno::Reference< css::lang::XComponent > xDisposable( xOldComponentWindow, css::uno::UNO_QUERY );
+ if (xDisposable.is())
+ xDisposable->dispose();
+ xOldComponentWindow = NULL;
+ }
+
+ //_____________________________________________________________________________________________________
+ // Now it's time to set the new component ...
+ // By the way - find out our new "load state" - means if we have a valid component inside.
+ /* SAFE { */
+ WriteGuard aWriteLock( m_aLock );
+ m_xComponentWindow = xComponentWindow;
+ m_xController = xController ;
+ m_bConnected = (m_xComponentWindow.is() || m_xController.is());
+ sal_Bool bIsConnected = m_bConnected;
+ aWriteLock.unlock();
+ /* } SAFE */
+
+ //_____________________________________________________________________________________________________
+ // notifies all interest listener, that current component was changed or a new one was loaded
+ if (bIsConnected && bWasConnected)
+ implts_sendFrameActionEvent( css::frame::FrameAction_COMPONENT_REATTACHED );
+ else
+ if (bIsConnected && !bWasConnected)
+ implts_sendFrameActionEvent( css::frame::FrameAction_COMPONENT_ATTACHED );
+
+ //_____________________________________________________________________________________________________
+ // A new component window doesn't know anything about current active/focus states.
+ // Set this information on it!
+ if (xComponentWindow.is() && bHadFocus)
+ {
+ xComponentWindow->setFocus();
+
+ /* SOLAR SAFE { */
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ Window* pWindow = VCLUnoHelper::GetWindow( xComponentWindow );
+ if (pWindow!=NULL)
+ Application::SetDefModalDialogParent( pWindow );
+ aSolarGuard.clear();
+ /* } SOLAR SAFE */
+ }
+
+ // If it was a new component window - we must resize it to fill out
+ // our container window.
+ implts_resizeComponentWindow();
+ // New component should change our current icon ...
+ implts_setIconOnWindow();
+ // OK - start listening on new window again - or do nothing if it is an empty one.
+ implts_startWindowListening();
+
+ return sal_True;
}
/*-****************************************************************************************************//**
@@ -1314,6 +1768,123 @@ void SAL_CALL Frame::removeFrameActionListener( const css::uno::Reference< css::
}
/*-****************************************************************************************************//**
+ @short support two way mechanism to release a frame
+ @descr This method ask internal component (controller) if he accept this close request.
+ In case of <TRUE/> nothing will be happen (from point of caller of this close method).
+ In case of <FALSE/> a CloseVetoException is thrown. After such exception given parameter
+ <var>bDeliverOwnerShip</var> regulate which will be the new owner of this instance.
+
+ @attention It's the replacement for XTask::close() which is marked as obsolete method.
+
+ @param bDeliverOwnerShip
+ If parameter is set to <FALSE/> the original caller will be the owner after thrown
+ veto exception and must try to close this frame at later time again. Otherwhise the
+ source of throwed exception is the right one. May it will be the frame himself.
+
+ @thrown CloseVetoException
+ if any internal things willn't be closed
+
+ @threadsafe yes
+ @modified 06.05.2002 08:33, as96863
+*//*-*****************************************************************************************************/
+void SAL_CALL Frame::close( sal_Bool bDeliverOwnerShip ) throw( css::util::CloseVetoException,
+ css::uno::RuntimeException )
+{
+ TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
+
+ // At the end of this method may we must dispose ourself ...
+ // and may nobody from outside hold a reference to us ...
+ // then it's a good idea to do that by ourself.
+ css::uno::Reference< css::uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >(this) );
+
+ // Check any close listener before we look for currently running internal processes.
+ // Because if a listener disagree with this close() request - we hace time to finish this
+ // internal operations too ...
+ // Note: container is threadsafe himself.
+ css::lang::EventObject aSource (static_cast<::cppu::OWeakObject*>(this));
+ ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const css::uno::Reference< css::util::XCloseListener >*) NULL ) );
+ if (pContainer!=NULL)
+ {
+ ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
+ while (pIterator.hasMoreElements())
+ ((css::util::XCloseListener*)pIterator.next())->queryClosing( aSource, bDeliverOwnerShip );
+ }
+
+ // Ok - no listener disagreed with this close() request
+ // check if this frame is used for any load process currently
+ if (Frame::isActionLocked())
+ {
+ if (bDeliverOwnerShip)
+ /* SAFE */{
+ WriteGuard aWriteLock( m_aLock );
+ m_bSelfClose = sal_True;
+ }/* SAFE */
+ throw css::util::CloseVetoException(DECLARE_ASCII("Frame in use for loading document ..."),static_cast<::cppu::OWeakObject*>(this));
+ }
+
+ // If no load proccesses could be detected ... ask controller for his agreement.
+ sal_Bool bComponentInside = sal_False;
+ /* SAFE */{
+ ReadGuard aReadLock( m_aLock );
+ bComponentInside = ( m_xController.is() || m_xComponentWindow.is() );
+ }/* SAFE */
+
+ if (bComponentInside)
+ {
+ if ( ! setComponent(NULL,NULL) )
+ throw css::util::CloseVetoException(DECLARE_ASCII("Controller disagree with that ..."),static_cast<::cppu::OWeakObject*>(this));
+ }
+
+ // If closing is allowed ... inform all istener and dispose this frame!
+ pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const css::uno::Reference< css::util::XCloseListener >*) NULL ) );
+ if (pContainer!=NULL)
+ {
+ ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
+ while (pIterator.hasMoreElements())
+ ((css::util::XCloseListener*)pIterator.next())->notifyClosing( aSource );
+ }
+
+ // Attention: We must release our own registered transaction here. Otherwhise following dispose() call
+ // wait for us too ....
+ aTransaction.stop();
+ dispose();
+}
+
+/*-****************************************************************************************************//**
+ @short be a listener for close events!
+ @descr Adds/remove a CloseListener at this frame instance. If the close() method is called on
+ this object, the such listener are informed and can disagree with that by throwing
+ a CloseVetoException.
+
+ @seealso Frame::close()
+
+ @param xListener
+ reference to your listener object
+
+ @onerror Listener is ignored.
+
+ @threadsafe yes
+ @modified 06.05.2002 10:03, as96863
+*//*-*****************************************************************************************************/
+void SAL_CALL Frame::addCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) throw (css::uno::RuntimeException)
+{
+ TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
+ // We doesn't need any lock here ...
+ // Container lives if we live and is threadsafe by himself.
+ m_aListenerContainer.addInterface( ::getCppuType( ( const css::uno::Reference< css::util::XCloseListener >* ) NULL ), xListener );
+}
+
+//*****************************************************************************************************************
+void SAL_CALL Frame::removeCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) throw (css::uno::RuntimeException)
+{
+ // Use soft exception mode - moslty this method is called during disposing of this frame ...
+ TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS );
+ // We doesn't need any lock here ...
+ // Container lives if we live and is threadsafe by himself.
+ m_aListenerContainer.removeInterface( ::getCppuType( ( const css::uno::Reference< css::util::XCloseListener >* ) NULL ), xListener );
+}
+
+/*-****************************************************************************************************//**
@short destroy instance
@descr The owner of this object calles the dispose method if the object
should be destroyed. All other objects and components, that are registered
@@ -1334,83 +1905,60 @@ void SAL_CALL Frame::removeFrameActionListener( const css::uno::Reference< css::
*//*-*****************************************************************************************************/
void SAL_CALL Frame::dispose() throw( css::uno::RuntimeException )
{
- /*ATTENTION
- Make it threadsafe ... but this method is a special one!
- We must close objet for working BEFORE we dispose it realy ...
- After successful closing all interface calls are rejected by our
- transaction manager automaticly.
-
- But there exist something to do ... which should be done BEFORE we start realy disposing of this instance!
- So we should clear listener and window mechanism first.
- */
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- // Create an exclusiv access!
- // It's neccessary for follow transaction check ...
- // Another reason: We can recylce these write lock at later time ..
- // and it's superflous to create read- and write- locks in combination.
- WriteGuard aWriteLock( m_aLock );
-
- // Look for multiple calls of this method!
- // If somewhere call dispose() twice - he will be stopped here realy!!!
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
// We should hold a reference to ourself ...
// because our owner dispose us and release our reference ...
// May be we will die before we could finish this method ...
- // Make snapshot of other neecessary member too.
css::uno::Reference< css::frame::XFrame > xThis( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
- #ifdef ENABLE_EVENTDEBUG
- // We should be threadsafe in special debug sessions too :-)
- ::rtl::OUString sName = m_sName;
- #endif
-
- aWriteLock.unlock();
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
-
// First operation should be ... "stopp all listening for window events on our container window".
// These events are superflous but can make trouble!
// We will die, die and die ...
implts_stopWindowListening();
- // It's neccessary to forget our component and her window too...
- // because this mechanism could start different callback mechanism!
- // And it's not a good idea to disable this object for real working by setting mode to E_BEFORECLOSE here.
- // Otherwise to much calls must be handle the special "IN-DISPOSING" case.
- implts_setComponent( css::uno::Reference< css::awt::XWindow > () ,
- css::uno::Reference< css::frame::XController >() );
-
// Send message to all listener and forget her references.
- // Attention: Don't do it before you forget currently set component!
- // Because - our dispatch helper are listener on this frame. They will die, if this instance die!
- // But "implts_setComponent()" needs the dispatch mechanism ... So we should
- // forget our listener after that.
LOG_DISPOSEEVENT( "Frame", sName )
css::lang::EventObject aEvent( xThis );
m_aListenerContainer.disposeAndClear( aEvent );
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- // Lock it again to disable object for real working!
- aWriteLock.lock();
-
- // Now - we are alone and its the first call of this method ...
- // otherwise call before must throw a DisposedException!
- // Don't forget to release this registered transaction here ...
- // because next "setWorkingMode()" call blocks till all current existing one
- // are finished!
- aTransaction.stop();
-
// Disable this instance for further work.
// This will wait for all current running ones ...
// and reject all further requests!
m_aTransactionManager.setWorkingMode( E_BEFORECLOSE );
- // Now we can release our lock!
+ // Don't show any dialogs, errors or something else any more!
+ // If somewhere called dispose() whitout close() before - normaly no dialogs
+ // should exist. Otherwhise it's the problem of the outside caller.
+ // Note:
+ // (a) Do it after stopWindowListening(). May that force some active/deactive
+ // notifications which we doesn't need here realy.
+ // (b) Don't forget to enable this dialog mode at the end of this dipose()
+ // again. Otherwhise no dialogs will be shown in any frame anymore.
+ Application::EnableDialogCancel( sal_True );
+
// We should be alone for ever and further dispose calls are rejected by lines before ...
// I hope it :-)
- aWriteLock.unlock();
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
+
+ // Forget our internal component and her window first.
+ // So we can release our container window later without problems.
+ // Because this container window is the parent of the component window ...
+ // Note: Dispose it hard - because suspending must be done inside close() call!
+ // But try to dispose the controller first befor you destroy the window.
+ // Because the window is used by the controller too ...
+ if (m_xController.is())
+ {
+ LOG_WARNING("Frame::dispose()", "Sorry - but controller shouldn't exist at this point!")
+ css::uno::Reference< css::lang::XComponent > xDisposable( m_xController, css::uno::UNO_QUERY );
+ if (xDisposable.is())
+ xDisposable->dispose();
+ }
+
+ if (m_xComponentWindow.is())
+ {
+ LOG_WARNING("Frame::dispose()", "Sorry - but component window shouldn't exist at this point!")
+ css::uno::Reference< css::lang::XComponent > xDisposable( m_xComponentWindow, css::uno::UNO_QUERY );
+ if (xDisposable.is())
+ xDisposable->dispose();
+ }
// Free references of our frame tree.
// Force parent container to forget this frame too ...
@@ -1430,12 +1978,12 @@ void SAL_CALL Frame::dispose() throw( css::uno::RuntimeException )
and if we dispose this container window before we release this helper ...
we will run into some trouble!
*/
- m_xIndicatorFactoryHelper = css::uno::Reference< css::task::XStatusIndicatorFactory >();
+ m_xIndicatorFactoryHelper = NULL;
impl_disposeContainerWindow( m_xContainerWindow );
/*ATTENTION
Clear container after successful removing from parent container ...
- because our parent could be a task and stand in dispose too!
+ because our parent could be the desktop which stand in dispose too!
If we have already cleared our own container we lost our child before this could be
remove himself at this instance ...
Release m_xFramesHelper after that ... it's the same problem between parent and child!
@@ -1444,19 +1992,20 @@ void SAL_CALL Frame::dispose() throw( css::uno::RuntimeException )
=> You see: Order of calling operations is important!!!
*/
m_aChildFrameContainer.clear();
- m_xFramesHelper = css::uno::Reference< css::frame::XFrames >();
+ m_xFramesHelper = NULL;
// Release some other references.
// This calls should be easy ... I hope it :-)
- m_xDispatchHelper = css::uno::Reference< css::frame::XDispatchProvider >();
- m_xFactory = css::uno::Reference< css::lang::XMultiServiceFactory >();
- m_xDropTargetListener = css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >();
+ m_xDispatchHelper = NULL;
+ m_xFactory = NULL;
+ m_xDropTargetListener = NULL;
m_xDispatchRecorderSupplier = NULL;
// Disable this instance for further working realy!
m_aTransactionManager.setWorkingMode( E_CLOSE );
- LOG_ASSERT2( m_nExternalLockCount!=0, "Frame::dispose()", "Frame was locked ... but disposed! Multithreading problem?" )
+ // Don't forget it - otherwhise no dialogs can be shown anymore in other frames.
+ Application::EnableDialogCancel( sal_False );
}
/*-****************************************************************************************************//**
@@ -1869,6 +2418,44 @@ void SAL_CALL Frame::windowDeactivated( const css::lang::EventObject& aEvent ) t
}
}
+//*****************************************************************************************************************
+void SAL_CALL Frame::windowClosing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException )
+{
+ /* Attention:
+ Don't use any transaction registration here. Because we try to kill ourself.
+ And if we have registered this function as non breakable and force a close()->dispose() operation
+ this will wait for us for ever ...
+ */
+
+ // deactivate this frame and try to close it
+ // But do it asynchron inside the main thread.
+ // VCL has no fun to do such things outside his main thread :-(
+ deactivate();
+ m_aPoster.Post(0);
+}
+
+IMPL_LINK( Frame, implts_windowClosing, void*, pVoid )
+{
+ try
+ {
+ // try to close this frame
+ // But don't deliver the owner shipt to anyone.
+ // Because our "UI owner" will try it again if this request
+ // will fail.
+ // e.g. Somewhere try to open an impress document ... and during
+ // load process the wizard dialog comes up. Then it's possible for
+ // the user to click the window closer of the document window - this task
+ // disagree but gets the owner shipt and practice suicide directly after
+ // closing of the dialog. That's not fine.
+ // We must ignore this close() request then and user can try it later again ...
+ close(sal_False);
+ }
+ catch( css::util::CloseVetoException& )
+ {
+ }
+ return 0;
+}
+
/*-****************************************************************************************************//**
@short called by dispose of our windows!
@descr This object is forced to release all references to the interfaces given
@@ -1927,9 +2514,6 @@ void SAL_CALL Frame::disposing( const css::lang::EventObject& aEvent ) throw( cs
*//*-*************************************************************************************************************/
sal_Bool SAL_CALL Frame::isActionLocked() throw( css::uno::RuntimeException )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
ReadGuard aReadLock( m_aLock );
return( m_nExternalLockCount!=0);
@@ -1938,9 +2522,6 @@ sal_Bool SAL_CALL Frame::isActionLocked() throw( css::uno::RuntimeException )
//*****************************************************************************************************************
void SAL_CALL Frame::addActionLock() throw( css::uno::RuntimeException )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
WriteGuard aWriteLock( m_aLock );
++m_nExternalLockCount;
@@ -1949,22 +2530,21 @@ void SAL_CALL Frame::addActionLock() throw( css::uno::RuntimeException )
//*****************************************************************************************************************
void SAL_CALL Frame::removeActionLock() throw( css::uno::RuntimeException )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
+ // Register no transaction here! Otherwhise we wait for ever inside possible
+ // implts_checkSuicide()/dispose() request ...
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- WriteGuard aWriteLock( m_aLock );
+ /* SAFE AREA */{
+ WriteGuard aWriteLock( m_aLock );
+ LOG_ASSERT2( m_nExternalLockCount<=0, "Frame::removeActionLock()", "Frame isn't locked! Possible multithreading problem detected." )
+ --m_nExternalLockCount;
+ }/* SAFE */
- LOG_ASSERT2( m_nExternalLockCount<=0, "Frame::removeActionLock()", "Frame isn't locked! Possible multithreading problem detected." )
- --m_nExternalLockCount;
+ implts_checkSuicide();
}
//*****************************************************************************************************************
void SAL_CALL Frame::setActionLocks( sal_Int16 nLock ) throw( css::uno::RuntimeException )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
WriteGuard aWriteLock( m_aLock );
// Attention: If somewhere called resetActionLocks() before and get e.g. 5 locks ...
@@ -1977,13 +2557,22 @@ void SAL_CALL Frame::setActionLocks( sal_Int16 nLock ) throw( css::uno::RuntimeE
//*****************************************************************************************************************
sal_Int16 SAL_CALL Frame::resetActionLocks() throw( css::uno::RuntimeException )
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
+ // Register no transaction here! Otherwhise we wait for ever inside possible
+ // implts_checkSuicide()/dispose() request ...
+
+ sal_Int16 nCurrentLocks = 0;
+ /* SAFE */{
+ WriteGuard aWriteLock( m_aLock );
+ nCurrentLocks = m_nExternalLockCount;
+ m_nExternalLockCount = 0;
+ }/* SAFE */
+
+ // Attention:
+ // external lock count is 0 here every time ... but if
+ // member m_bSelfClose is set to true too .... we call our own close()/dispose().
+ // See close() for further informations
+ implts_checkSuicide();
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- WriteGuard aWriteLock( m_aLock );
- sal_Int16 nCurrentLocks = m_nExternalLockCount;
- m_nExternalLockCount = 0 ;
return nCurrentLocks;
}
@@ -2307,89 +2896,6 @@ sal_Bool Frame::impl_tryToChangeProperty( const css::uno::Reference< css::fr
}
/*-****************************************************************************************************//**
- @short helper to release old and set new container window
- @descr This method is threadsafe AND can be called by our dispose method too!
-
- @seealso -
-
- @param "xNewWindow", reference to new window or null if window should be destroyed
- @return -
-
- @onerror -
-*//*-*****************************************************************************************************/
-/*
-void Frame::implts_setContainerWindow( const css::uno::Reference< css::awt::XWindow>& xNewWindow )
-{
- // Algorithm:
- // a) Safe current set reference as old one.
- // We dispose it later to avaoid flickering!
- // b) Set new window as member.
- // c) Deregister old window as listener!
- // d) Register new window as new listener.
- // e) Dispose old window and free his reference.
-
- // UNSAFE AREA --------------------------------------------------------------------------------------------- //
- // Sometimes used by dispose() => soft exceptions!
- TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS );
-
- // SAFE AREA ----------------------------------------------------------------------------------------------- //
- ReadGuard aReadLock( m_aLock );
-
- // a,b)
- // Use it to make snapshot of neccessary member and work on it after
- // releasing our read lock!
- css::uno::Reference< css::awt::XWindow > xOldWindow = m_xContainerWindow ;
- m_xContainerWindow = xNewWindow ;
- css::uno::Reference< css::awt::XWindowListener > xThisAsWindowListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
- css::uno::Reference< css::awt::XFocusListener > xThisAsFocusListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
- css::uno::Reference< css::awt::XTopWindowListener > xThisAsTopWindowListener( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
-
- aReadLock.unlock();
- // UNSAFE AREA --------------------------------------------------------------------------------------------- //
-
- // c)
- if( xOldWindow.is() == sal_True )
- {
- xOldWindow->removeWindowListener( xThisAsWindowListener );
- xOldWindow->removeFocusListener ( xThisAsFocusListener );
- }
-
- // d)
- if( xNewWindow.is() == sal_True )
- {
- xNewWindow->addWindowListener( xThisAsWindowListener);
- xNewWindow->addFocusListener ( xThisAsFocusListener );
-
- // If possible register as TopWindowListener
- css::uno::Reference< css::awt::XTopWindow > xTopWindow( xNewWindow, css::uno::UNO_QUERY );
- if( xTopWindow.is() == sal_True )
- {
- xTopWindow->addTopWindowListener( xThisAsTopWindowListener );
- }
- }
-
- // e)
- if( xOldWindow.is() == sal_True )
- {
- // All VclComponents are XComponents; so call dispose before discarding
- // a css::uno::Reference< XVclComponent >, because this frame is the owner of the window
- Window* pOldWindow = VCLUnoHelper::GetWindow( xOldWindow );
- if (
- ( pOldWindow != NULL ) &&
- ( Application::GetDefModalDialogParent() == pOldWindow )
- )
- {
- Application::SetDefModalDialogParent( NULL );
- }
-
- xOldWindow->setVisible( sal_False );
- xOldWindow->dispose();
- xOldWindow = css::uno::Reference< css::awt::XWindow >();
- }
-}
-*/
-
-/*-****************************************************************************************************//**
@short dispose old container window and forget his reference
@descr Sometimes we must repair our "modal dialog parent mechanism" too!
@@ -2462,7 +2968,18 @@ void Frame::implts_sendFrameActionEvent( const css::frame::FrameAction& aAction
// Send message to all listener.
while( aIterator.hasMoreElements() == sal_True )
{
+ try
+ {
((css::frame::XFrameActionListener *)aIterator.next())->frameAction( aFrameActionEvent );
+ }
+ catch( css::uno::RuntimeException& exRuntime )
+ {
+ LOG_WARNING("Frame::implts_sendFrameActionEvent(Runtime)", U2B(exRuntime.Message).getStr())
+ }
+ catch( css::uno::Exception& exUNO )
+ {
+ LOG_WARNING("Frame::implts_sendFrameActionEvent(Exception)", U2B(exUNO.Message).getStr())
+ }
}
}
}
@@ -2686,169 +3203,6 @@ void Frame::implts_setIconOnWindow()
}
}
-/*-****************************************************************************************************//**
- @short helper to change current component with window
- @descr This method is used by two different interface methods - dispose() and setComponent().
- It's a threadsafe one and handle calling by dispose by using E_SOFTEXCEPTIONS too!
-
- @seealso method setComponent()
- @seealso method dispose()
-
- @param "xComponentWindow", new window of our component or NULL if component should be destroyed
- @param "xController" , new controller of our component or NULL if component should be destroyed
- @return Successful state of operation.
-
- @onerror We return false.
-*//*-*****************************************************************************************************/
-sal_Bool Frame::implts_setComponent( const css::uno::Reference< css::awt::XWindow >& xComponentWindow ,
- const css::uno::Reference< css::frame::XController >& xController )
-{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Sometimes used by dispose() => soft exceptions!
- TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS );
-
- /*HACK
- ... for sfx2! Sometimes he call me by using this combination.
- */
- if (
- (
- ( xController.is() == sal_True ) &&
- ( xComponentWindow.is() == sal_False )
- ) == sal_False
- )
- {
- /* SAFE AREA ------------------------------------------------------------------------------------------- */
- // Normaly a ReadLock is enough ... but we need some write locks at later time.
- // It's better to create it yet und use it later to create read AND write locks!!!
- WriteGuard aWriteLock( m_aLock );
-
- // Make snapshot of our internal member and states and release lock!
- css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow ;
- css::uno::Reference< css::awt::XWindow > xOldComponentWindow = m_xComponentWindow ;
- css::uno::Reference< css::frame::XController > xOldController = m_xController ;
- sal_Bool bControllerChange = ( m_xController != xController ) ;
- sal_Bool bWindowChange = ( m_xComponentWindow != xComponentWindow ) ;
- sal_Bool bConnected = m_bConnected ;
- sal_Bool bHasFocus = ( m_eActiveState==E_FOCUS && m_xComponentWindow.is()==sal_True ) ;
-
- aWriteLock.unlock();
- /* UNSAFE AREA ----------------------------------------------------------------------------------------- */
-
- // Release current component, if there is any.
- if (
- ( xOldComponentWindow.is() == sal_True ) ||
- ( xOldController.is() == sal_True )
- )
- {
- implts_sendFrameActionEvent( css::frame::FrameAction_COMPONENT_DETACHING );
- }
-
- // Always release controller before releasing window, because controller may want to access its window!
- if( bControllerChange == sal_True )
- {
- if( xOldController.is() == sal_True )
- {
- /* SAFE AREA ----------------------------------------------------------------------------------- */
- aWriteLock.lock();
- m_xController->dispose();
- m_xController = css::uno::Reference< css::frame::XController >();
- xOldController = css::uno::Reference< css::frame::XController >(); // Don't forget to release last reference to m_xController!
- aWriteLock.unlock();
- /* UNSAFE AREA --------------------------------------------------------------------------------- */
- }
- }
-
- // Release component window.
- if( bWindowChange == sal_True )
- {
- // Set new one ...
- // resize it to fill our containerwindow ...
- // and dispose the old one.
-
- /* SAFE AREA --------------------------------------------------------------------------------------- */
- aWriteLock.lock();
- // We can set the new one here ... because we hold it as xOldComponentWindow too!
- m_xComponentWindow = xComponentWindow;
- aWriteLock.unlock();
- /* UNSAFE AREA ------------------------------------------------------------------------------------- */
-
- implts_resizeComponentWindow();
- if( xOldComponentWindow.is() == sal_True )
- {
- // All VclComponents are XComponents; so call dispose before discarding
- // a css::uno::Reference< XVclComponent >, because this frame is the owner of the Component.
- ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
- Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
- Window* pOldComponentWindow = VCLUnoHelper::GetWindow( xOldComponentWindow );
- if (
- ( pOldComponentWindow != NULL ) &&
- ( Application::GetDefModalDialogParent() == pOldComponentWindow )
- )
- {
- Application::SetDefModalDialogParent( pContainerWindow );
- }
- aSolarGuard.clear();
- xOldComponentWindow->dispose();
- xOldComponentWindow = css::uno::Reference< css::awt::XWindow >();
- }
- }
-
- // Set new controller.
- if( bControllerChange == sal_True )
- {
- /* SAFE AREA --------------------------------------------------------------------------------------- */
- aWriteLock.lock();
- m_xController = xController;
- aWriteLock.unlock();
- /* UNSAFE AREA ------------------------------------------------------------------------------------- */
- }
-
- // Send action events to all listener - depends from our connect state
- if (
- ( xController.is() == sal_True ) ||
- ( xComponentWindow.is() == sal_True )
- )
- {
- if( bConnected == sal_True )
- {
- implts_sendFrameActionEvent( css::frame::FrameAction_COMPONENT_REATTACHED );
- }
- else
- {
- implts_sendFrameActionEvent( css::frame::FrameAction_COMPONENT_ATTACHED );
- }
- }
-
- // A new component doesn't know anything about current active/focus states.
- // Give her this information!
- if (
- ( bHasFocus == sal_True ) &&
- ( xComponentWindow.is() == sal_True )
- )
- {
- xComponentWindow->setFocus();
- ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
- Window* pWindow = VCLUnoHelper::GetWindow( xComponentWindow );
- if( pWindow != NULL )
- {
- Application::SetDefModalDialogParent( pWindow );
- }
- aSolarGuard.clear();
- }
-
- // New component should change our current icon ...
- implts_setIconOnWindow();
-
- /* SAFE AREA ------------------------------------------------------------------------------------------- */
- aWriteLock.lock();
- m_bConnected = sal_True;
- aWriteLock.unlock();
- /* UNSAFE AREA ----------------------------------------------------------------------------------------- */
- }
-
- return sal_True;
-}
-
/*-************************************************************************************************************//**
@short filter special names
@attention If somewhere have a name value ... but don't know if he can set it on a frame ...
@@ -2969,6 +3323,127 @@ void Frame::implts_stopWindowListening()
}
}
+/*-****************************************************************************************************//**
+ @short helper to save window parameters (depending from document factory) into the configuration
+ @descr We hold position and size of windows for every modul of the office inside the configuration.
+ And here is the place to get the neccessary informations from the on container window
+ and safe it.
+
+ @threadsafe yes
+ @modified 06.05.2002 09:13, as96863
+*//*-*****************************************************************************************************/
+void Frame::implts_saveWindowAttributes()
+{
+ // get some copies of internal member in threadsafe block
+ css::uno::Reference< css::awt::XWindow > xContainerWindow;
+ css::uno::Reference< css::frame::XController > xController ;
+ css::uno::Reference< css::lang::XMultiServiceFactory > xFactory ;
+ sal_Bool bIsPlugin ;
+ /* SAFE */{
+ ReadGuard aReadLock( m_aLock );
+ xContainerWindow = m_xContainerWindow;
+ xController = m_xController ;
+ xFactory = m_xFactory ;
+ bIsPlugin = m_bIsPlugIn ;
+ }/* SAFE */
+
+ // operation not defined for missing window and not for plugin mode!
+ if (
+ ( xContainerWindow.is() ) &&
+ ( !bIsPlugin )
+ )
+ {
+ // save pos/size of task window in module options
+ // To do so - get argument "FilterName" from the model ( if the component has one ) first
+ ::rtl::OUString sFilterName;
+ if (xController.is())
+ {
+ css::uno::Reference< css::frame::XModel > xModel = xController->getModel();
+ if (xModel.is())
+ {
+ css::uno::Sequence< css::beans::PropertyValue > lArgs( xModel->getArgs() );
+ ArgumentAnalyzer aAnalyzer( lArgs );
+ aAnalyzer.getArgument( E_FILTERNAME , sFilterName );
+ }
+ }
+
+ // If such filter name is well know try to
+ // get the properties of the components' filter
+ // Use singleton implementati0on of internal stl filter cache to get neccessary informations!
+ // It's a threadsafe implementation.
+ FilterCache aCacheRef;
+ if (
+ (sFilterName.getLength() ) &&
+ (aCacheRef.existsFilter(sFilterName))
+ )
+ {
+ Filter aFilter = aCacheRef.getFilter(sFilterName);
+ // use property "DocumentServiceName" to detect the factory
+ // Note: Some filter doesn't have such property - e.g. graphic filter.
+ if (aFilter.sDocumentService.getLength()>0)
+ {
+ SvtModuleOptions::EFactory eFactory;
+ if (SvtModuleOptions::ClassifyFactoryByName(aFilter.sDocumentService,eFactory))
+ {
+ // store window position for this factory
+ ByteString sState;
+ /* SOLAR SAFE */{
+
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ Window* pWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ if (
+ (pWindow!=NULL ) &&
+ (pWindow->IsSystemWindow())
+ )
+ {
+ sState = ((SystemWindow*)pWindow)->GetWindowState();
+ }
+ }/* SOLAR SAFE */
+ if (sState.Len()>0)
+ SvtModuleOptions().SetFactoryWindowAttributes( eFactory, B2U_ENC(sState,RTL_TEXTENCODING_UTF8) );
+ }
+ }
+ }
+ }
+}
+
+/*-****************************************************************************************************//**
+ @short helper to force breaked close() request again
+ @descr If we self disagree with a close() request, and detect that all external locks are gone ...
+ then we must try to close this frame again.
+
+ @seealso XCloseable::close()
+ @seealso Frame::close()
+ @seealso Frame::removeActionLock()
+ @seealso Frame::resetActionLock()
+ @seealso m_bSelfClose
+ @seealso m_nExternalLockCount
+
+ @threadsafe yes
+ @modified 06.05.2002 09:31, as96863
+*//*-*****************************************************************************************************/
+void Frame::implts_checkSuicide()
+{
+ sal_Bool bSuicide = sal_False;
+ /* SAFE */{
+ // in case of lock==0 and safed state of previous close() request m_bSelfClose
+ // we must force close() again. Because we had disagreed with that before.
+ bSuicide = (m_nExternalLockCount==0 && m_bSelfClose);
+ m_bSelfClose = sal_False;
+ }
+ // force close and deliver owner ship to source of possible throwed veto exception
+ // Attention: Because this method isn't designed to throw such exception we must supress
+ // it for outside code!
+ try
+ {
+ if (bSuicide)
+ close(sal_True);
+ }
+ catch( css::util::CloseVetoException& )
+ {
+ }
+}
+
//_________________________________________________________________________________________________________________
// debug methods
//_________________________________________________________________________________________________________________
@@ -2997,7 +3472,6 @@ sal_Bool Frame::implcp_setActiveFrame( const css::uno::Reference< css::frame::XF
{
return (
( &xFrame == NULL ) ||
- ( css::uno::Reference< css::frame::XTask >( xFrame, css::uno::UNO_QUERY ).is() == sal_True ) ||
( css::uno::Reference< css::frame::XDesktop >( xFrame, css::uno::UNO_QUERY ).is() == sal_True ) ||
( css::uno::Reference< css::mozilla::XPluginInstance >( xFrame, css::uno::UNO_QUERY ).is() == sal_True )
);
diff --git a/framework/source/services/makefile.mk b/framework/source/services/makefile.mk
index bb1bcb2497..c3429b2108 100644
--- a/framework/source/services/makefile.mk
+++ b/framework/source/services/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.10 $
+# $Revision: 1.11 $
#
-# last change: $Author: as $ $Date: 2001-12-05 13:27:37 $
+# last change: $Author: as $ $Date: 2002-05-23 12:54:24 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -80,7 +80,6 @@ SLOFILES= \
$(SLO)$/documentlist.obj \
$(SLO)$/desktop.obj \
$(SLO)$/pluginframe.obj \
- $(SLO)$/task.obj \
$(SLO)$/frame.obj \
$(SLO)$/frameloaderfactory.obj \
$(SLO)$/filterfactory.obj \
diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk
index d583df1b59..a4791e04a2 100644
--- a/framework/util/makefile.mk
+++ b/framework/util/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.61 $
+# $Revision: 1.62 $
#
-# last change: $Author: as $ $Date: 2002-05-02 11:43:37 $
+# last change: $Author: as $ $Date: 2002-05-23 12:54:59 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -224,8 +224,6 @@ SHL4OBJS= $(SLO)$/argumentanalyzer.obj \
$(SLO)$/ocomponentenumeration.obj \
$(SLO)$/oframes.obj \
$(SLO)$/opluginframedispatcher.obj \
- $(SLO)$/otasksaccess.obj \
- $(SLO)$/otasksenumeration.obj \
$(SLO)$/pluginframe.obj \
$(SLO)$/registerservices.obj \
$(SLO)$/selfdispatcher.obj \
@@ -233,7 +231,6 @@ SHL4OBJS= $(SLO)$/argumentanalyzer.obj \
$(SLO)$/statusindicator.obj \
$(SLO)$/statusindicatorfactory.obj \
$(SLO)$/targetfinder.obj \
- $(SLO)$/task.obj \
$(SLO)$/taskcreator.obj \
$(SLO)$/timerhelper.obj \
$(SLO)$/urltransformer.obj \