2010-10-12 15:53:47 +02:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2012-11-12 17:21:24 +00:00
/*
* This file is part of the LibreOffice project .
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License , v . 2.0 . If a copy of the MPL was not distributed with this
* file , You can obtain one at http : //mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice :
*
* Licensed to the Apache Software Foundation ( ASF ) under one or more
* contributor license agreements . See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership . The ASF licenses this file to you under the Apache
* License , Version 2.0 ( the " License " ) ; you may not use this file
* except in compliance with the License . You may obtain a copy of
* the License at http : //www.apache.org/licenses/LICENSE-2.0 .
*/
2004-11-26 13:33:19 +00:00
2001-07-02 12:40:19 +00:00
# include <dispatch/dispatchprovider.hxx>
# include <dispatch/interceptionhelper.hxx>
2004-02-25 16:48:50 +00:00
# include <dispatch/closedispatcher.hxx>
2007-07-05 07:58:43 +00:00
# include <dispatch/windowcommanddispatch.hxx>
2004-01-28 13:40:30 +00:00
# include <loadenv/loadenv.hxx>
2000-09-18 15:33:13 +00:00
# include <helper/oframes.hxx>
2010-04-19 19:05:02 +02:00
# include <framework/titlehelper.hxx>
2013-08-06 19:46:05 +02:00
# include <svtools/openfiledroptargetlistener.hxx>
2002-05-23 11:54:59 +00:00
# include <classes/taskcreator.hxx>
2007-04-16 15:43:56 +00:00
# include <loadenv/targethelper.hxx>
2010-10-29 15:36:30 +02:00
# include <framework/framelistanalyzer.hxx>
2004-02-25 16:48:50 +00:00
# include <helper/dockingareadefaultacceptor.hxx>
2004-11-16 13:54:13 +00:00
# include <dispatch/dispatchinformationprovider.hxx>
2014-01-09 20:53:32 +01:00
# include <classes/framecontainer.hxx>
# include <classes/propertysethelper.hxx>
2001-10-26 08:46:09 +00:00
# include <threadhelp/transactionguard.hxx>
2014-01-09 20:53:32 +01:00
# include <threadhelp/transactionbase.hxx>
# include <general.h>
2007-07-24 10:52:47 +00:00
# include <pattern/window.hxx>
2003-03-25 17:22:13 +00:00
# include <properties.h>
2012-10-17 10:52:52 +02:00
# include <com/sun/star/awt/Toolkit.hpp>
2000-09-18 15:33:13 +00:00
# include <com/sun/star/awt/XDevice.hpp>
# include <com/sun/star/awt/XTopWindow.hpp>
# include <com/sun/star/awt/PosSize.hpp>
2001-05-02 11:58:40 +00:00
# include <com/sun/star/beans/PropertyAttribute.hpp>
2001-10-26 08:46:09 +00:00
# include <com/sun/star/beans/PropertyValue.hpp>
# include <com/sun/star/beans/XPropertySet.hpp>
2013-05-27 12:58:50 +02:00
# include <com/sun/star/container/XIndexAccess.hpp>
# include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
2014-01-09 20:53:32 +01:00
# include <com/sun/star/frame/XFrame2.hpp>
2013-05-27 12:58:50 +02:00
# include <com/sun/star/frame/XModel.hpp>
2008-04-04 13:12:20 +00:00
# include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
2013-05-27 12:58:50 +02:00
# include <com/sun/star/frame/LayoutManager.hpp>
# include <com/sun/star/frame/XDesktop.hpp>
# include <com/sun/star/frame/FrameSearchFlag.hpp>
# include <com/sun/star/lang/DisposedException.hpp>
# include <com/sun/star/task/StatusIndicatorFactory.hpp>
2014-01-22 14:05:06 +01:00
# include <com/sun/star/task/theJobExecutor.hpp>
2013-05-27 12:58:50 +02:00
# include <com/sun/star/task/XJobExecutor.hpp>
# include <com/sun/star/util/URLTransformer.hpp>
# include <com/sun/star/util/XURLTransformer.hpp>
# include <com/sun/star/util/XCloseable.hpp>
2014-01-09 20:53:32 +01:00
# include <com/sun/star/lang/XServiceInfo.hpp>
2005-03-29 14:33:34 +00:00
2004-01-28 13:40:30 +00:00
# include <comphelper/sequenceashashmap.hxx>
2014-03-20 09:23:04 +01:00
# include <cppuhelper/basemutex.hxx>
2000-09-18 15:33:13 +00:00
# include <cppuhelper/queryinterface.hxx>
# include <cppuhelper/typeprovider.hxx>
# include <cppuhelper/factory.hxx>
2001-05-02 11:58:40 +00:00
# include <cppuhelper/proptypehlp.hxx>
2014-01-09 20:53:32 +01:00
# include <cppuhelper/interfacecontainer.hxx>
# include <cppuhelper/supportsservice.hxx>
# include <cppuhelper/weak.hxx>
# include <rtl/ref.hxx>
2000-09-18 15:33:13 +00:00
# include <rtl/ustrbuf.hxx>
2000-12-07 10:12:31 +00:00
# include <vcl/window.hxx>
2001-10-26 08:46:09 +00:00
# include <vcl/wrkwin.hxx>
2000-11-23 13:52:13 +00:00
# include <vcl/svapp.hxx>
2013-06-28 04:38:06 +02:00
# include <toolkit/helper/vclunohelper.hxx>
2000-11-23 13:52:13 +00:00
# include <toolkit/awt/vclxwindow.hxx>
2001-06-15 08:41:19 +00:00
# include <comphelper/processfactory.hxx>
2009-10-06 07:38:24 +02:00
# include <unotools/moduleoptions.hxx>
2011-02-25 10:42:53 +01:00
# include <tools/diagnose_ex.h>
2002-10-07 09:21:25 +00:00
# include <vcl/menu.hxx>
2014-01-09 20:53:32 +01:00
# include <unotools/cmdoptions.hxx>
using namespace framework ;
namespace {
// This enum can be used to set different 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.
E_ACTIVE , // I'am in the middle of an active path in tree and i don't have the focus.
E_FOCUS // I have the focus now. I must a member of an active path!
} ;
2014-02-25 18:54:02 +01:00
/*-************************************************************************************************************
2014-01-09 20:53:32 +01:00
@ short implements a normal frame of hierarchy
@ 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
If you call wrong methods in modes a ) or c ) . . . you will get some exceptions .
How you should work with this service :
i ) create it by using " xServiceManager->createInstance(...) "
ii ) call XInitialization : : initialize ( ) with a valid window reference or use createInstanceWithArguments ( ) at i )
iii ) works with object
iv ) dispose object by calling XComponent : : dispose ( )
After iv ) all further requests are rejected by exceptions ! ( DisposedException )
@ base TransactionBase
help to implement unbreakable interface calls
@ base OBroadcastHelper
OPropertySetHelper
implements the property set
@ base OWeakObject
provides the refcount and XInterface , XWeak
@ devstatus ready to use
@ threadsafe yes
*/ /*-*************************************************************************************************************/
2014-01-22 11:54:19 +01:00
class Frame : // interfaces
2014-01-09 20:53:32 +01:00
public css : : lang : : XTypeProvider ,
public css : : lang : : XServiceInfo ,
public css : : frame : : XFrame2 ,
public css : : awt : : XWindowListener , // => XEventListener
public css : : awt : : XTopWindowListener ,
public css : : awt : : XFocusListener ,
public css : : document : : XActionLockable ,
public css : : util : : XCloseable , // => XCloseBroadcaster
public css : : frame : : XComponentLoader ,
public css : : frame : : XTitle ,
public css : : frame : : XTitleChangeBroadcaster ,
// base classes
public TransactionBase ,
2014-03-20 09:23:04 +01:00
private cppu : : BaseMutex ,
2014-03-20 09:30:14 +01:00
public PropertySetHelper , // helper implements TransactionBase, XPropertySet, XPropertySetInfo
2014-01-22 11:54:19 +01:00
public : : cppu : : OWeakObject // helper implements XInterface, XWeak
2014-01-09 20:53:32 +01:00
{
public :
Frame ( const css : : uno : : Reference < css : : uno : : XComponentContext > & xContext ) ;
virtual ~ Frame ( ) ;
2014-01-21 15:45:43 +01:00
/// Initialization function after having acquire()'d.
2014-01-22 11:54:19 +01:00
void initListeners ( ) ;
2014-01-09 20:53:32 +01:00
FWK_DECLARE_XINTERFACE
FWK_DECLARE_XTYPEPROVIDER
virtual OUString SAL_CALL getImplementationName ( )
2014-03-26 16:37:00 +01:00
throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE
2014-01-09 20:53:32 +01:00
{
return OUString ( " com.sun.star.comp.framework.Frame " ) ;
}
virtual sal_Bool SAL_CALL supportsService ( OUString const & ServiceName )
2014-03-26 16:37:00 +01:00
throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE
2014-01-09 20:53:32 +01:00
{
return cppu : : supportsService ( this , ServiceName ) ;
}
virtual css : : uno : : Sequence < OUString > SAL_CALL getSupportedServiceNames ( )
2014-03-26 16:37:00 +01:00
throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE
2014-01-09 20:53:32 +01:00
{
css : : uno : : Sequence < OUString > aSeq ( 1 ) ;
2014-12-18 13:19:13 +01:00
aSeq [ 0 ] = " com.sun.star.frame.Frame " ;
2014-01-09 20:53:32 +01:00
return aSeq ;
}
// XComponentLoader
2014-02-22 21:20:15 +01:00
2014-01-09 20:53:32 +01:00
virtual css : : uno : : Reference < css : : lang : : XComponent > SAL_CALL loadComponentFromURL (
const OUString & sURL ,
const OUString & sTargetFrameName ,
sal_Int32 nSearchFlags ,
const css : : uno : : Sequence < css : : beans : : PropertyValue > & lArguments )
throw ( css : : io : : IOException ,
css : : lang : : IllegalArgumentException ,
2014-03-26 16:37:00 +01:00
css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
// XFramesSupplier
2014-02-22 21:20:15 +01:00
2014-03-26 16:37:00 +01:00
virtual css : : uno : : Reference < css : : frame : : XFrames > SAL_CALL getFrames ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual css : : uno : : Reference < css : : frame : : XFrame > SAL_CALL getActiveFrame ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL setActiveFrame ( const css : : uno : : Reference < css : : frame : : XFrame > & xFrame ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
// XFrame
2014-02-22 21:20:15 +01:00
2014-03-26 16:37:00 +01:00
virtual void SAL_CALL initialize ( const css : : uno : : Reference < css : : awt : : XWindow > & xWindow ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual css : : uno : : Reference < css : : awt : : XWindow > SAL_CALL getContainerWindow ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL setCreator ( const css : : uno : : Reference < css : : frame : : XFramesSupplier > & xCreator ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual css : : uno : : Reference < css : : frame : : XFramesSupplier > SAL_CALL getCreator ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual OUString SAL_CALL getName ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL setName ( const OUString & sName ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
virtual css : : uno : : Reference < css : : frame : : XFrame > SAL_CALL findFrame ( const OUString & sTargetFrameName ,
2014-03-26 16:37:00 +01:00
sal_Int32 nSearchFlags ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual sal_Bool SAL_CALL isTop ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL activate ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL deactivate ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual sal_Bool SAL_CALL isActive ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL contextChanged ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
virtual sal_Bool SAL_CALL setComponent ( const css : : uno : : Reference < css : : awt : : XWindow > & xComponentWindow ,
2014-03-26 16:37:00 +01:00
const css : : uno : : Reference < css : : frame : : XController > & xController ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual css : : uno : : Reference < css : : awt : : XWindow > SAL_CALL getComponentWindow ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual css : : uno : : Reference < css : : frame : : XController > SAL_CALL getController ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL addFrameActionListener ( const css : : uno : : Reference < css : : frame : : XFrameActionListener > & xListener ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL removeFrameActionListener ( const css : : uno : : Reference < css : : frame : : XFrameActionListener > & xListener ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
// XComponent
2014-02-22 21:20:15 +01:00
2014-03-26 16:37:00 +01:00
virtual void SAL_CALL dispose ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL addEventListener ( const css : : uno : : Reference < css : : lang : : XEventListener > & xListener ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL removeEventListener ( const css : : uno : : Reference < css : : lang : : XEventListener > & xListener ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
// XStatusIndicatorFactory
2014-02-22 21:20:15 +01:00
2014-03-26 16:37:00 +01:00
virtual css : : uno : : Reference < css : : task : : XStatusIndicator > SAL_CALL createStatusIndicator ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
// XDispatchProvider
2014-02-22 21:20:15 +01:00
2014-01-09 20:53:32 +01:00
virtual css : : uno : : Reference < css : : frame : : XDispatch > SAL_CALL queryDispatch ( const css : : util : : URL & aURL ,
const OUString & sTargetFrameName ,
2014-03-26 16:37:00 +01:00
sal_Int32 nSearchFlags ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
virtual css : : uno : : Sequence <
2014-03-26 16:37:00 +01:00
css : : uno : : Reference < css : : frame : : XDispatch > > SAL_CALL queryDispatches ( const css : : uno : : Sequence < css : : frame : : DispatchDescriptor > & lDescriptor ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
// XDispatchProviderInterception
2014-02-22 21:20:15 +01:00
2014-03-26 16:37:00 +01:00
virtual void SAL_CALL registerDispatchProviderInterceptor ( const css : : uno : : Reference < css : : frame : : XDispatchProviderInterceptor > & xInterceptor ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL releaseDispatchProviderInterceptor ( const css : : uno : : Reference < css : : frame : : XDispatchProviderInterceptor > & xInterceptor ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
// XDispatchInformationProvider
2014-02-22 21:20:15 +01:00
2014-03-26 16:37:00 +01:00
virtual css : : uno : : Sequence < sal_Int16 > SAL_CALL getSupportedCommandGroups ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual css : : uno : : Sequence < css : : frame : : DispatchInformation > SAL_CALL getConfigurableDispatchInformation ( sal_Int16 nCommandGroup ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
// XWindowListener
// Attention: windowResized() and windowShown() are implement only! All other are empty!
2014-02-22 21:20:15 +01:00
2014-03-26 16:37:00 +01:00
virtual void SAL_CALL windowResized ( const css : : awt : : WindowEvent & aEvent ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL windowMoved ( const css : : awt : : WindowEvent & /*aEvent*/ ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE { } ;
virtual void SAL_CALL windowShown ( const css : : lang : : EventObject & aEvent ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL windowHidden ( const css : : lang : : EventObject & aEvent ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
// XFocusListener
// Attention: focusLost() not implemented yet!
2014-02-22 21:20:15 +01:00
2014-03-26 16:37:00 +01:00
virtual void SAL_CALL focusGained ( const css : : awt : : FocusEvent & aEvent ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL focusLost ( const css : : awt : : FocusEvent & /*aEvent*/ ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE { } ;
2014-01-09 20:53:32 +01:00
// XTopWindowListener
// Attention: windowActivated(), windowDeactivated() and windowClosing() are implement only! All other are empty!
2014-02-22 21:20:15 +01:00
2014-03-26 16:37:00 +01:00
virtual void SAL_CALL windowActivated ( const css : : lang : : EventObject & aEvent ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL windowDeactivated ( const css : : lang : : EventObject & aEvent ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL windowOpened ( const css : : lang : : EventObject & /*aEvent*/ ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE { } ;
virtual void SAL_CALL windowClosing ( const css : : lang : : EventObject & aEvent ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL windowClosed ( const css : : lang : : EventObject & /*aEvent*/ ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE { } ;
virtual void SAL_CALL windowMinimized ( const css : : lang : : EventObject & /*aEvent*/ ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE { } ;
virtual void SAL_CALL windowNormalized ( const css : : lang : : EventObject & /*aEvent*/ ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE { } ;
2014-01-09 20:53:32 +01:00
// XEventListener
2014-02-22 21:20:15 +01:00
2014-03-26 16:37:00 +01:00
virtual void SAL_CALL disposing ( const css : : lang : : EventObject & aEvent ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
// XActionLockable
2014-02-22 21:20:15 +01:00
2014-03-26 16:37:00 +01:00
virtual sal_Bool SAL_CALL isActionLocked ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL addActionLock ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL removeActionLock ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL setActionLocks ( sal_Int16 nLock ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual sal_Int16 SAL_CALL resetActionLocks ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
// XCloseable
2014-02-22 21:20:15 +01:00
2014-01-09 20:53:32 +01:00
virtual void SAL_CALL close ( sal_Bool bDeliverOwnership ) throw ( css : : util : : CloseVetoException ,
2014-03-26 16:37:00 +01:00
css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
// XCloseBroadcaster
2014-02-22 21:20:15 +01:00
2014-03-26 16:37:00 +01:00
virtual void SAL_CALL addCloseListener ( const css : : uno : : Reference < css : : util : : XCloseListener > & xListener ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL removeCloseListener ( const css : : uno : : Reference < css : : util : : XCloseListener > & xListener ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
// XTitle
2014-02-22 21:20:15 +01:00
2014-03-26 16:37:00 +01:00
virtual OUString SAL_CALL getTitle ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL setTitle ( const OUString & sTitle ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
// XTitleChangeBroadcaster
2014-02-22 21:20:15 +01:00
2014-03-26 16:37:00 +01:00
virtual void SAL_CALL addTitleChangeListener ( const css : : uno : : Reference < css : : frame : : XTitleChangeListener > & xListener ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL removeTitleChangeListener ( const css : : uno : : Reference < css : : frame : : XTitleChangeListener > & xListenr ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
// XFrame2 attributes
2014-02-22 21:20:15 +01:00
2014-03-26 16:37:00 +01:00
virtual css : : uno : : Reference < css : : container : : XNameContainer > SAL_CALL getUserDefinedAttributes ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
2014-03-26 16:37:00 +01:00
virtual css : : uno : : Reference < css : : frame : : XDispatchRecorderSupplier > SAL_CALL getDispatchRecorderSupplier ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL setDispatchRecorderSupplier ( const css : : uno : : Reference < css : : frame : : XDispatchRecorderSupplier > & ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
2014-03-26 16:37:00 +01:00
virtual css : : uno : : Reference < css : : uno : : XInterface > SAL_CALL getLayoutManager ( ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
virtual void SAL_CALL setLayoutManager ( const css : : uno : : Reference < css : : uno : : XInterface > & ) throw ( css : : uno : : RuntimeException , std : : exception ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
// PropertySetHelper => XPropertySet, XPropertySetInfo
2014-02-22 21:20:15 +01:00
2014-01-09 20:53:32 +01:00
private :
void impl_initializePropInfo ( ) ;
virtual void SAL_CALL impl_setPropertyValue ( const OUString & sProperty ,
sal_Int32 nHandle ,
2014-03-26 16:37:00 +01:00
const css : : uno : : Any & aValue ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
virtual css : : uno : : Any SAL_CALL impl_getPropertyValue ( const OUString & sProperty ,
2014-03-26 16:37:00 +01:00
sal_Int32 nHandle ) SAL_OVERRIDE ;
2014-01-09 20:53:32 +01:00
2014-02-22 21:20:15 +01:00
2014-01-09 20:53:32 +01:00
private :
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2014-01-09 20:53:32 +01:00
@ short helper methods
2014-08-01 16:56:25 +09:00
@ descr Follow methods are needed at different points of our code ( more than ones ! ) .
2014-01-09 20:53:32 +01:00
@ attention Threadsafe methods are signed by " implts_... " !
*/ /*-*****************************************************************************************************/
// threadsafe
void implts_sendFrameActionEvent ( const css : : frame : : FrameAction & aAction ) ;
void implts_resizeComponentWindow ( ) ;
void implts_setIconOnWindow ( ) ;
void implts_startWindowListening ( ) ;
void implts_stopWindowListening ( ) ;
void implts_checkSuicide ( ) ;
void implts_forgetSubFrames ( ) ;
// non threadsafe
void impl_checkMenuCloser ( ) ;
2014-04-04 15:53:21 +02:00
void impl_setCloser ( const css : : uno : : Reference < css : : frame : : XFrame2 > & xFrame , bool bState ) ;
2014-01-09 20:53:32 +01:00
void impl_disposeContainerWindow ( css : : uno : : Reference < css : : awt : : XWindow > & xWindow ) ;
// debug methods
// (should be private everyway!)
2014-02-22 21:20:15 +01:00
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2014-01-09 20:53:32 +01:00
@ 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 This methods are static and can ' t use our member directly ! It ' s better for threadsafe code . . .
because we call it with references or pointer to check variables . . . and must make it safe
by himself !
@ seealso ASSERTs in implementation !
@ param references to checking variables
@ return sal_True , on invalid parameter
@ return sal_False , otherwise
@ onerror We return sal_True
*/ /*-*****************************************************************************************************/
private :
2014-04-04 15:53:21 +02:00
static bool implcp_setActiveFrame ( const css : : uno : : Reference < css : : frame : : XFrame > & xFrame ) ;
static bool implcp_addFrameActionListener ( const css : : uno : : Reference < css : : frame : : XFrameActionListener > & xListener ) ;
static bool implcp_removeFrameActionListener ( const css : : uno : : Reference < css : : frame : : XFrameActionListener > & xListener ) ;
static bool implcp_addEventListener ( const css : : uno : : Reference < css : : lang : : XEventListener > & xListener ) ;
static bool implcp_removeEventListener ( const css : : uno : : Reference < css : : lang : : XEventListener > & xListener ) ;
static bool implcp_windowResized ( const css : : awt : : WindowEvent & aEvent ) ;
static bool implcp_focusGained ( const css : : awt : : FocusEvent & aEvent ) ;
static bool implcp_windowActivated ( const css : : lang : : EventObject & aEvent ) ;
static bool implcp_windowDeactivated ( const css : : lang : : EventObject & aEvent ) ;
static bool implcp_disposing ( const css : : lang : : EventObject & aEvent ) ;
2014-01-09 20:53:32 +01:00
// variables
2014-03-20 09:30:14 +01:00
// -threadsafe by SolarMutex
2014-02-25 18:54:02 +01:00
2014-01-09 20:53:32 +01:00
private :
2014-04-06 19:36:08 +03:00
css : : uno : : Reference < css : : uno : : XComponentContext > m_xContext ; /// reference to factory, which has create this instance
css : : uno : : Reference < css : : task : : XStatusIndicatorFactory > m_xIndicatorFactoryHelper ; /// reference to factory helper to create status indicator objects
css : : uno : : WeakReference < css : : task : : XStatusIndicator > m_xIndicatorInterception ; /// points to an external set progress, which should be used instead of the internal one.
css : : uno : : Reference < css : : frame : : XDispatchProvider > m_xDispatchHelper ; /// helper for XDispatch/Provider and interception interfaces
css : : uno : : Reference < css : : frame : : XFrames > m_xFramesHelper ; /// helper for XFrames, XIndexAccess and XElementAccess interfaces
: : cppu : : OMultiTypeInterfaceContainerHelper m_aListenerContainer ; /// container for ALL Listener
css : : uno : : Reference < css : : frame : : XFramesSupplier > m_xParent ; /// parent of this frame
css : : uno : : Reference < css : : awt : : XWindow > m_xContainerWindow ; /// containerwindow of this frame for embedded components
css : : uno : : Reference < css : : awt : : XWindow > m_xComponentWindow ; /// window of the actual component
css : : uno : : Reference < css : : frame : : XController > m_xController ; /// controller of the actual frame
css : : uno : : Reference < css : : datatransfer : : dnd : : XDropTargetListener > m_xDropTargetListener ; /// listen to drag & drop
EActiveState m_eActiveState ; /// state, if i'am a member of active path in tree or i have the focus or ...
OUString m_sName ; /// name of this frame
2014-04-04 15:53:21 +02:00
bool m_bIsFrameTop ; /// frame has no parent or the parent is a taskor the desktop
bool m_bConnected ; /// due to FrameActionEvent
2014-04-06 19:36:08 +03:00
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
2014-04-04 15:53:21 +02:00
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
bool m_bIsHidden ; /// indicates, if this frame is used in hidden mode or not
2014-04-06 19:36:08 +03:00
static css : : uno : : WeakReference < css : : frame : : XFrame2 > m_xCloserFrame ; /// holds the only frame, which must show the special closer menu item (can be NULL!)
2014-05-27 08:11:10 +02:00
css : : uno : : Reference < css : : frame : : XLayoutManager2 > m_xLayoutManager ; /// is used to layout the child windows of the frame.
2014-04-06 19:36:08 +03:00
css : : uno : : Reference < css : : frame : : XDispatchInformationProvider > m_xDispatchInfoHelper ;
css : : uno : : Reference < css : : frame : : XTitle > m_xTitleHelper ;
WindowCommandDispatch * m_pWindowCommandDispatch ;
2014-01-09 20:53:32 +01:00
protected :
2014-04-06 19:36:08 +03:00
FrameContainer m_aChildFrameContainer ; /// array of child frames
2014-01-09 20:53:32 +01:00
} ;
2000-09-18 15:33:13 +00:00
2013-03-22 09:24:15 +02:00
css : : uno : : WeakReference < css : : frame : : XFrame2 > Frame : : m_xCloserFrame = css : : uno : : WeakReference < css : : frame : : XFrame2 > ( ) ;
2003-03-25 17:22:13 +00:00
2001-05-02 11:58:40 +00:00
// XInterface, XTypeProvider, XServiceInfo
2014-02-25 18:54:02 +01:00
2013-03-22 09:24:15 +02:00
DEFINE_XINTERFACE_22 ( Frame ,
2001-05-02 11:58:40 +00:00
OWeakObject ,
DIRECT_INTERFACE ( css : : lang : : XTypeProvider ) ,
DIRECT_INTERFACE ( css : : lang : : XServiceInfo ) ,
2013-03-22 09:24:15 +02:00
DIRECT_INTERFACE ( css : : frame : : XFrame2 ) ,
2001-05-02 11:58:40 +00:00
DIRECT_INTERFACE ( css : : frame : : XFramesSupplier ) ,
DIRECT_INTERFACE ( css : : frame : : XFrame ) ,
DIRECT_INTERFACE ( css : : task : : XStatusIndicatorFactory ) ,
DIRECT_INTERFACE ( css : : frame : : XDispatchProvider ) ,
2004-11-16 13:54:13 +00:00
DIRECT_INTERFACE ( css : : frame : : XDispatchInformationProvider ) ,
2001-05-02 11:58:40 +00:00
DIRECT_INTERFACE ( css : : frame : : XDispatchProviderInterception ) ,
2013-03-22 09:24:15 +02:00
DIRECT_INTERFACE ( css : : lang : : XComponent ) ,
2001-05-02 11:58:40 +00:00
DIRECT_INTERFACE ( css : : beans : : XPropertySet ) ,
2005-07-12 13:15:16 +00:00
DIRECT_INTERFACE ( css : : beans : : XPropertySetInfo ) ,
2001-05-02 11:58:40 +00:00
DIRECT_INTERFACE ( css : : awt : : XWindowListener ) ,
DIRECT_INTERFACE ( css : : awt : : XTopWindowListener ) ,
DIRECT_INTERFACE ( css : : awt : : XFocusListener ) ,
2001-08-16 11:16:12 +00:00
DERIVED_INTERFACE ( css : : lang : : XEventListener , css : : awt : : XWindowListener ) ,
2002-05-23 11:54:59 +00:00
DIRECT_INTERFACE ( css : : document : : XActionLockable ) ,
DIRECT_INTERFACE ( css : : util : : XCloseable ) ,
2002-07-29 07:23:08 +00:00
DIRECT_INTERFACE ( css : : util : : XCloseBroadcaster ) ,
2008-04-04 13:12:20 +00:00
DIRECT_INTERFACE ( css : : frame : : XComponentLoader ) ,
DIRECT_INTERFACE ( css : : frame : : XTitle ) ,
DIRECT_INTERFACE ( css : : frame : : XTitleChangeBroadcaster )
2001-05-02 11:58:40 +00:00
)
2013-03-22 09:24:15 +02:00
DEFINE_XTYPEPROVIDER_21 ( Frame ,
2001-05-02 11:58:40 +00:00
css : : lang : : XTypeProvider ,
css : : lang : : XServiceInfo ,
2013-03-22 09:24:15 +02:00
css : : frame : : XFrame2 ,
2001-05-02 11:58:40 +00:00
css : : frame : : XFramesSupplier ,
css : : frame : : XFrame ,
css : : task : : XStatusIndicatorFactory ,
css : : frame : : XDispatchProvider ,
2004-11-16 13:54:13 +00:00
css : : frame : : XDispatchInformationProvider ,
2001-05-02 11:58:40 +00:00
css : : frame : : XDispatchProviderInterception ,
2013-03-22 09:24:15 +02:00
css : : lang : : XComponent ,
css : : beans : : XPropertySet ,
css : : beans : : XPropertySetInfo ,
2001-05-02 11:58:40 +00:00
css : : awt : : XWindowListener ,
css : : awt : : XTopWindowListener ,
css : : awt : : XFocusListener ,
2002-05-23 11:54:59 +00:00
css : : lang : : XEventListener ,
css : : util : : XCloseable ,
2002-07-29 07:23:08 +00:00
css : : util : : XCloseBroadcaster ,
2008-04-04 13:12:20 +00:00
css : : frame : : XComponentLoader ,
css : : frame : : XTitle ,
css : : frame : : XTitleChangeBroadcaster
2001-05-02 11:58:40 +00:00
)
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short standard constructor to create instance by factory
@ descr This constructor initialize a new instance of this class by valid factory ,
and will be set valid values on his member and baseclasses .
2001-07-04 12:34:18 +00:00
@ attention a ) Don ' t use your own reference during an UNO - Service - ctor ! There is no guarantee , that you
will get over this . ( e . g . using of your reference as parameter to initialize some member )
2014-04-26 19:28:59 +02:00
Do such things in DEFINE_INIT_SERVICE ( ) method , which is called automatically after your ctor ! ! !
2001-07-04 12:34:18 +00:00
b ) Baseclass OBroadcastHelper is a typedef in namespace cppu !
The microsoft compiler has some problems to handle it right BY using namespace explicitly : : cppu : : OBroadcastHelper .
If we write it without a namespace or expand the typedef to OBrodcastHelperVar < . . . > - > it will be OK ! ?
I don ' t know why ! ( other compiler not tested . . but it works ! )
@ seealso method DEFINE_INIT_SERVICE ( )
2001-05-02 11:58:40 +00:00
2013-05-21 17:38:02 +02:00
@ param xContext is the multi service manager , which creates this instance .
The value must be different from NULL !
2001-05-02 11:58:40 +00:00
@ onerror ASSERT in debug version or nothing in relaese version .
*/ /*-*****************************************************************************************************/
2013-05-21 17:38:02 +02:00
Frame : : Frame ( const css : : uno : : Reference < css : : uno : : XComponentContext > & xContext )
2014-03-20 09:30:14 +01:00
: TransactionBase ( )
2014-03-20 09:23:04 +01:00
, PropertySetHelper ( m_aMutex ,
2006-02-07 09:24:34 +00:00
& m_aTransactionManager ,
2014-04-04 15:53:21 +02:00
false ) // sal_False => dont release shared mutex on calling us!
2001-05-02 11:58:40 +00:00
// init member
2013-05-21 17:38:02 +02:00
, m_xContext ( xContext )
2014-03-20 09:30:14 +01:00
, m_aListenerContainer ( m_aMutex )
2001-05-02 11:58:40 +00:00
, m_xParent ( )
, m_xContainerWindow ( )
, m_xComponentWindow ( )
, m_xController ( )
, m_eActiveState ( E_INACTIVE )
, m_sName ( )
2014-04-04 15:53:21 +02:00
, m_bIsFrameTop ( true ) // I think we are top without a parent ... and there is no parent yet!
, m_bConnected ( false ) // There exist no component inside of use => sal_False, we are not connected!
2001-08-16 08:45:37 +00:00
, m_nExternalLockCount ( 0 )
2014-04-04 15:53:21 +02:00
, m_bSelfClose ( false ) // Important!
, m_bIsHidden ( true )
2008-04-04 13:12:20 +00:00
, m_xTitleHelper ( )
2011-02-02 13:12:46 +00:00
, m_pWindowCommandDispatch ( 0 )
2006-06-19 10:27:40 +00:00
, m_aChildFrameContainer ( )
2001-05-02 11:58:40 +00:00
{
2014-01-09 20:53:32 +01:00
}
2014-01-22 11:54:19 +01:00
void Frame : : initListeners ( )
2014-01-09 20:53:32 +01:00
{
css : : uno : : Reference < css : : uno : : XInterface > xThis ( static_cast < : : cppu : : OWeakObject * > ( this ) , css : : uno : : UNO_QUERY_THROW ) ;
// Initialize a new dispatchhelper-object to handle dispatches.
// We use these helper as slave for our interceptor helper ... not directly!
// But he is event listener on THIS instance!
DispatchProvider * pDispatchHelper = new DispatchProvider ( m_xContext , this ) ;
css : : uno : : Reference < css : : frame : : XDispatchProvider > xDispatchProvider ( static_cast < : : cppu : : OWeakObject * > ( pDispatchHelper ) , css : : uno : : UNO_QUERY ) ;
DispatchInformationProvider * pInfoHelper = new DispatchInformationProvider ( m_xContext , this ) ;
m_xDispatchInfoHelper = css : : uno : : Reference < css : : frame : : XDispatchInformationProvider > ( static_cast < : : cppu : : OWeakObject * > ( pInfoHelper ) , css : : uno : : UNO_QUERY ) ;
// Initialize a new interception helper object to handle dispatches and implement an interceptor mechanism.
// Set created dispatch provider as slowest slave of it.
// Hold interception helper by reference only - not by pointer!
2014-06-29 00:11:19 +02:00
// So it's easier to destroy it.
2014-01-09 20:53:32 +01:00
InterceptionHelper * pInterceptionHelper = new InterceptionHelper ( this , xDispatchProvider ) ;
m_xDispatchHelper = css : : uno : : Reference < css : : frame : : XDispatchProvider > ( static_cast < : : cppu : : OWeakObject * > ( pInterceptionHelper ) , css : : uno : : UNO_QUERY ) ;
// Initialize a new XFrames-helper-object to handle XIndexAccess and XElementAccess.
// We hold member as reference ... not as pointer too!
// Attention: We share our frame container with this helper. Container is threadsafe himself ... So I think we can do that.
// But look on dispose() for right order of deinitialization.
OFrames * pFramesHelper = new OFrames ( this , & m_aChildFrameContainer ) ;
m_xFramesHelper = css : : uno : : Reference < css : : frame : : XFrames > ( static_cast < : : cppu : : OWeakObject * > ( pFramesHelper ) , css : : uno : : UNO_QUERY ) ;
2001-05-02 11:58:40 +00:00
2014-01-09 20:53:32 +01:00
// Initialize a the drop target listener.
// We hold member as reference ... not as pointer too!
OpenFileDropTargetListener * pDropListener = new OpenFileDropTargetListener ( m_xContext , this ) ;
m_xDropTargetListener = css : : uno : : Reference < css : : datatransfer : : dnd : : XDropTargetListener > ( static_cast < : : cppu : : OWeakObject * > ( pDropListener ) , css : : uno : : UNO_QUERY ) ;
// Safe impossible cases
// We can't work without these helpers!
2014-11-10 15:05:25 +01:00
SAL_WARN_IF ( ! xDispatchProvider . is ( ) , " fwk " , " Frame::Frame(): Slowest slave for dispatch- and interception helper is not valid. XDispatchProvider, XDispatch, XDispatchProviderInterception are not full supported! " ) ;
SAL_WARN_IF ( ! m_xDispatchHelper . is ( ) , " fwk " , " Frame::Frame(): Interception helper is not valid. XDispatchProvider, XDispatch, XDispatchProviderInterception are not full supported! " ) ;
SAL_WARN_IF ( ! m_xFramesHelper . is ( ) , " fwk " , " Frame::Frame(): Frames helper is not valid. XFrames, XIndexAccess and XElementAcces are not supported! " ) ;
SAL_WARN_IF ( ! m_xDropTargetListener . is ( ) , " fwk " , " Frame::Frame(): DropTarget helper is not valid. Drag and drop without functionality! " ) ;
2014-01-09 20:53:32 +01:00
// establish notifies for changing of "disabled commands" configuration during runtime
m_aCommandOptions . EstablisFrameCallback ( this ) ;
// Create an initial layout manager
// Create layout manager and connect it to the newly created frame
m_xLayoutManager = css : : frame : : LayoutManager : : create ( m_xContext ) ;
// set information about all supported properties at the base class helper PropertySetHelper
impl_initializePropInfo ( ) ;
2000-09-18 15:33:13 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short standard destructor
@ descr This one do NOTHING ! Use dispose ( ) instaed of this .
@ seealso method dispose ( )
*/ /*-*****************************************************************************************************/
2000-09-18 15:33:13 +00:00
Frame : : ~ Frame ( )
{
2013-09-08 23:00:27 +03:00
SAL_WARN_IF ( m_aTransactionManager . getWorkingMode ( ) ! = E_CLOSE , " fwk " , " Frame::~Frame(): Who forgot to dispose this service? " ) ;
2000-09-18 15:33:13 +00:00
}
2014-02-25 18:54:02 +01:00
/*-************************************************************************************************************
2002-07-29 07:23:08 +00:00
@ interface XComponentLoader
@ short try to load given URL into a task
2013-02-28 18:11:24 -04:00
@ descr You can give us some information about the content , which you will load into a frame .
2002-07-29 07:23:08 +00:00
We search or create this target for you , make a type detection of given URL and try to load it .
As result of this operation we return the new created component or nothing , if loading failed .
2014-11-12 12:25:13 +01:00
@ param " sURL " , URL , which represent the content
2002-07-29 07:23:08 +00:00
@ param " sTargetFrameName " , name of target frame or special value like " _self " , " _blank " . . .
2014-11-10 15:05:25 +01:00
@ param " nSearchFlags " , optional arguments for frame search , if target is not a special one
2002-07-29 07:23:08 +00:00
@ param " lArguments " , optional arguments for loading
@ return A valid component reference , if loading was successfully .
A null reference otherwise .
@ onerror We return a null reference .
@ threadsafe yes
*/ /*-*************************************************************************************************************/
2013-04-07 12:06:47 +02:00
css : : uno : : Reference < css : : lang : : XComponent > SAL_CALL Frame : : loadComponentFromURL ( const OUString & sURL ,
const OUString & sTargetFrameName ,
2002-07-29 07:23:08 +00:00
sal_Int32 nSearchFlags ,
const css : : uno : : Sequence < css : : beans : : PropertyValue > & lArguments ) throw ( css : : io : : IOException ,
css : : lang : : IllegalArgumentException ,
2014-02-25 21:31:58 +01:00
css : : uno : : RuntimeException , std : : exception )
2002-07-29 07:23:08 +00:00
{
2009-07-30 10:52:48 +00:00
{
// If the frame is closed the call might lead to crash even with target "_blank",
// so the DisposedException should be thrown in this case
// It still looks to be too dangerous to set the transaction for the whole loading process
// so the guard is used in scopes to let the standard check be used
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
}
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2004-01-28 13:40:30 +00:00
css : : uno : : Reference < css : : frame : : XComponentLoader > xThis ( static_cast < css : : frame : : XComponentLoader * > ( this ) , css : : uno : : UNO_QUERY ) ;
2013-05-21 17:38:02 +02:00
css : : uno : : Reference < css : : uno : : XComponentContext > xContext = m_xContext ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2002-07-29 07:23:08 +00:00
2013-05-21 17:38:02 +02:00
return LoadEnv : : loadComponentFromURL ( xThis , xContext , sURL , sTargetFrameName , nSearchFlags , lArguments ) ;
2002-07-29 07:23:08 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2011-12-07 02:33:51 -08:00
@ short return access to append or remove children on desktop
2001-05-02 11:58:40 +00:00
@ descr We don ' t implement these interface directly . We use a helper class to do this .
2011-12-07 02:33:51 -08:00
If you wish to add or delete children to / from the container , call these method to get
2001-05-02 11:58:40 +00:00
a reference to the helper .
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ seealso class OFrames
@ return A reference to the helper which answer your queries .
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ onerror A null reference is returned .
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
css : : uno : : Reference < css : : frame : : XFrames > SAL_CALL Frame : : getFrames ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Register transaction and reject wrong calls.
2001-05-04 09:21:42 +00:00
/*TODO
This is a temp . HACK !
Our parent ( a Task ! ) stand in close / dispose and set working mode to E_BEFOERECLOSE
and call dispose on us ! We tra to get this xFramesHelper and are reject by an " already closed " pranet instance . . . .
= > We use SOFTEXCEPTIONS here . . . but we should make it right in further times . . . .
*/
TransactionGuard aTransaction ( m_aTransactionManager , E_SOFTEXCEPTIONS ) ;
2001-05-02 11:58:40 +00:00
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2000-09-18 15:33:13 +00:00
// Return access to all child frames to caller.
2014-04-06 20:25:20 +03:00
// Our childframe container is implemented in helper class OFrames and used as a reference m_xFramesHelper!
2000-09-18 15:33:13 +00:00
return m_xFramesHelper ;
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short get the current active child frame
2011-12-07 02:33:51 -08:00
@ descr It must be a frameto . Direct children of a frame are frames only ! No task or desktop is accepted .
2014-04-06 20:25:20 +03:00
We don ' t save this information directly in this class . We use our container - helper
2001-05-02 11:58:40 +00:00
to do that .
@ seealso class OFrameContainer
@ seealso method setActiveFrame ( )
2014-04-06 20:25:20 +03:00
@ return A reference to our current active childframe , if anyone exist .
2001-05-02 11:58:40 +00:00
@ return A null reference , if nobody is active .
@ onerror A null reference is returned .
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
css : : uno : : Reference < css : : frame : : XFrame > SAL_CALL Frame : : getActiveFrame ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Register transaction and reject wrong calls.
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2000-09-18 15:33:13 +00:00
// Return current active frame.
2013-03-13 08:57:14 +01:00
// This information is available on the container.
2000-09-18 15:33:13 +00:00
return m_aChildFrameContainer . getActive ( ) ;
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short set the new active direct child frame
2011-12-07 02:33:51 -08:00
@ descr It must be a frame to . Direct children of frame are frames only ! No task or desktop is accepted .
2014-04-06 20:25:20 +03:00
We don ' t save this information directly in this class . We use our container - helper
2001-05-02 11:58:40 +00:00
to do that .
@ seealso class OFrameContainer
@ seealso method getActiveFrame ( )
@ param " xFrame " , reference to new active child . It must be an already existing child !
@ onerror An assertion is thrown and element is ignored , if given frame is ' nt already a child of us .
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : setActiveFrame ( const css : : uno : : Reference < css : : frame : : XFrame > & xFrame ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Check incoming parameters.
2013-09-08 23:00:27 +03:00
SAL_WARN_IF ( implcp_setActiveFrame ( xFrame ) , " fwk " , " Frame::setActiveFrame(): Invalid parameter detected! " ) ;
2001-05-02 11:58:40 +00:00
// Look for rejected calls!
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
2014-03-20 09:30:14 +01:00
SolarMutexResettableGuard aWriteLock ;
2000-09-18 15:33:13 +00:00
2013-03-03 17:11:39 +01:00
// Copy necessary member for threadsafe access!
2001-05-02 11:58:40 +00:00
// m_aChildFrameContainer is threadsafe himself and he live if we live!!!
// ...and our transaction is non breakable too ...
css : : uno : : Reference < css : : frame : : XFrame > xActiveChild = m_aChildFrameContainer . getActive ( ) ;
2014-04-06 19:36:08 +03:00
EActiveState eActiveState = m_eActiveState ;
2001-05-02 11:58:40 +00:00
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
2000-09-18 15:33:13 +00:00
// Don't work, if "new" active frame is'nt different from current one!
2001-05-02 11:58:40 +00:00
// (xFrame==NULL is allowed to UNSET it!)
if ( xActiveChild ! = xFrame )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
// ... otherwise set new and deactivate old one.
2000-09-18 15:33:13 +00:00
m_aChildFrameContainer . setActive ( xFrame ) ;
2001-05-02 11:58:40 +00:00
if (
( eActiveState ! = E_INACTIVE ) & &
2014-01-21 18:22:24 +01:00
xActiveChild . is ( )
2001-05-02 11:58:40 +00:00
)
{
2000-09-18 15:33:13 +00:00
xActiveChild - > deactivate ( ) ;
2001-05-02 11:58:40 +00:00
}
2000-09-18 15:33:13 +00:00
}
2000-12-07 10:12:31 +00:00
2014-01-21 18:22:24 +01:00
if ( xFrame . is ( ) )
2000-12-07 10:12:31 +00:00
{
2001-05-02 11:58:40 +00:00
// If last active frame had focus ...
// ... reset state to ACTIVE and send right FrameActionEvent for focus lost.
if ( eActiveState = = E_FOCUS )
2000-12-07 10:12:31 +00:00
{
2014-03-20 09:30:14 +01:00
aWriteLock . reset ( ) ;
2014-04-06 19:36:08 +03:00
eActiveState = E_ACTIVE ;
2001-05-04 09:21:42 +00:00
m_eActiveState = eActiveState ;
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2001-05-02 11:58:40 +00:00
implts_sendFrameActionEvent ( css : : frame : : FrameAction_FRAME_UI_DEACTIVATING ) ;
2000-12-07 10:12:31 +00:00
}
2001-05-02 11:58:40 +00:00
// If last active frame was active ...
2014-11-10 15:05:25 +01:00
// but new one is not it ...
2001-05-02 11:58:40 +00:00
// ... set it as active one.
if (
( eActiveState = = E_ACTIVE ) & &
( xFrame - > isActive ( ) = = sal_False )
)
{
2000-12-07 10:12:31 +00:00
xFrame - > activate ( ) ;
2001-05-02 11:58:40 +00:00
}
2000-12-07 10:12:31 +00:00
}
2001-05-02 11:58:40 +00:00
else
// If this frame is active and has no active subframe anymore it is UI active too
if ( eActiveState = = E_ACTIVE )
2000-12-07 10:12:31 +00:00
{
2014-03-20 09:30:14 +01:00
aWriteLock . reset ( ) ;
2014-04-06 19:36:08 +03:00
eActiveState = E_FOCUS ;
2001-05-02 11:58:40 +00:00
m_eActiveState = eActiveState ;
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2001-05-04 09:21:42 +00:00
implts_sendFrameActionEvent ( css : : frame : : FrameAction_FRAME_UI_ACTIVATED ) ;
2001-03-30 14:36:07 +00:00
}
2000-09-18 15:33:13 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2007-07-06 11:22:50 +00:00
initialize new created layout manager
* */
2013-05-27 12:58:50 +02:00
void lcl_enableLayoutManager ( const css : : uno : : Reference < css : : frame : : XLayoutManager2 > & xLayoutManager ,
2007-07-06 11:22:50 +00:00
const css : : uno : : Reference < css : : frame : : XFrame > & xFrame )
{
// Provide container window to our layout manager implementation
xLayoutManager - > attachFrame ( xFrame ) ;
2013-05-27 12:58:50 +02:00
xFrame - > addFrameActionListener ( xLayoutManager ) ;
2007-07-06 11:22:50 +00:00
DockingAreaDefaultAcceptor * pAcceptor = new DockingAreaDefaultAcceptor ( xFrame ) ;
css : : uno : : Reference < css : : ui : : XDockingAreaAcceptor > xDockingAreaAcceptor ( static_cast < : : cppu : : OWeakObject * > ( pAcceptor ) , css : : uno : : UNO_QUERY_THROW ) ;
xLayoutManager - > setDockingAreaAcceptor ( xDockingAreaAcceptor ) ;
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2007-07-06 11:22:50 +00:00
deinitialize layout manager
* */
2013-05-27 12:58:50 +02:00
void lcl_disableLayoutManager ( const css : : uno : : Reference < css : : frame : : XLayoutManager2 > & xLayoutManager ,
2007-07-06 11:22:50 +00:00
const css : : uno : : Reference < css : : frame : : XFrame > & xFrame )
{
2013-05-27 12:58:50 +02:00
xFrame - > removeFrameActionListener ( xLayoutManager ) ;
2007-07-06 11:22:50 +00:00
xLayoutManager - > setDockingAreaAcceptor ( css : : uno : : Reference < css : : ui : : XDockingAreaAcceptor > ( ) ) ;
xLayoutManager - > attachFrame ( css : : uno : : Reference < css : : frame : : XFrame > ( ) ) ;
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short initialize frame instance
@ descr A frame needs a window . This method set a new one . . . but should called one times only !
We use this window to listen for window events and forward it to our set component .
Its used as parent of component window too .
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ seealso method getContainerWindow ( )
@ seealso method setComponent ( )
@ seealso member m_xContainerWindow
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ param " xWindow " , reference to new container window - must be valid !
@ onerror We do nothing .
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : initialize ( const css : : uno : : Reference < css : : awt : : XWindow > & xWindow ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
2004-11-26 13:33:19 +00:00
if ( ! xWindow . is ( ) )
throw css : : uno : : RuntimeException (
2014-05-26 15:26:03 +02:00
" Frame::initialize() called without a valid container window reference. " ,
2004-11-26 13:33:19 +00:00
static_cast < css : : frame : : XFrame * > ( this ) ) ;
2003-06-10 08:10:41 +00:00
2001-06-19 09:37:05 +00:00
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
2014-03-20 09:30:14 +01:00
SolarMutexResettableGuard aWriteLock ;
2001-06-19 09:37:05 +00:00
2005-07-12 13:15:16 +00:00
if ( m_xContainerWindow . is ( ) )
throw css : : uno : : RuntimeException (
2014-11-10 15:05:25 +01:00
" Frame::initialized() is called more than once, which is not useful nor allowed. " ,
2005-07-12 13:15:16 +00:00
static_cast < css : : frame : : XFrame * > ( this ) ) ;
2001-05-02 11:58:40 +00:00
// Look for rejected calls first!
TransactionGuard aTransaction ( m_aTransactionManager , E_SOFTEXCEPTIONS ) ;
2000-09-18 15:33:13 +00:00
2001-08-10 10:54:29 +00:00
// Enable object for real working ... so follow impl methods don't must handle it special! (e.g. E_SOFTEXCEPTIONS for rejected calls)
m_aTransactionManager . setWorkingMode ( E_WORK ) ;
2001-05-02 11:58:40 +00:00
// This must be the first call of this method!
// We should initialize our object and open it for working.
// Set the new window.
2013-09-08 23:00:27 +03:00
SAL_WARN_IF ( m_xContainerWindow . is ( ) , " fwk " , " Frame::initialize(): Leak detected! This state should never occur ... " ) ;
2001-06-11 11:52:42 +00:00
m_xContainerWindow = xWindow ;
2004-11-26 13:33:19 +00:00
// if window is initially visible, we will never get a windowShowing event
2014-09-23 11:20:40 +02:00
vcl : : Window * pWindow = VCLUnoHelper : : GetWindow ( xWindow ) ;
2004-11-26 13:33:19 +00:00
if ( pWindow & & pWindow - > IsVisible ( ) )
2014-04-04 15:53:21 +02:00
m_bIsHidden = false ;
2000-09-18 15:33:13 +00:00
2013-05-21 17:38:02 +02:00
css : : uno : : Reference < css : : uno : : XComponentContext > xContext = m_xContext ;
2013-05-27 12:58:50 +02:00
css : : uno : : Reference < css : : frame : : XLayoutManager2 > xLayoutManager = m_xLayoutManager ;
2004-02-25 16:48:50 +00:00
2001-06-19 09:37:05 +00:00
// Release lock ... because we call some impl methods, which are threadsafe by himself.
// If we hold this lock - we will produce our own deadlock!
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2001-06-19 09:37:05 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
2001-06-11 11:52:42 +00:00
2004-11-26 13:33:19 +00:00
if ( xLayoutManager . is ( ) )
2007-07-06 11:22:50 +00:00
lcl_enableLayoutManager ( xLayoutManager , this ) ;
2004-11-26 13:33:19 +00:00
// create progress helper
css : : uno : : Reference < css : : frame : : XFrame > xThis ( static_cast < css : : frame : : XFrame * > ( this ) , css : : uno : : UNO_QUERY_THROW ) ;
2013-02-25 15:17:03 +02:00
css : : uno : : Reference < css : : task : : XStatusIndicatorFactory > xIndicatorFactory =
2013-05-21 17:38:02 +02:00
css : : task : : StatusIndicatorFactory : : createWithFrame ( xContext , xThis , sal_False /*DisableReschedule*/ , sal_True /*AllowParentShow*/ ) ;
2004-11-26 13:33:19 +00:00
// SAFE -> ----------------------------------
2014-03-20 09:30:14 +01:00
aWriteLock . reset ( ) ;
2004-11-26 13:33:19 +00:00
m_xIndicatorFactoryHelper = xIndicatorFactory ;
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2004-11-26 13:33:19 +00:00
// <- SAFE ----------------------------------
2001-06-19 09:37:05 +00:00
// Start listening for events after setting it on helper class ...
// So superflous messages are filtered to NULL :-)
implts_startWindowListening ( ) ;
2005-07-12 13:15:16 +00:00
impl_enablePropertySet ( ) ;
2007-07-05 07:58:43 +00:00
2013-05-21 17:38:02 +02:00
m_pWindowCommandDispatch = new WindowCommandDispatch ( xContext , this ) ;
2008-04-04 13:12:20 +00:00
// Initialize title functionality
2013-05-21 17:38:02 +02:00
TitleHelper * pTitleHelper = new TitleHelper ( xContext ) ;
2008-04-04 13:12:20 +00:00
m_xTitleHelper = css : : uno : : Reference < css : : frame : : XTitle > ( static_cast < : : cppu : : OWeakObject * > ( pTitleHelper ) , css : : uno : : UNO_QUERY_THROW ) ;
pTitleHelper - > setOwner ( xThis ) ;
2000-09-18 15:33:13 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short returns current set container window
@ descr The ContainerWindow property is used as a container for the component
in this frame . So this object implements a container interface too .
The instantiation of the container window is done by the user of this class .
The frame is the owner of its container window .
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ seealso method initialize ( )
@ return A reference to current set containerwindow .
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ onerror A null reference is returned .
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
css : : uno : : Reference < css : : awt : : XWindow > SAL_CALL Frame : : getContainerWindow ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Register transaction and reject wrong calls.
2001-05-03 12:21:51 +00:00
TransactionGuard aTransaction ( m_aTransactionManager , E_SOFTEXCEPTIONS ) ;
2000-09-18 15:33:13 +00:00
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2001-05-02 11:58:40 +00:00
return m_xContainerWindow ;
2000-09-18 15:33:13 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short set parent frame
@ descr We need a parent to support some functionality ! e . g . findFrame ( )
2002-05-23 11:54:59 +00:00
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 .
2000-09-18 15:33:13 +00:00
2002-05-23 11:54:59 +00:00
@ seealso getCreator ( )
@ seealso findFrame ( )
@ seealso isTop ( )
@ seealos m_bIsFrameTop
2000-09-18 15:33:13 +00:00
2002-05-23 11:54:59 +00:00
@ param xCreator
valid reference to our new owner frame , which should implement a supplier interface
2001-05-02 11:58:40 +00:00
2002-05-23 11:54:59 +00:00
@ threadsafe yes
2001-05-02 11:58:40 +00:00
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : setCreator ( const css : : uno : : Reference < css : : frame : : XFramesSupplier > & xCreator ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
2000-09-18 15:33:13 +00:00
2002-05-23 11:54:59 +00:00
/* SAFE { */
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aWriteLock ;
2002-05-23 11:54:59 +00:00
m_xParent = xCreator ;
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2002-05-23 11:54:59 +00:00
/* } SAFE */
2000-09-18 15:33:13 +00:00
2002-05-23 11:54:59 +00:00
css : : uno : : Reference < css : : frame : : XDesktop > xIsDesktop ( xCreator , css : : uno : : UNO_QUERY ) ;
m_bIsFrameTop = ( xIsDesktop . is ( ) | | ! xCreator . is ( ) ) ;
2000-09-18 15:33:13 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short returns current parent frame
@ descr The Creator is the parent frame container . If it is NULL , the frame is the uppermost one .
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ seealso method setCreator ( )
@ return A reference to current set parent frame container .
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ onerror A null reference is returned .
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
css : : uno : : Reference < css : : frame : : XFramesSupplier > SAL_CALL Frame : : getCreator ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Register transaction and reject wrong calls.
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
2000-09-18 15:33:13 +00:00
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2001-05-02 11:58:40 +00:00
return m_xParent ;
2000-09-18 15:33:13 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short returns current set name of frame
@ descr This name is used to find target of findFrame ( ) or queryDispatch ( ) calls .
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ seealso method setName ( )
@ return Current set name of frame .
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ onerror An empty string is returned .
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
OUString SAL_CALL Frame : : getName ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2000-09-18 15:33:13 +00:00
return m_sName ;
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short set new name for frame
@ descr This name is used to find target of findFrame ( ) or queryDispatch ( ) calls .
@ attention Special names like " _blank " , " _self " aren ' t allowed . . .
" _beamer " or " _menubar " excepts this rule !
@ seealso method getName ( )
@ param " sName " , new frame name .
@ onerror We do nothing .
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : setName ( const OUString & sName ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-05-02 11:58:40 +00:00
{
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2001-05-02 11:58:40 +00:00
// Set new name ... but look for invalid special target names!
// They are not allowed to set.
2007-04-16 15:43:56 +00:00
if ( TargetHelper : : isValidNameForFrame ( sName ) )
2003-03-25 17:22:13 +00:00
m_sName = sName ;
2001-05-02 11:58:40 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short search for frames
@ descr This method searches for a frame with the specified name .
Frames may contain other frames ( e . g . a frameset ) and may
2014-04-10 09:35:15 +02:00
be contained in other frames . This hierarchy is searched by
2001-05-02 11:58:40 +00:00
this method .
First some special names are taken into account , i . e . " " ,
2002-05-23 11:54:59 +00:00
" _self " , " _top " , " _blank " etc . The nSearchFlags are ignored
2001-05-02 11:58:40 +00:00
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 )
2002-05-23 11:54:59 +00:00
the method findFrame ( ) is called for all children , for siblings
and as last for the parent frame .
2001-05-02 11:58:40 +00:00
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 .
2002-05-23 11:54:59 +00:00
@ param sTargetFrameName
special names ( _blank , _self ) or real name of target frame
@ param nSearchFlags
optional flags which regulate search for non special target frames
2001-05-02 11:58:40 +00:00
2002-05-23 11:54:59 +00:00
@ return A reference to found or may be new created frame .
@ threadsafe yes
2001-05-02 11:58:40 +00:00
*/ /*-*****************************************************************************************************/
2013-04-07 12:06:47 +02:00
css : : uno : : Reference < css : : frame : : XFrame > SAL_CALL Frame : : findFrame ( const OUString & sTargetFrameName ,
2014-02-25 21:31:58 +01:00
sal_Int32 nSearchFlags ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-05-02 11:58:40 +00:00
{
2002-05-23 11:54:59 +00:00
css : : uno : : Reference < css : : frame : : XFrame > xTarget ;
// 0) Ignore wrong parameter!
2013-12-20 11:25:37 +01:00
// We don't support search for following special targets.
2002-05-23 11:54:59 +00:00
// If we reject this requests - we mustnt check for such names
// in following code again and again. If we do not so -wrong
2013-09-26 11:44:54 +02:00
// search results can occur!
2014-02-22 21:20:15 +01:00
2002-05-23 11:54:59 +00:00
if (
( sTargetFrameName = = SPECIALTARGET_DEFAULT ) | | // valid for dispatches - not for findFrame()!
2011-12-21 18:03:42 -05:00
( sTargetFrameName = = SPECIALTARGET_MENUBAR ) // valid for dispatches - not for findFrame()!
2002-05-23 11:54:59 +00:00
)
{
return NULL ;
}
2001-05-02 11:58:40 +00:00
2002-05-23 11:54:59 +00:00
// I) check for special defined targets first which must be handled exclusive.
// force using of "if() else if() ..."
2014-02-22 21:20:15 +01:00
2013-12-20 11:25:37 +01:00
// get threadsafe some necessary member which are necessary for following functionality
2002-05-23 11:54:59 +00:00
/* SAFE { */
2014-03-20 09:30:14 +01:00
SolarMutexResettableGuard aReadLock ;
2007-07-24 10:52:47 +00:00
css : : uno : : Reference < css : : frame : : XFrame > xParent ( m_xParent , css : : uno : : UNO_QUERY ) ;
2013-05-21 17:38:02 +02:00
css : : uno : : Reference < css : : uno : : XComponentContext > xContext = m_xContext ;
2014-04-04 15:53:21 +02:00
bool bIsTopFrame = m_bIsFrameTop ;
bool bIsTopWindow = WindowHelper : : isTopWindow ( m_xContainerWindow ) ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2002-05-23 11:54:59 +00:00
/* } SAFE */
// I.I) "_blank"
// Not allowed for a normal frame - but for the desktop.
2014-04-26 19:28:59 +02:00
// Use helper class to do so. It use the desktop automatically.
2014-02-22 21:20:15 +01:00
2002-05-23 11:54:59 +00:00
if ( sTargetFrameName = = SPECIALTARGET_BLANK )
{
2013-05-21 17:38:02 +02:00
TaskCreator aCreator ( xContext ) ;
2014-04-04 15:53:21 +02:00
xTarget = aCreator . createTask ( sTargetFrameName , false ) ;
2002-05-23 11:54:59 +00:00
}
2001-05-02 11:58:40 +00:00
2002-05-23 11:54:59 +00:00
// 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.
2014-02-22 21:20:15 +01:00
2012-10-13 11:47:19 +01:00
else if ( sTargetFrameName = = SPECIALTARGET_PARENT )
2001-03-15 09:35:49 +00:00
{
2002-05-23 11:54:59 +00:00
xTarget = xParent ;
2001-03-15 09:35:49 +00:00
}
2000-10-23 12:56:44 +00:00
2002-05-23 11:54:59 +00:00
// 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.
2014-02-22 21:20:15 +01:00
2012-10-13 11:47:19 +01:00
else if ( sTargetFrameName = = SPECIALTARGET_TOP )
2002-05-23 11:54:59 +00:00
{
2007-07-24 10:52:47 +00:00
if ( bIsTopFrame )
2002-05-23 11:54:59 +00:00
xTarget = this ;
2012-10-13 11:47:19 +01:00
else if ( xParent . is ( ) ) // If we are not top - the parent MUST exist. But may it's better to check it again .-)
2002-05-23 11:54:59 +00:00
xTarget = xParent - > findFrame ( SPECIALTARGET_TOP , 0 ) ;
}
2001-05-02 11:58:40 +00:00
2002-05-23 11:54:59 +00:00
// I.IV) "_self", ""
// This mean this frame in every case.
2014-02-22 21:20:15 +01:00
2012-10-13 11:47:19 +01:00
else if (
2002-05-23 11:54:59 +00:00
( sTargetFrameName = = SPECIALTARGET_SELF ) | |
2011-12-26 14:20:50 -02:00
( sTargetFrameName . isEmpty ( ) )
2002-05-23 11:54:59 +00:00
)
{
xTarget = this ;
}
2001-05-02 11:58:40 +00:00
2002-05-23 11:54:59 +00:00
// I.V) "_beamer"
2013-02-22 09:32:10 +02:00
// This is a special sub frame of any task. We must return it if we found it on our direct children
2002-05-23 11:54:59 +00:00
// or create it there if it not already exists.
// Note: Such beamer exists for task(top) frames only!
2014-02-22 21:20:15 +01:00
2012-10-13 11:47:19 +01:00
else if ( sTargetFrameName = = SPECIALTARGET_BEAMER )
2000-10-23 12:56:44 +00:00
{
2002-05-23 11:54:59 +00:00
// We are a task => search or create the beamer
2007-07-24 10:52:47 +00:00
if ( bIsTopWindow )
2002-05-23 11:54:59 +00:00
{
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.
2012-10-13 11:47:19 +01:00
else if ( xParent . is ( ) )
2002-05-23 11:54:59 +00:00
xTarget = xParent - > findFrame ( SPECIALTARGET_BEAMER , 0 ) ;
}
else
{
2014-02-22 21:20:15 +01:00
2013-02-13 18:25:22 +04:00
// II) otherwise use optional given search flags
2002-05-23 11:54:59 +00:00
// 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.
2014-02-22 21:20:15 +01:00
2013-12-20 11:25:37 +01:00
// get threadsafe some necessary member which are necessary for following functionality
2002-05-23 11:54:59 +00:00
/* SAFE { */
2014-03-20 09:30:14 +01:00
aReadLock . reset ( ) ;
2013-04-07 12:06:47 +02:00
OUString sOwnName = m_sName ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2002-05-23 11:54:59 +00:00
/* } SAFE */
// II.I) SELF
2013-02-13 18:25:22 +04:00
// Check for right name. If it's the searched one return ourself - otherwise
2002-05-23 11:54:59 +00:00
// ignore this flag.
2014-02-22 21:20:15 +01:00
2002-05-23 11:54:59 +00:00
if (
( nSearchFlags & css : : frame : : FrameSearchFlag : : SELF ) & &
( sOwnName = = sTargetFrameName )
)
{
xTarget = this ;
}
// II.II) CHILDREN
// Search on all children for the given target name.
2013-09-26 11:44:54 +02:00
// An empty name value can't occur here - because it must be already handled as "_self"
2002-05-23 11:54:59 +00:00
// before. Used helper function of container doesn't create any frame.
// It makes a deep search only.
2014-02-22 21:20:15 +01:00
2002-05-23 11:54:59 +00:00
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.
2014-11-10 15:05:25 +01:00
// Upper search must stop at this frame if we are the topest one and the TASK flag is not set
2002-05-23 11:54:59 +00:00
// or we can ignore it if we have no valid parent.
2014-02-22 21:20:15 +01:00
2002-05-23 11:54:59 +00:00
if (
2007-07-24 10:52:47 +00:00
( bIsTopFrame & & ( nSearchFlags & css : : frame : : FrameSearchFlag : : TASKS ) ) | |
( ! bIsTopFrame )
2002-05-23 11:54:59 +00:00
)
{
2014-02-22 21:20:15 +01:00
2002-05-23 11:54:59 +00:00
// II.III.I) SIBLINGS
2013-02-22 09:32:10 +02:00
// Search on all our direct siblings - means all children of our parent.
2014-11-10 15:05:25 +01:00
// Use this flag in combination with TASK. We must suppress such upper search if
2002-05-23 11:54:59 +00:00
// 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.
2013-02-22 09:32:10 +02:00
// Because it's return all siblings and all her children including our children too
2013-12-20 11:25:37 +01:00
// if we call it with the CHILDREN flag. We don't need that - we need the direct container
2002-05-23 11:54:59 +00:00
// items of our parent only to start searches there. So we must use the container interface
// XIndexAccess instead of XFrames.
2014-02-22 21:20:15 +01:00
2002-05-23 11:54:59 +00:00
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 : : Reference < css : : frame : : XFrame > xSibling ;
if (
2009-09-08 04:57:32 +00:00
( ! ( xContainer - > getByIndex ( i ) > > = xSibling ) ) | | // control unpacking
2002-05-23 11:54:59 +00:00
( ! 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 ;
}
2013-11-23 21:48:00 +01:00
// Don't allow upper search here! Use right flags to regulate it.
2002-05-23 11:54:59 +00:00
// 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 ( ) )
2001-07-02 12:40:19 +00:00
break ;
2002-05-23 11:54:59 +00:00
}
}
}
}
// II.III.II) PARENT
// Forward search to our parent (if he exists.)
2013-09-26 11:44:54 +02:00
// To prevent us against recursive and superflous calls (which can occur if we allow him
2013-02-22 09:32:10 +02:00
// to search on his children too) we must change used search flags.
2014-02-22 21:20:15 +01:00
2002-05-23 11:54:59 +00:00
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
2014-04-26 19:28:59 +02:00
// a new one ... we should do that. Used TaskCreator use Desktop instance automatically as parent!
2014-02-22 21:20:15 +01:00
2002-05-23 11:54:59 +00:00
if (
( ! xTarget . is ( ) ) & &
( nSearchFlags & css : : frame : : FrameSearchFlag : : CREATE )
)
{
2013-05-21 17:38:02 +02:00
TaskCreator aCreator ( xContext ) ;
2014-04-04 15:53:21 +02:00
xTarget = aCreator . createTask ( sTargetFrameName , false ) ;
2002-05-23 11:54:59 +00:00
}
2000-10-23 12:56:44 +00:00
}
2002-05-23 11:54:59 +00:00
return xTarget ;
2000-10-23 12:56:44 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ descr Returns sal_True , if this frame is a " top frame " , otherwise sal_False .
The " m_bIsFrameTop " member must be set in the ctor or setCreator ( ) method .
A top frame is a member of the top frame container or a member of the
task frame container . Both containers can create new frames if the findFrame ( )
method of their css : : frame : : XFrame interface is called with a frame name not yet known .
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ seealso ctor
@ seealso method setCreator ( )
@ seealso method findFrame ( )
@ return true , if is it a top frame . . . false otherwise .
2013-09-26 11:44:54 +02:00
@ onerror No error should occur !
2001-05-02 11:58:40 +00:00
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
sal_Bool SAL_CALL Frame : : isTop ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Register transaction and reject wrong calls.
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
2000-09-18 15:33:13 +00:00
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2001-05-02 11:58:40 +00:00
// This information is set in setCreator().
2014-04-06 20:25:20 +03:00
// We are top, if our parent is a task or the desktop or if no parent exist!
2001-05-02 11:58:40 +00:00
return m_bIsFrameTop ;
}
2000-09-18 15:33:13 +00:00
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short activate frame in hierarchy
2012-02-01 14:42:58 +01:00
@ descr This feature is used to mark active paths in our frame hierarchy .
2001-05-02 11:58:40 +00:00
You can be a listener for this event to react for it . . . change some internal states or something else .
@ seealso method deactivate ( )
@ seealso method isActivate ( )
@ seealso enum EActiveState
@ seealso listener mechanism
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : activate ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-05-02 11:58:40 +00:00
{
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Register transaction and reject wrong calls.
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
2014-03-20 09:30:14 +01:00
SolarMutexResettableGuard aWriteLock ;
2001-05-02 11:58:40 +00:00
2013-03-03 17:11:39 +01:00
// Copy necessary member and free the lock.
// It's not necessary for m_aChildFrameContainer ... because
2001-05-02 11:58:40 +00:00
// he is threadsafe himself and live if we live.
// We use a registered transaction to prevent us against
// breaks during this operation!
2014-04-06 19:36:08 +03:00
css : : uno : : Reference < css : : frame : : XFrame > xActiveChild = m_aChildFrameContainer . getActive ( ) ;
css : : uno : : Reference < css : : frame : : XFramesSupplier > xParent ( m_xParent , css : : uno : : UNO_QUERY ) ;
2001-05-02 11:58:40 +00:00
css : : uno : : Reference < css : : frame : : XFrame > xThis ( static_cast < : : cppu : : OWeakObject * > ( this ) , css : : uno : : UNO_QUERY ) ;
2014-04-06 19:36:08 +03:00
css : : uno : : Reference < css : : awt : : XWindow > xComponentWindow ( m_xComponentWindow , css : : uno : : UNO_QUERY ) ;
EActiveState eState = m_eActiveState ;
2001-05-02 11:58:40 +00:00
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// 1) If I'am not active before ...
if ( eState = = E_INACTIVE )
2000-09-18 15:33:13 +00:00
{
// ... do it then.
2014-03-20 09:30:14 +01:00
aWriteLock . reset ( ) ;
2001-05-04 09:21:42 +00:00
eState = E_ACTIVE ;
m_eActiveState = eState ;
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2000-09-18 15:33:13 +00:00
// Deactivate sibling path and forward activation to parent ... if any parent exist!
2014-01-21 18:22:24 +01:00
if ( xParent . is ( ) )
2000-09-18 15:33:13 +00:00
{
2014-04-29 19:05:05 +00:00
// Every time set THIS frame as active child of parent and activate it.
2000-09-18 15:33:13 +00:00
// We MUST have a valid path from bottom to top as active path!
// But we must deactivate the old active sibling path first.
// Attention: Deactivation of an active path, deactivate the whole path ... from bottom to top!
// But we wish to deactivate founded sibling-tree only.
2013-04-15 04:49:39 +02:00
// [ see deactivate() / step 4) for further information! ]
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
xParent - > setActiveFrame ( xThis ) ;
2000-09-18 15:33:13 +00:00
// Then we can activate from here to top.
// Attention: We are ACTIVE now. And the parent will call activate() at us!
// But we do nothing then! We are already activated.
2001-05-02 11:58:40 +00:00
xParent - > activate ( ) ;
2000-09-18 15:33:13 +00:00
}
2013-03-03 17:11:39 +01:00
// Its necessary to send event NOW - not before.
2000-09-18 15:33:13 +00:00
// Activation goes from bottom to top!
// Thats the reason to activate parent first and send event now.
2001-05-02 11:58:40 +00:00
implts_sendFrameActionEvent ( css : : frame : : FrameAction_FRAME_ACTIVATED ) ;
2000-09-18 15:33:13 +00:00
}
2001-05-02 11:58:40 +00:00
// 2) I was active before or current activated and there is a path from here to bottom, who CAN be active.
2014-04-06 20:25:20 +03:00
// But our direct child of path is not active yet.
2001-05-02 11:58:40 +00:00
// (It can be, if activation occur in the middle of a current path!)
// In these case we activate path to bottom to set focus on right frame!
2014-01-21 18:22:24 +01:00
if ( eState = = E_ACTIVE & & xActiveChild . is ( ) & & ! xActiveChild - > isActive ( ) )
2000-09-18 15:33:13 +00:00
{
xActiveChild - > activate ( ) ;
}
2001-05-02 11:58:40 +00:00
// 3) I was active before or current activated. But if I have no active child => I will get the focus!
2014-01-21 18:22:24 +01:00
if ( eState = = E_ACTIVE & & ! xActiveChild . is ( ) )
2000-09-18 15:33:13 +00:00
{
2014-03-20 09:30:14 +01:00
aWriteLock . reset ( ) ;
2001-05-04 09:21:42 +00:00
eState = E_FOCUS ;
m_eActiveState = eState ;
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2001-05-02 11:58:40 +00:00
implts_sendFrameActionEvent ( css : : frame : : FrameAction_FRAME_UI_ACTIVATED ) ;
}
2000-09-18 15:33:13 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short deactivate frame in hierarchy
2012-02-01 14:42:58 +01:00
@ descr This feature is used to deactive paths in our frame hierarchy .
2001-05-02 11:58:40 +00:00
You can be a listener for this event to react for it . . . change some internal states or something else .
@ seealso method activate ( )
@ seealso method isActivate ( )
@ seealso enum EActiveState
@ seealso listener mechanism
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : deactivate ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Register transaction and reject wrong calls.
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
2014-03-20 09:30:14 +01:00
SolarMutexResettableGuard aWriteLock ;
2001-05-02 11:58:40 +00:00
2013-03-03 17:11:39 +01:00
// Copy necessary member and free the lock.
2014-04-06 19:36:08 +03:00
css : : uno : : Reference < css : : frame : : XFrame > xActiveChild = m_aChildFrameContainer . getActive ( ) ;
css : : uno : : Reference < css : : frame : : XFramesSupplier > xParent ( m_xParent , css : : uno : : UNO_QUERY ) ;
2001-05-02 11:58:40 +00:00
css : : uno : : Reference < css : : frame : : XFrame > xThis ( static_cast < : : cppu : : OWeakObject * > ( this ) , css : : uno : : UNO_QUERY ) ;
2014-04-06 19:36:08 +03:00
EActiveState eState = m_eActiveState ;
2001-05-02 11:58:40 +00:00
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
2000-09-18 15:33:13 +00:00
// Work only, if there something to do!
2001-05-02 11:58:40 +00:00
if ( eState ! = E_INACTIVE )
2000-09-18 15:33:13 +00:00
{
2014-02-22 21:20:15 +01:00
2011-12-07 02:33:51 -08:00
// 1) Deactivate all active children.
2014-01-21 18:22:24 +01:00
if ( xActiveChild . is ( ) & & xActiveChild - > isActive ( ) )
2000-09-18 15:33:13 +00:00
{
xActiveChild - > deactivate ( ) ;
}
2001-05-02 11:58:40 +00:00
// 2) If I have the focus - I will lost it now.
if ( eState = = E_FOCUS )
2000-09-18 15:33:13 +00:00
{
// Set new state INACTIVE(!) and send message to all listener.
// Don't set ACTIVE as new state. This frame is deactivated for next time - due to activate().
2014-03-20 09:30:14 +01:00
aWriteLock . reset ( ) ;
2001-05-02 11:58:40 +00:00
eState = E_ACTIVE ;
2014-04-06 19:36:08 +03:00
m_eActiveState = eState ;
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2001-05-02 11:58:40 +00:00
implts_sendFrameActionEvent ( css : : frame : : FrameAction_FRAME_UI_DEACTIVATING ) ;
2000-09-18 15:33:13 +00:00
}
2001-05-02 11:58:40 +00:00
// 3) If I'am active - I will be deactivated now.
if ( eState = = E_ACTIVE )
2000-09-18 15:33:13 +00:00
{
// Set new state and send message to all listener.
2014-03-20 09:30:14 +01:00
aWriteLock . reset ( ) ;
2001-05-02 11:58:40 +00:00
eState = E_INACTIVE ;
2014-04-06 19:36:08 +03:00
m_eActiveState = eState ;
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2001-05-02 11:58:40 +00:00
implts_sendFrameActionEvent ( css : : frame : : FrameAction_FRAME_DEACTIVATING ) ;
2000-09-18 15:33:13 +00:00
}
2001-05-02 11:58:40 +00:00
// 4) If there is a path from here to my parent ...
// ... I'am on the top or in the middle of deactivated subtree and action was started here.
// I must deactivate all frames from here to top, which are members of current path.
2014-04-06 20:25:20 +03:00
// Stop, if THESE frame not the active frame of our parent!
2014-01-21 18:22:24 +01:00
if ( xParent . is ( ) & & xParent - > getActiveFrame ( ) = = xThis )
2000-09-18 15:33:13 +00:00
{
2014-04-06 20:25:20 +03:00
// We MUST break the path - otherwise we will get the focus - not our parent! ...
// Attention: Our parent don't call us again - WE ARE NOT ACTIVE YET!
2000-09-18 15:33:13 +00:00
// [ see step 3 and condition "if ( m_eActiveState!=INACTIVE ) ..." in this method! ]
2001-05-02 11:58:40 +00:00
xParent - > deactivate ( ) ;
}
2000-09-18 15:33:13 +00:00
}
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short returns active state
2013-02-28 18:11:24 -04:00
@ descr Call it to get information about current active state of this frame .
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ seealso method activate ( )
@ seealso method deactivate ( )
@ seealso enum EActiveState
@ return true if active , false otherwise .
2000-09-18 15:33:13 +00:00
2013-09-26 11:44:54 +02:00
@ onerror No error should occur .
2001-05-02 11:58:40 +00:00
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
sal_Bool SAL_CALL Frame : : isActive ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-05-02 11:58:40 +00:00
{
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Register transaction and reject wrong calls.
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2001-05-02 11:58:40 +00:00
return (
( m_eActiveState = = E_ACTIVE ) | |
( m_eActiveState = = E_FOCUS )
) ;
2000-09-18 15:33:13 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short ? ? ?
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : contextChanged ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-05-02 11:58:40 +00:00
{
// Look for rejected calls!
// Sometimes called during closing object... => soft exceptions
TransactionGuard aTransaction ( m_aTransactionManager , E_SOFTEXCEPTIONS ) ;
// Impl-method is threadsafe himself!
// Send event to all listener for frame actions.
implts_sendFrameActionEvent ( css : : frame : : FrameAction_CONTEXT_CHANGED ) ;
}
2001-02-09 14:36:52 +00:00
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short set new component inside the frame
@ descr A frame is a container for a component . Use this method to set , change or realease it !
We accept null references ! The xComponentWindow will be a child of our container window
and get all window events from us .
2001-02-09 14:36:52 +00:00
2002-05-23 11:54:59 +00:00
@ 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 .
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ seealso method getComponentWindow ( )
@ seealso method getController ( )
2000-09-18 15:33:13 +00:00
2002-05-23 11:54:59 +00:00
@ 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 )
2000-09-18 15:33:13 +00:00
2002-05-23 11:54:59 +00:00
@ return < TRUE / > if operation was successful , < FALSE / > otherwise .
@ onerror We return < FALSE / > .
@ threadsafe yes
2001-05-02 11:58:40 +00:00
*/ /*-*****************************************************************************************************/
2002-05-23 11:54:59 +00:00
sal_Bool SAL_CALL Frame : : setComponent ( const css : : uno : : Reference < css : : awt : : XWindow > & xComponentWindow ,
2014-02-25 21:31:58 +01:00
const css : : uno : : Reference < css : : frame : : XController > & xController ) throw ( css : : uno : : RuntimeException , std : : exception )
2002-05-23 11:54:59 +00:00
{
2014-02-22 21:20:15 +01:00
2002-05-23 11:54:59 +00:00
// 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 ) ;
// Get threadsafe some copies of used members.
/* SAFE { */
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2002-05-23 11:54:59 +00:00
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 ;
2014-09-23 11:20:40 +02:00
vcl : : Window * pOwnWindow = VCLUnoHelper : : GetWindow ( xContainerWindow ) ;
2014-04-04 15:53:21 +02:00
bool bHadFocus = pOwnWindow - > HasChildPathFocus ( ) ;
bool bWasConnected = m_bConnected ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2002-05-23 11:54:59 +00:00
/* } 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 ) ;
2013-02-13 18:25:22 +04:00
// otherwise release old component first
2002-05-23 11:54:59 +00:00
// 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 )
)
{
2002-05-31 12:43:15 +00:00
/* ATTENTION
Don ' t suspend the old controller here . Because the outside caller must do that
by definition . We have to dispose it here only .
*/
2002-05-23 11:54:59 +00:00
// Before we dispose this controller we should hide it inside this frame instance.
// We hold it alive for next calls by using xOldController!
/* SAFE {*/
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aWriteLock ;
2002-05-23 11:54:59 +00:00
m_xController = NULL ;
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2002-05-23 11:54:59 +00:00
/* } SAFE */
css : : uno : : Reference < css : : lang : : XComponent > xDisposable ( xOldController , css : : uno : : UNO_QUERY ) ;
if ( xDisposable . is ( ) )
2004-06-10 12:22:23 +00:00
{
try
{
xDisposable - > dispose ( ) ;
}
catch ( const css : : lang : : DisposedException & )
{ }
}
2002-05-23 11:54:59 +00:00
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 )
)
{
/* SAFE { */
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aWriteLock ;
2002-05-23 11:54:59 +00:00
m_xComponentWindow = NULL ;
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2002-05-23 11:54:59 +00:00
/* } SAFE */
css : : uno : : Reference < css : : lang : : XComponent > xDisposable ( xOldComponentWindow , css : : uno : : UNO_QUERY ) ;
if ( xDisposable . is ( ) )
2004-06-10 12:22:23 +00:00
{
try
{
xDisposable - > dispose ( ) ;
}
catch ( const css : : lang : : DisposedException & )
2012-10-13 11:47:19 +01:00
{
}
2004-06-10 12:22:23 +00:00
}
2002-05-23 11:54:59 +00:00
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 { */
2014-03-20 09:30:14 +01:00
SolarMutexResettableGuard aWriteLock ;
2002-10-07 09:21:25 +00:00
m_xComponentWindow = xComponentWindow ;
2014-04-06 19:36:08 +03:00
m_xController = xController ;
2002-10-07 09:21:25 +00:00
m_bConnected = ( m_xComponentWindow . is ( ) | | m_xController . is ( ) ) ;
2014-04-04 15:53:21 +02:00
bool bIsConnected = m_bConnected ;
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2002-05-23 11:54:59 +00:00
/* } 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 ) ;
2012-10-13 11:47:19 +01:00
else if ( bIsConnected & & ! bWasConnected )
2002-05-23 11:54:59 +00:00
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!
2004-06-10 12:22:23 +00:00
if (
( bHadFocus ) & &
( xComponentWindow . is ( ) )
)
2002-05-23 11:54:59 +00:00
{
2004-06-10 12:22:23 +00:00
xComponentWindow - > setFocus ( ) ;
2002-05-23 11:54:59 +00:00
}
// 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 ( ) ;
2003-03-25 17:22:13 +00:00
/* SAFE { */
2014-03-20 09:30:14 +01:00
aWriteLock . reset ( ) ;
2004-02-25 16:48:50 +00:00
impl_checkMenuCloser ( ) ;
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2003-03-25 17:22:13 +00:00
/* } SAFE */
2002-05-23 11:54:59 +00:00
return sal_True ;
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2002-05-23 11:54:59 +00:00
@ short returns current set component window
@ descr Frames are used to display components . The actual displayed component is
held by the m_xComponentWindow property . If the component implements only a
XComponent interface , the communication between the frame and the
component is very restricted . Better integration is achievable through a
XController interface .
If the component wants other objects to be able to get information about its
ResourceDescriptor it has to implement a XModel interface .
This frame is the owner of the component window .
@ seealso method setComponent ( )
@ return css : : uno : : Reference to current set component window .
@ onerror A null reference is returned .
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
css : : uno : : Reference < css : : awt : : XWindow > SAL_CALL Frame : : getComponentWindow ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2002-05-23 11:54:59 +00:00
{
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Register transaction and reject wrong calls.
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2002-05-23 11:54:59 +00:00
return m_xComponentWindow ;
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2002-05-23 11:54:59 +00:00
@ short returns current set controller
@ descr Frames are used to display components . The actual displayed component is
held by the m_xComponentWindow property . If the component implements only a
XComponent interface , the communication between the frame and the
component is very restricted . Better integration is achievable through a
XController interface .
If the component wants other objects to be able to get information about its
ResourceDescriptor it has to implement a XModel interface .
This frame is the owner of the component window .
@ seealso method setComponent ( )
@ return css : : uno : : Reference to current set controller .
@ onerror A null reference is returned .
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
css : : uno : : Reference < css : : frame : : XController > SAL_CALL Frame : : getController ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2002-05-23 11:54:59 +00:00
{
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2002-05-23 11:54:59 +00:00
return m_xController ;
}
2000-09-18 15:33:13 +00:00
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short add / remove listener for activate / deactivate / contextChanged events
@ seealso method activate ( )
@ seealso method deactivate ( )
@ seealso method contextChanged ( )
@ param " xListener " reference to your listener object
@ onerror Listener is ignored .
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : addFrameActionListener ( const css : : uno : : Reference < css : : frame : : XFrameActionListener > & xListener ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Check incoming parameter.
2013-09-08 23:00:27 +03:00
SAL_WARN_IF ( implcp_addFrameActionListener ( xListener ) , " fwk " , " Frame::addFrameActionListener(): Invalid parameter detected. " ) ;
2001-05-02 11:58:40 +00:00
// Listener container is threadsafe by himself ... but we must look for rejected calls!
// Our OMenuDispatch-helper (is a member of ODispatchProvider!) is create at startup of this frame BEFORE initialize!
// => soft exceptions!
TransactionGuard aTransaction ( m_aTransactionManager , E_SOFTEXCEPTIONS ) ;
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
2014-05-23 22:11:27 +02:00
m_aListenerContainer . addInterface ( cppu : : UnoType < css : : frame : : XFrameActionListener > : : get ( ) , xListener ) ;
2000-09-18 15:33:13 +00:00
}
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : removeFrameActionListener ( const css : : uno : : Reference < css : : frame : : XFrameActionListener > & xListener ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Check incoming parameter.
2013-09-08 23:00:27 +03:00
SAL_WARN_IF ( implcp_removeFrameActionListener ( xListener ) , " fwk " , " Frame::removeFrameActionListener(): Invalid parameter detected. " ) ;
2001-05-02 11:58:40 +00:00
// Listener container is threadsafe by himself ... but we must look for rejected calls after disposing!
// But we must work with E_SOFTEXCEPTIONS ... because sometimes we are called from our listeners
// during dispose! Our work mode is E_BEFORECLOSE then ... and E_HARDEXCEPTIONS whould throw a DisposedException.
TransactionGuard aTransaction ( m_aTransactionManager , E_SOFTEXCEPTIONS ) ;
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
2014-05-23 22:11:27 +02:00
m_aListenerContainer . removeInterface ( cppu : : UnoType < css : : frame : : XFrameActionListener > : : get ( ) , xListener ) ;
2000-09-18 15:33:13 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2002-05-23 11:54:59 +00:00
@ 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
2013-03-25 23:03:49 +02:00
< var > bDeliverOwnership < / var > regulate which will be the new owner of this instance .
2002-05-23 11:54:59 +00:00
@ attention It ' s the replacement for XTask : : close ( ) which is marked as obsolete method .
2013-03-25 23:03:49 +02:00
@ param bDeliverOwnership
2002-05-23 11:54:59 +00:00
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 .
2013-06-01 14:08:37 +02:00
@ throws CloseVetoException
2002-05-23 11:54:59 +00:00
if any internal things willn ' t be closed
@ threadsafe yes
*/ /*-*****************************************************************************************************/
2013-03-25 23:03:49 +02:00
void SAL_CALL Frame : : close ( sal_Bool bDeliverOwnership ) throw ( css : : util : : CloseVetoException ,
2014-02-25 21:31:58 +01:00
css : : uno : : RuntimeException , std : : exception )
2002-05-23 11:54:59 +00:00
{
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.
2002-05-28 11:57:57 +00:00
css : : lang : : EventObject aSource ( static_cast < : : cppu : : OWeakObject * > ( this ) ) ;
2014-05-23 22:11:27 +02:00
: : cppu : : OInterfaceContainerHelper * pContainer = m_aListenerContainer . getContainer ( cppu : : UnoType < css : : util : : XCloseListener > : : get ( ) ) ;
2002-05-23 11:54:59 +00:00
if ( pContainer ! = NULL )
{
: : cppu : : OInterfaceIteratorHelper pIterator ( * pContainer ) ;
while ( pIterator . hasMoreElements ( ) )
2002-05-24 10:33:59 +00:00
{
try
{
2014-09-29 13:55:54 +02:00
static_cast < css : : util : : XCloseListener * > ( pIterator . next ( ) ) - > queryClosing ( aSource , bDeliverOwnership ) ;
2002-05-24 10:33:59 +00:00
}
2011-12-14 00:03:52 +09:00
catch ( const css : : uno : : RuntimeException & )
2002-05-24 10:33:59 +00:00
{
pIterator . remove ( ) ;
}
}
2002-05-23 11:54:59 +00:00
}
// Ok - no listener disagreed with this close() request
// check if this frame is used for any load process currently
2002-10-24 11:25:54 +00:00
if ( isActionLocked ( ) )
2002-05-23 11:54:59 +00:00
{
2013-03-25 23:03:49 +02:00
if ( bDeliverOwnership )
2002-05-31 12:43:15 +00:00
{
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2014-04-04 15:53:21 +02:00
m_bSelfClose = true ;
2002-05-31 12:43:15 +00:00
}
2002-05-23 11:54:59 +00:00
2013-09-09 00:58:15 +03:00
throw css : : util : : CloseVetoException ( " Frame in use for loading document ... " , static_cast < : : cppu : : OWeakObject * > ( this ) ) ;
2002-05-23 11:54:59 +00:00
}
2002-10-24 11:25:54 +00:00
if ( ! setComponent ( NULL , NULL ) )
2013-09-09 00:58:15 +03:00
throw css : : util : : CloseVetoException ( " Component couldn't be deattached ... " , static_cast < : : cppu : : OWeakObject * > ( this ) ) ;
2002-10-24 11:25:54 +00:00
2002-05-23 11:54:59 +00:00
// If closing is allowed ... inform all istener and dispose this frame!
2014-05-23 22:11:27 +02:00
pContainer = m_aListenerContainer . getContainer ( cppu : : UnoType < css : : util : : XCloseListener > : : get ( ) ) ;
2002-05-23 11:54:59 +00:00
if ( pContainer ! = NULL )
{
: : cppu : : OInterfaceIteratorHelper pIterator ( * pContainer ) ;
while ( pIterator . hasMoreElements ( ) )
2002-05-24 10:33:59 +00:00
{
try
{
2014-09-29 13:55:54 +02:00
static_cast < css : : util : : XCloseListener * > ( pIterator . next ( ) ) - > notifyClosing ( aSource ) ;
2002-05-24 10:33:59 +00:00
}
2011-12-14 00:03:52 +09:00
catch ( const css : : uno : : RuntimeException & )
2002-05-24 10:33:59 +00:00
{
pIterator . remove ( ) ;
}
}
2002-05-23 11:54:59 +00:00
}
2003-03-25 17:22:13 +00:00
/* SAFE { */
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aWriteLock ;
2014-04-04 15:53:21 +02:00
m_bIsHidden = true ;
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2003-03-25 17:22:13 +00:00
/* } SAFE */
impl_checkMenuCloser ( ) ;
2002-05-23 11:54:59 +00:00
// Attention: We must release our own registered transaction here. Otherwhise following dispose() call
// wait for us too ....
aTransaction . stop ( ) ;
dispose ( ) ;
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2002-05-23 11:54:59 +00:00
@ 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
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : addCloseListener ( const css : : uno : : Reference < css : : util : : XCloseListener > & xListener ) throw ( css : : uno : : RuntimeException , std : : exception )
2002-05-23 11:54:59 +00:00
{
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
2013-12-20 11:25:37 +01:00
// We don't need any lock here ...
2002-05-23 11:54:59 +00:00
// Container lives if we live and is threadsafe by himself.
2014-05-23 22:11:27 +02:00
m_aListenerContainer . addInterface ( cppu : : UnoType < css : : util : : XCloseListener > : : get ( ) , xListener ) ;
2002-05-23 11:54:59 +00:00
}
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : removeCloseListener ( const css : : uno : : Reference < css : : util : : XCloseListener > & xListener ) throw ( css : : uno : : RuntimeException , std : : exception )
2002-05-23 11:54:59 +00:00
{
// Use soft exception mode - moslty this method is called during disposing of this frame ...
TransactionGuard aTransaction ( m_aTransactionManager , E_SOFTEXCEPTIONS ) ;
2013-12-20 11:25:37 +01:00
// We don't need any lock here ...
2002-05-23 11:54:59 +00:00
// Container lives if we live and is threadsafe by himself.
2014-05-23 22:11:27 +02:00
m_aListenerContainer . removeInterface ( cppu : : UnoType < css : : util : : XCloseListener > : : get ( ) , xListener ) ;
2002-05-23 11:54:59 +00:00
}
2013-04-07 12:06:47 +02:00
OUString SAL_CALL Frame : : getTitle ( )
2014-02-25 21:31:58 +01:00
throw ( css : : uno : : RuntimeException , std : : exception )
2008-04-04 13:12:20 +00:00
{
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
// SAFE ->
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2008-04-04 13:12:20 +00:00
css : : uno : : Reference < css : : frame : : XTitle > xTitle ( m_xTitleHelper , css : : uno : : UNO_QUERY_THROW ) ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2008-04-04 13:12:20 +00:00
// <- SAFE
return xTitle - > getTitle ( ) ;
}
2013-04-07 12:06:47 +02:00
void SAL_CALL Frame : : setTitle ( const OUString & sTitle )
2014-02-25 21:31:58 +01:00
throw ( css : : uno : : RuntimeException , std : : exception )
2008-04-04 13:12:20 +00:00
{
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
// SAFE ->
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2008-04-04 13:12:20 +00:00
css : : uno : : Reference < css : : frame : : XTitle > xTitle ( m_xTitleHelper , css : : uno : : UNO_QUERY_THROW ) ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2008-04-04 13:12:20 +00:00
// <- SAFE
xTitle - > setTitle ( sTitle ) ;
}
void SAL_CALL Frame : : addTitleChangeListener ( const css : : uno : : Reference < css : : frame : : XTitleChangeListener > & xListener )
2014-02-25 21:31:58 +01:00
throw ( css : : uno : : RuntimeException , std : : exception )
2008-04-04 13:12:20 +00:00
{
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
// SAFE ->
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2008-04-04 13:12:20 +00:00
css : : uno : : Reference < css : : frame : : XTitleChangeBroadcaster > xTitle ( m_xTitleHelper , css : : uno : : UNO_QUERY_THROW ) ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2008-04-04 13:12:20 +00:00
// <- SAFE
xTitle - > addTitleChangeListener ( xListener ) ;
}
void SAL_CALL Frame : : removeTitleChangeListener ( const css : : uno : : Reference < css : : frame : : XTitleChangeListener > & xListener )
2014-02-25 21:31:58 +01:00
throw ( css : : uno : : RuntimeException , std : : exception )
2008-04-04 13:12:20 +00:00
{
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
// SAFE ->
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2008-04-04 13:12:20 +00:00
css : : uno : : Reference < css : : frame : : XTitleChangeBroadcaster > xTitle ( m_xTitleHelper , css : : uno : : UNO_QUERY_THROW ) ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2008-04-04 13:12:20 +00:00
// <- SAFE
xTitle - > removeTitleChangeListener ( xListener ) ;
}
2014-02-25 21:31:58 +01:00
css : : uno : : Reference < css : : container : : XNameContainer > SAL_CALL Frame : : getUserDefinedAttributes ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2013-03-22 09:24:15 +02:00
{
// optional attribute
return 0 ;
}
2014-02-25 21:31:58 +01:00
css : : uno : : Reference < css : : frame : : XDispatchRecorderSupplier > SAL_CALL Frame : : getDispatchRecorderSupplier ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2013-03-22 09:24:15 +02:00
{
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2013-03-22 09:24:15 +02:00
return m_xDispatchRecorderSupplier ;
}
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : setDispatchRecorderSupplier ( const css : : uno : : Reference < css : : frame : : XDispatchRecorderSupplier > & p ) throw ( css : : uno : : RuntimeException , std : : exception )
2013-03-22 09:24:15 +02:00
{
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
m_xDispatchRecorderSupplier . set ( p ) ;
2013-03-22 09:24:15 +02:00
}
2014-02-25 21:31:58 +01:00
css : : uno : : Reference < css : : uno : : XInterface > SAL_CALL Frame : : getLayoutManager ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2013-03-22 09:24:15 +02:00
{
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2013-03-22 09:24:15 +02:00
return m_xLayoutManager ;
}
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : setLayoutManager ( const css : : uno : : Reference < css : : uno : : XInterface > & p1 ) throw ( css : : uno : : RuntimeException , std : : exception )
2013-03-22 09:24:15 +02:00
{
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
m_xLayoutManager . set ( p1 , css : : uno : : UNO_QUERY ) ;
2013-03-22 09:24:15 +02:00
}
2007-04-16 15:43:56 +00:00
/*-****************************************************************************************************/
void Frame : : implts_forgetSubFrames ( )
{
// SAFE ->
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2007-04-16 15:43:56 +00:00
css : : uno : : Reference < css : : container : : XIndexAccess > xContainer ( m_xFramesHelper , css : : uno : : UNO_QUERY_THROW ) ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2007-04-16 15:43:56 +00:00
// <- SAFE
sal_Int32 c = xContainer - > getCount ( ) ;
sal_Int32 i = 0 ;
for ( i = 0 ; i < c ; + + i )
{
try
{
css : : uno : : Reference < css : : frame : : XFrame > xFrame ;
xContainer - > getByIndex ( i ) > > = xFrame ;
if ( xFrame . is ( ) )
xFrame - > setCreator ( css : : uno : : Reference < css : : frame : : XFramesSupplier > ( ) ) ;
}
catch ( const css : : uno : : Exception & )
{
// Ignore errors here.
// Nobody can guarantee a stable index in multi threaded environments .-)
}
}
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2007-04-16 15:43:56 +00:00
m_xFramesHelper . clear ( ) ; // clear uno reference
m_aChildFrameContainer . clear ( ) ; // clear container content
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ 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
as an EventListener are forced to release their references to this object .
Furthermore this frame is removed from its parent frame container to release
this reference . The reference attributes are disposed and released also .
@ attention Look for globale description at beginning of file too !
( DisposedException , FairRWLock . . . , initialize , dispose )
@ seealso method initialize ( )
@ seealso baseclass FairRWLockBase !
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : dispose ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2001-06-19 09:37:05 +00:00
// 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 ...
css : : uno : : Reference < css : : frame : : XFrame > xThis ( static_cast < : : cppu : : OWeakObject * > ( this ) , css : : uno : : UNO_QUERY ) ;
2013-09-08 23:41:20 +03:00
SAL_INFO ( " fwk.frame " , " [Frame] " < < m_sName < < " send dispose event to listener " ) ;
2004-07-23 10:08:41 +00:00
2001-06-19 09:37:05 +00:00
// First operation should be ... "stopp all listening for window events on our container window".
2001-07-18 05:22:42 +00:00
// These events are superflous but can make trouble!
// We will die, die and die ...
2001-06-19 09:37:05 +00:00
implts_stopWindowListening ( ) ;
2001-06-22 09:39:28 +00:00
2011-05-10 22:23:54 +01:00
if ( m_xLayoutManager . is ( ) )
lcl_disableLayoutManager ( m_xLayoutManager , this ) ;
2011-02-02 13:12:46 +00:00
delete m_pWindowCommandDispatch ;
2001-07-18 05:22:42 +00:00
// Send message to all listener and forget her references.
css : : lang : : EventObject aEvent ( xThis ) ;
m_aListenerContainer . disposeAndClear ( aEvent ) ;
2005-07-12 13:15:16 +00:00
// set "end of live" for our property set helper
impl_disablePropertySet ( ) ;
2006-05-08 13:44:09 +00:00
// interception/dispatch chain must be destructed explicitly
// Otherwhise some dispatches and/or interception objects wont die.
css : : uno : : Reference < css : : lang : : XEventListener > xDispatchHelper ( m_xDispatchHelper , css : : uno : : UNO_QUERY_THROW ) ;
xDispatchHelper - > disposing ( aEvent ) ;
xDispatchHelper . clear ( ) ;
2001-05-02 11:58:40 +00:00
// Disable this instance for further work.
// This will wait for all current running ones ...
// and reject all further requests!
m_aTransactionManager . setWorkingMode ( E_BEFORECLOSE ) ;
2002-05-23 11:54:59 +00:00
// Don't show any dialogs, errors or something else any more!
2014-09-10 22:35:39 +02:00
// If somewhere called dispose() whitout close() before - normally no dialogs
2002-05-23 11:54:59 +00:00
// should exist. Otherwhise it's the problem of the outside caller.
// Note:
// (a) Do it after stopWindowListening(). May that force some active/deactive
2013-12-20 11:25:37 +01:00
// notifications which we don't need here really.
2003-06-27 08:09:04 +00:00
// (b) Don't forget to save the old value of IsDialogCancelEnabled() to
2011-12-06 20:27:29 +01:00
// restore it afterwards (to not kill headless mode).
Application : : DialogCancelMode old = Application : : GetDialogCancelMode ( ) ;
Application : : SetDialogCancelMode ( Application : : DIALOG_CANCEL_SILENT ) ;
2002-05-23 11:54:59 +00:00
2001-06-19 09:37:05 +00:00
// We should be alone for ever and further dispose calls are rejected by lines before ...
2001-05-02 11:58:40 +00:00
// I hope it :-)
2002-05-23 11:54:59 +00:00
2004-07-23 10:08:41 +00:00
// Free references of our frame tree.
// Force parent container to forget this frame too ...
// ( It's contained in m_xParent and so no css::lang::XEventListener for m_xParent! )
// It's important to do that before we free some other internal structures.
// Because if our parent gets an activate and found us as last possible active frame
// he try to deactivate us ... and we run into some trouble (DisposedExceptions!).
2014-01-21 18:22:24 +01:00
if ( m_xParent . is ( ) )
2004-07-23 10:08:41 +00:00
{
m_xParent - > getFrames ( ) - > remove ( xThis ) ;
m_xParent = css : : uno : : Reference < css : : frame : : XFramesSupplier > ( ) ;
}
/* } SAFE */
2002-05-23 11:54:59 +00:00
// 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!
2014-04-09 13:08:50 +02:00
// But try to dispose the controller first before you destroy the window.
2002-05-23 11:54:59 +00:00
// Because the window is used by the controller too ...
if ( m_xController . is ( ) )
{
css : : uno : : Reference < css : : lang : : XComponent > xDisposable ( m_xController , css : : uno : : UNO_QUERY ) ;
if ( xDisposable . is ( ) )
xDisposable - > dispose ( ) ;
}
if ( m_xComponentWindow . is ( ) )
{
css : : uno : : Reference < css : : lang : : XComponent > xDisposable ( m_xComponentWindow , css : : uno : : UNO_QUERY ) ;
if ( xDisposable . is ( ) )
xDisposable - > dispose ( ) ;
}
2001-05-02 11:58:40 +00:00
2004-07-23 10:08:41 +00:00
impl_checkMenuCloser ( ) ;
2002-05-15 11:13:38 +00:00
2001-06-11 11:52:42 +00:00
impl_disposeContainerWindow ( m_xContainerWindow ) ;
2001-05-04 09:21:42 +00:00
/*ATTENTION
Clear container after successful removing from parent container . . .
2002-05-23 11:54:59 +00:00
because our parent could be the desktop which stand in dispose too !
2001-05-04 09:21:42 +00:00
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 !
" m_xParent->getFrames()->remove( xThis ); " needs this helper . . .
2013-04-15 05:39:31 +02:00
Otherwise we get a null reference and could finish removing successfully .
2001-05-04 09:21:42 +00:00
= > You see : Order of calling operations is important ! ! !
*/
2007-04-16 15:43:56 +00:00
implts_forgetSubFrames ( ) ;
2001-05-02 11:58:40 +00:00
// Release some other references.
2001-05-04 09:21:42 +00:00
// This calls should be easy ... I hope it :-)
2006-05-08 13:44:09 +00:00
m_xDispatchHelper . clear ( ) ;
2013-05-21 17:38:02 +02:00
m_xContext . clear ( ) ;
2006-05-08 13:44:09 +00:00
m_xDropTargetListener . clear ( ) ;
m_xDispatchRecorderSupplier . clear ( ) ;
m_xLayoutManager . clear ( ) ;
m_xIndicatorFactoryHelper . clear ( ) ;
2001-05-02 11:58:40 +00:00
2003-03-25 17:22:13 +00:00
// It's important to set default values here!
// If may be later somewhere change the disposed-behaviour of this implementation
// and doesn't throw any DisposedExceptions we must guarantee best matching default values ...
m_eActiveState = E_INACTIVE ;
2014-11-12 14:24:10 +05:30
m_sName . clear ( ) ;
2014-04-04 15:53:21 +02:00
m_bIsFrameTop = false ;
m_bConnected = false ;
2003-03-25 17:22:13 +00:00
m_nExternalLockCount = 0 ;
2014-04-04 15:53:21 +02:00
m_bSelfClose = false ;
m_bIsHidden = true ;
2003-03-25 17:22:13 +00:00
2013-12-20 11:25:37 +01:00
// Disable this instance for further working really!
2001-05-02 11:58:40 +00:00
m_aTransactionManager . setWorkingMode ( E_CLOSE ) ;
2001-12-12 12:16:39 +00:00
2003-06-27 08:09:04 +00:00
// Don't forget it restore old value -
2013-02-13 18:25:22 +04:00
// otherwise no dialogs can be shown anymore in other frames.
2011-12-06 20:27:29 +01:00
Application : : SetDialogCancelMode ( old ) ;
2000-09-18 15:33:13 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short Be a listener for dispose events !
@ descr Adds / remove an EventListener to this object . If the dispose method is called on
this object , the disposing method of the listener is called .
@ param " xListener " reference to your listener object .
@ onerror Listener is ignored .
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : addEventListener ( const css : : uno : : Reference < css : : lang : : XEventListener > & xListener ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Check incoming parameter.
2013-09-08 23:00:27 +03:00
SAL_WARN_IF ( implcp_addEventListener ( xListener ) , " fwk " , " Frame::addEventListener(): Invalid parameter detected. " ) ;
2001-05-02 11:58:40 +00:00
// Look for rejected calls only!
// Container is threadsafe.
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
2001-02-14 07:26:40 +00:00
2001-05-02 11:58:40 +00:00
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
2014-05-15 22:51:43 +02:00
m_aListenerContainer . addInterface ( cppu : : UnoType < css : : lang : : XEventListener > : : get ( ) , xListener ) ;
2001-05-02 11:58:40 +00:00
}
2000-09-18 15:33:13 +00:00
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : removeEventListener ( const css : : uno : : Reference < css : : lang : : XEventListener > & xListener ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-05-02 11:58:40 +00:00
{
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Check incoming parameter.
2013-09-08 23:00:27 +03:00
SAL_WARN_IF ( implcp_removeEventListener ( xListener ) , " fwk " , " Frame::removeEventListener(): Invalid parameter detected. " ) ;
2001-05-02 11:58:40 +00:00
// Look for rejected calls only!
// Container is threadsafe.
// Use E_SOFTEXCEPTIONS to allow removing listeners during dispose call!
TransactionGuard aTransaction ( m_aTransactionManager , E_SOFTEXCEPTIONS ) ;
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
2014-05-15 22:51:43 +02:00
m_aListenerContainer . removeInterface ( cppu : : UnoType < css : : lang : : XEventListener > : : get ( ) , xListener ) ;
2001-05-02 11:58:40 +00:00
}
2001-02-09 14:36:52 +00:00
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short create new status indicator
2013-04-15 04:49:39 +02:00
@ descr Use returned status indicator to show progresses and some text information .
2001-05-02 11:58:40 +00:00
All created objects share the same dialog ! Only the last one can show his information .
2001-02-09 14:36:52 +00:00
2001-08-10 10:54:29 +00:00
@ seealso class StatusIndicatorFactory
@ seealso class StatusIndicator
2001-05-02 11:58:40 +00:00
@ return A reference to created object .
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ onerror We return a null reference .
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
css : : uno : : Reference < css : : task : : XStatusIndicator > SAL_CALL Frame : : createStatusIndicator ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-05-02 11:58:40 +00:00
{
/* UNSAFE AREA ----------------------------------------------------------------------------------------- */
// Look for rejected calls!
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2001-02-09 14:36:52 +00:00
2013-03-03 17:11:39 +01:00
// Make snapshot of necessary member and define default return value.
2004-11-26 13:33:19 +00:00
css : : uno : : Reference < css : : task : : XStatusIndicator > xExternal ( m_xIndicatorInterception . get ( ) , css : : uno : : UNO_QUERY ) ;
css : : uno : : Reference < css : : task : : XStatusIndicatorFactory > xFactory = m_xIndicatorFactoryHelper ;
2001-04-02 13:11:42 +00:00
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA ----------------------------------------------------------------------------------------- */
2001-08-10 10:54:29 +00:00
2004-11-26 13:33:19 +00:00
// Was set from outside to intercept any progress activities!
if ( xExternal . is ( ) )
return xExternal ;
// Or use our own factory as fallback, to create such progress.
if ( xFactory . is ( ) )
return xFactory - > createStatusIndicator ( ) ;
2001-08-10 10:54:29 +00:00
2004-11-26 13:33:19 +00:00
return css : : uno : : Reference < css : : task : : XStatusIndicator > ( ) ;
2001-05-02 11:58:40 +00:00
}
2001-02-09 14:36:52 +00:00
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short search for target to load URL
@ descr This method searches for a dispatch for the specified DispatchDescriptor .
The FrameSearchFlags and the FrameName of the DispatchDescriptor are
treated as described for findFrame .
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ seealso method findFrame ( )
@ seealso method queryDispatches ( )
@ seealso method set / getName ( )
@ seealso class TargetFinder
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ param " aURL " , URL for loading
@ param " sTargetFrameName " , name of target frame
2014-11-10 15:05:25 +01:00
@ param " nSearchFlags " , additional flags to regulate search if sTargetFrameName is not clear
2001-05-02 11:58:40 +00:00
@ return css : : uno : : Reference to dispatch handler .
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ onerror A null reference is returned .
*/ /*-*****************************************************************************************************/
css : : uno : : Reference < css : : frame : : XDispatch > SAL_CALL Frame : : queryDispatch ( const css : : util : : URL & aURL ,
2013-04-07 12:06:47 +02:00
const OUString & sTargetFrameName ,
2014-02-25 21:31:58 +01:00
sal_Int32 nSearchFlags ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-05-02 11:58:40 +00:00
{
2014-11-10 15:05:25 +01:00
// Don't check incoming parameter here! Our helper do it for us and it is not a good idea to do it more than ones!
2001-05-02 11:58:40 +00:00
// But look for rejected calls!
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
2000-09-18 15:33:13 +00:00
2002-04-22 06:18:26 +00:00
// Remove uno and cmd protocol part as we want to support both of them. We store only the command part
// in our hash map. All other protocols are stored with the protocol part.
2013-09-16 09:58:03 +02:00
OUString aCommand ( aURL . Main ) ;
2014-12-12 17:52:18 +01:00
if ( aURL . Protocol . equalsIgnoreAsciiCase ( " .uno: " ) )
2002-04-22 06:18:26 +00:00
aCommand = aURL . Path ;
2015-01-01 19:58:59 +00:00
// Make std::unordered_map lookup if the current URL is in the disabled list
2002-04-22 06:18:26 +00:00
if ( m_aCommandOptions . Lookup ( SvtCommandOptions : : CMDOPTION_DISABLED , aCommand ) )
return css : : uno : : Reference < css : : frame : : XDispatch > ( ) ;
else
{
// We use a helper to support these interface and an interceptor mechanism.
// Our helper is threadsafe by himself!
return m_xDispatchHelper - > queryDispatch ( aURL , sTargetFrameName , nSearchFlags ) ;
}
2000-09-18 15:33:13 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2014-08-01 16:56:25 +09:00
@ short handle more than ones dispatches at same call
2001-05-02 11:58:40 +00:00
@ descr Returns a sequence of dispatches . For details see the queryDispatch method .
For failed dispatches we return empty items in list !
@ seealso method queryDispatch ( )
@ param " lDescriptor " list of dispatch arguments for queryDispatch ( ) !
@ return List of dispatch references . Some elements can be NULL !
@ onerror An empty list is returned .
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
css : : uno : : Sequence < css : : uno : : Reference < css : : frame : : XDispatch > > SAL_CALL Frame : : queryDispatches ( const css : : uno : : Sequence < css : : frame : : DispatchDescriptor > & lDescriptor ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2014-11-10 15:05:25 +01:00
// Don't check incoming parameter here! Our helper do it for us and it is not a good idea to do it more than ones!
2001-05-02 11:58:40 +00:00
// But look for rejected calls!
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
// We use a helper to support these interface and an interceptor mechanism.
// Our helper is threadsafe by himself!
return m_xDispatchHelper - > queryDispatches ( lDescriptor ) ;
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short register / unregister interceptor for dispatch calls
2013-09-26 11:44:54 +02:00
@ descr If you wish to handle some dispatches by himself . . . you should be
2013-04-15 04:49:39 +02:00
an interceptor for it . Please see class OInterceptionHelper for further information .
2001-05-02 11:58:40 +00:00
@ seealso class OInterceptionHelper
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
@ param " xInterceptor " , reference to your interceptor implementation .
@ onerror Interceptor is ignored .
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : registerDispatchProviderInterceptor ( const css : : uno : : Reference < css : : frame : : XDispatchProviderInterceptor > & xInterceptor ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-05-02 11:58:40 +00:00
{
// We use a helper to support these interface and an interceptor mechanism.
// This helper is threadsafe himself and check incoming parameter too.
// I think we don't need any lock here!
// But we must look for rejected calls.
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
css : : uno : : Reference < css : : frame : : XDispatchProviderInterception > xInterceptionHelper ( m_xDispatchHelper , css : : uno : : UNO_QUERY ) ;
xInterceptionHelper - > registerDispatchProviderInterceptor ( xInterceptor ) ;
2000-09-18 15:33:13 +00:00
}
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : releaseDispatchProviderInterceptor ( const css : : uno : : Reference < css : : frame : : XDispatchProviderInterceptor > & xInterceptor ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
// We use a helper to support these interface and an interceptor mechanism.
// This helper is threadsafe himself and check incoming parameter too.
// I think we don't need any lock here!
// But we must look for rejected calls ...
// Sometimes we are called during our dispose() method ... => soft exceptions!
TransactionGuard aTransaction ( m_aTransactionManager , E_SOFTEXCEPTIONS ) ;
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
css : : uno : : Reference < css : : frame : : XDispatchProviderInterception > xInterceptionHelper ( m_xDispatchHelper , css : : uno : : UNO_QUERY ) ;
xInterceptionHelper - > releaseDispatchProviderInterceptor ( xInterceptor ) ;
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2004-11-16 13:54:13 +00:00
@ short provides information about all possible dispatch functions
inside the currnt frame environment
*/ /*-*****************************************************************************************************/
css : : uno : : Sequence < sal_Int16 > SAL_CALL Frame : : getSupportedCommandGroups ( )
2014-02-25 21:31:58 +01:00
throw ( css : : uno : : RuntimeException , std : : exception )
2004-11-16 13:54:13 +00:00
{
return m_xDispatchInfoHelper - > getSupportedCommandGroups ( ) ;
}
css : : uno : : Sequence < css : : frame : : DispatchInformation > SAL_CALL Frame : : getConfigurableDispatchInformation ( sal_Int16 nCommandGroup )
2014-02-25 21:31:58 +01:00
throw ( css : : uno : : RuntimeException , std : : exception )
2004-11-16 13:54:13 +00:00
{
return m_xDispatchInfoHelper - > getConfigurableDispatchInformation ( nCommandGroup ) ;
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short notifications for window events
@ descr We are a listener on our container window to forward it to our component window .
@ seealso method setComponent ( )
@ seealso member m_xContainerWindow
@ seealso member m_xComponentWindow
@ param " aEvent " describe source of detected event
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : windowResized ( const css : : awt : : WindowEvent & aEvent ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-05-02 11:58:40 +00:00
{
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Check incoming parameter.
2013-09-09 22:24:49 +03:00
( void ) aEvent ;
2013-09-08 23:00:27 +03:00
SAL_WARN_IF ( implcp_windowResized ( aEvent ) , " fwk " , " Frame::windowResized(): Invalid parameter detected. " ) ;
2001-05-02 11:58:40 +00:00
// Look for rejected calls.
// Part of dispose-mechanism => soft exceptions
TransactionGuard aTransaction ( m_aTransactionManager , E_SOFTEXCEPTIONS ) ;
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
// Impl-method is threadsafe!
// If we have a current component window - we must resize it!
implts_resizeComponentWindow ( ) ;
2000-09-18 15:33:13 +00:00
}
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : focusGained ( const css : : awt : : FocusEvent & aEvent ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Check incoming parameter.
2013-09-09 22:24:49 +03:00
( void ) aEvent ;
2013-09-08 23:00:27 +03:00
SAL_WARN_IF ( implcp_focusGained ( aEvent ) , " fwk " , " Frame::focusGained(): Invalid parameter detected. " ) ;
2001-05-02 11:58:40 +00:00
// Look for rejected calls.
// Part of dispose() mechanism ... => soft exceptions!
TransactionGuard aTransaction ( m_aTransactionManager , E_SOFTEXCEPTIONS ) ;
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2001-05-02 11:58:40 +00:00
// Make snapshot of member!
css : : uno : : Reference < css : : awt : : XWindow > xComponentWindow = m_xComponentWindow ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
2000-09-18 15:33:13 +00:00
2014-01-21 18:22:24 +01:00
if ( xComponentWindow . is ( ) )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
xComponentWindow - > setFocus ( ) ;
}
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short notifications for window events
@ descr We are a listener on our container window to forward it to our component window . . .
but a XTopWindowListener we are only if we are a top frame !
@ seealso method setComponent ( )
@ seealso member m_xContainerWindow
@ seealso member m_xComponentWindow
@ param " aEvent " describe source of detected event
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : windowActivated ( const css : : lang : : EventObject & aEvent ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-05-02 11:58:40 +00:00
{
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Check incoming parameter.
2013-09-09 22:24:49 +03:00
( void ) aEvent ;
2013-09-08 23:00:27 +03:00
SAL_WARN_IF ( implcp_windowActivated ( aEvent ) , " fwk " , " Frame::windowActivated(): Invalid parameter detected. " ) ;
2001-05-02 11:58:40 +00:00
// Look for rejected calls.
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2001-05-02 11:58:40 +00:00
// Make snapshot of member!
EActiveState eState = m_eActiveState ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Activate the new active path from here to top.
if ( eState = = E_INACTIVE )
{
setActiveFrame ( css : : uno : : Reference < css : : frame : : XFrame > ( ) ) ;
activate ( ) ;
2000-09-18 15:33:13 +00:00
}
}
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : windowDeactivated ( const css : : lang : : EventObject & aEvent ) throw ( css : : uno : : RuntimeException , std : : exception )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Check incoming parameter.
2013-09-09 22:24:49 +03:00
( void ) aEvent ;
2013-09-08 23:00:27 +03:00
SAL_WARN_IF ( implcp_windowDeactivated ( aEvent ) , " fwk " , " Frame::windowDeactivated(): Invalid parameter detected. " ) ;
2001-05-02 11:58:40 +00:00
// Look for rejected calls.
// Sometimes called during dispose() => soft exceptions
TransactionGuard aTransaction ( m_aTransactionManager , E_SOFTEXCEPTIONS ) ;
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2001-05-02 11:58:40 +00:00
2001-08-29 12:52:07 +00:00
css : : uno : : Reference < css : : frame : : XFrame > xParent ( m_xParent , css : : uno : : UNO_QUERY ) ;
css : : uno : : Reference < css : : awt : : XWindow > xContainerWindow = m_xContainerWindow ;
2014-04-06 19:36:08 +03:00
EActiveState eActiveState = m_eActiveState ;
2001-08-29 12:52:07 +00:00
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2001-08-29 12:52:07 +00:00
if ( eActiveState ! = E_INACTIVE )
2000-09-18 15:33:13 +00:00
{
2014-04-10 10:34:23 +02:00
// Deactivation is always done implicitly by activation of another frame.
2001-05-02 11:58:40 +00:00
// Only if no activation is done, deactivations have to be processed if the activated window
// is a parent window of the last active Window!
2010-10-14 22:09:00 -05:00
SolarMutexClearableGuard aSolarGuard ;
2014-09-23 11:20:40 +02:00
vcl : : Window * pFocusWindow = Application : : GetFocusWindow ( ) ;
2014-01-21 18:22:24 +01:00
if ( xContainerWindow . is ( ) & & xParent . is ( ) & &
! css : : uno : : Reference < css : : frame : : XDesktop > ( xParent , css : : uno : : UNO_QUERY ) . is ( )
2001-05-02 11:58:40 +00:00
)
{
2014-04-06 19:36:08 +03:00
css : : uno : : Reference < css : : awt : : XWindow > xParentWindow = xParent - > getContainerWindow ( ) ;
2014-09-23 11:20:40 +02:00
vcl : : Window * pParentWindow = VCLUnoHelper : : GetWindow ( xParentWindow ) ;
2014-03-29 18:59:34 +01:00
//#i70261#: dialogs opened from an OLE object will cause a deactivate on the frame of the OLE object
2006-11-01 17:17:06 +00:00
// on Solaris/Linux at that time pFocusWindow is still NULL because the focus handling is different; right after
// the deactivation the focus will be set into the dialog!
// currently I see no case where a sub frame could get a deactivate with pFocusWindow being NULL permanently
// so for now this case is omitted from handled deactivations
if ( pFocusWindow & & pParentWindow - > IsChild ( pFocusWindow ) )
2001-05-02 11:58:40 +00:00
{
2001-08-29 12:52:07 +00:00
css : : uno : : Reference < css : : frame : : XFramesSupplier > xSupplier ( xParent , css : : uno : : UNO_QUERY ) ;
2014-01-21 18:22:24 +01:00
if ( xSupplier . is ( ) )
2001-05-02 11:58:40 +00:00
{
2001-08-29 12:52:07 +00:00
aSolarGuard . clear ( ) ;
2001-05-02 11:58:40 +00:00
xSupplier - > setActiveFrame ( css : : uno : : Reference < css : : frame : : XFrame > ( ) ) ;
}
}
}
2000-09-18 15:33:13 +00:00
}
2001-05-02 11:58:40 +00:00
}
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : windowClosing ( const css : : lang : : EventObject & ) throw ( css : : uno : : RuntimeException , std : : exception )
2002-05-23 11:54:59 +00:00
{
2006-02-17 17:11:25 +00:00
/* #i62088#
2014-02-09 10:14:25 +01:00
Some interceptor objects intercept our " internally asynchronous implemented " dispatch call .
2006-02-17 17:11:25 +00:00
And they close this frame directly ( means synchronous then ) .
Means : Frame : : windowClosing ( ) - > Frame : : close ( )
In such situation its not a good idea to hold this transaction count alive . - )
*/
{
// Look for rejected calls.
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
// deactivate this frame ...
deactivate ( ) ;
}
2002-05-23 11:54:59 +00:00
2006-02-10 08:57:41 +00:00
// ... and try to close it
2002-05-23 11:54:59 +00:00
// But do it asynchron inside the main thread.
// VCL has no fun to do such things outside his main thread :-(
2006-02-10 08:57:41 +00:00
// Note: The used dispatch make it asynchronous for us .-)
2002-05-23 11:54:59 +00:00
2006-02-10 08:57:41 +00:00
/*ATTENTION!
Don ' t try to suspend the controller here ! Because it ' s done inside used dispatch ( ) .
2014-08-01 16:56:25 +09:00
Otherwhise the dialog " would you save your changes? " will be shown more than once . . .
2006-02-10 08:57:41 +00:00
*/
2003-04-04 16:17:57 +00:00
2006-02-10 08:57:41 +00:00
/* SAFE */
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2013-05-21 17:38:02 +02:00
css : : uno : : Reference < css : : uno : : XComponentContext > xContext = m_xContext ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2006-02-10 08:57:41 +00:00
/* SAFE */
css : : util : : URL aURL ;
2013-09-09 00:58:15 +03:00
aURL . Complete = " .uno:CloseFrame " ;
2013-05-21 17:38:02 +02:00
css : : uno : : Reference < css : : util : : XURLTransformer > xParser ( css : : util : : URLTransformer : : create ( xContext ) ) ;
2006-02-10 08:57:41 +00:00
xParser - > parseStrict ( aURL ) ;
2002-10-24 11:25:54 +00:00
2007-04-16 15:43:56 +00:00
css : : uno : : Reference < css : : frame : : XDispatch > xCloser = queryDispatch ( aURL , SPECIALTARGET_SELF , 0 ) ;
2006-02-10 08:57:41 +00:00
if ( xCloser . is ( ) )
xCloser - > dispatch ( aURL , css : : uno : : Sequence < css : : beans : : PropertyValue > ( ) ) ;
2006-02-17 17:11:25 +00:00
// Attention: If this dispatch works synchronous ... and full fill its job ...
// this line of code will never be reached ...
// Or if it will be reached it will be for sure that all your member are gone .-)
2002-05-23 11:54:59 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2002-07-31 10:03:28 +00:00
@ short react for a show event for the internal container window
2014-09-10 22:35:39 +02:00
@ descr Normally we don ' t need this information really . But we can use it to
2002-07-31 10:03:28 +00:00
implement the special feature " trigger first visible task " .
Algorithm : - first we have to check if we are a top ( task ) frame
It ' s not enough to be a top frame ! Because we MUST have the desktop as parent .
But frames without a parent are top too . So it ' s not possible to check isTop ( ) here !
We have to look for the type of our parent .
- if we are a task frame , then we have to check if we are the first one .
2014-04-18 00:22:58 +03:00
We use a static variable to do so . They will be reset to afterwards be sure
2002-07-31 10:03:28 +00:00
that further calls of this method doesn ' t do anything then .
- Then we have to trigger the right event string on the global job executor .
@ seealso css : : task : : JobExecutor
@ param aEvent
describes the source of this event
We are not interested on this information . We are interested on the visible state only .
@ threadsafe yes
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : windowShown ( const css : : lang : : EventObject & ) throw ( css : : uno : : RuntimeException , std : : exception )
2002-07-31 10:03:28 +00:00
{
2014-04-04 15:53:21 +02:00
static bool bFirstVisibleTask = true ;
2014-04-15 12:50:57 +02:00
static osl : : Mutex aFirstVisibleLock ;
2002-07-31 10:03:28 +00:00
/* SAFE { */
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2002-07-31 10:03:28 +00:00
css : : uno : : Reference < css : : frame : : XDesktop > xDesktopCheck ( m_xParent , css : : uno : : UNO_QUERY ) ;
2013-05-21 17:38:02 +02:00
css : : uno : : Reference < css : : uno : : XComponentContext > xContext = m_xContext ;
2014-04-04 15:53:21 +02:00
m_bIsHidden = false ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2002-07-31 10:03:28 +00:00
/* } SAFE */
2003-03-25 17:22:13 +00:00
impl_checkMenuCloser ( ) ;
2002-07-31 10:03:28 +00:00
if ( xDesktopCheck . is ( ) )
{
2014-04-15 12:50:57 +02:00
osl : : ClearableMutexGuard aGuard ( aFirstVisibleLock ) ;
bool bMustBeTriggered = bFirstVisibleTask ;
bFirstVisibleTask = false ;
aGuard . clear ( ) ;
2002-07-31 10:03:28 +00:00
if ( bMustBeTriggered )
{
2012-05-26 13:53:19 +02:00
css : : uno : : Reference < css : : task : : XJobExecutor > xExecutor
2014-01-22 14:05:06 +01:00
= css : : task : : theJobExecutor : : get ( xContext ) ;
2013-09-09 00:58:15 +03:00
xExecutor - > trigger ( " onFirstVisibleTask " ) ;
2002-07-31 10:03:28 +00:00
}
}
}
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : windowHidden ( const css : : lang : : EventObject & ) throw ( css : : uno : : RuntimeException , std : : exception )
2003-03-25 17:22:13 +00:00
{
/* SAFE { */
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2014-04-04 15:53:21 +02:00
m_bIsHidden = true ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2003-03-25 17:22:13 +00:00
/* } SAFE */
impl_checkMenuCloser ( ) ;
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short called by dispose of our windows !
@ descr This object is forced to release all references to the interfaces given
by the parameter source . We are a listener at our container window and
should listen for his diposing .
@ seealso XWindowListener
@ seealso XTopWindowListener
@ seealso XFocusListener
*/ /*-*****************************************************************************************************/
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : disposing ( const css : : lang : : EventObject & aEvent ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-05-02 11:58:40 +00:00
{
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Check incoming parameter.
2013-09-08 23:00:27 +03:00
SAL_WARN_IF ( implcp_disposing ( aEvent ) , " fwk " , " Frame::disposing(): Invalid parameter detected. " ) ;
2001-05-02 11:58:40 +00:00
// Look for rejected calls.
// May be we are called during releasing our windows in our in dispose call!? => soft exceptions
TransactionGuard aTransaction ( m_aTransactionManager , E_SOFTEXCEPTIONS ) ;
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
2014-03-20 09:30:14 +01:00
SolarMutexResettableGuard aWriteLock ;
2001-06-11 11:52:42 +00:00
if ( aEvent . Source = = m_xContainerWindow )
2000-09-18 15:33:13 +00:00
{
2013-03-03 17:11:39 +01:00
// NECESSARY: Impl-method is threadsafe by himself!
2014-03-20 09:30:14 +01:00
aWriteLock . clear ( ) ;
2001-06-19 09:37:05 +00:00
implts_stopWindowListening ( ) ;
2014-03-20 09:30:14 +01:00
aWriteLock . reset ( ) ;
2001-06-11 11:52:42 +00:00
m_xContainerWindow = css : : uno : : Reference < css : : awt : : XWindow > ( ) ;
2000-09-18 15:33:13 +00:00
}
}
2014-02-25 18:54:02 +01:00
/*-************************************************************************************************************
2001-08-16 08:45:37 +00:00
@ interface com . sun . star . document . XActionLockable
@ short implement locking of frame / task from outside
@ descr Sometimes we have problems to decide if closing of task is allowed . Because ; frame / task
could be used for pending loading jobs . So you can lock this object from outside and
prevent instance against closing during using ! But - don ' t do it in a wrong or expensive manner .
Otherwise task couldn ' t die anymore ! ! !
@ seealso interface XActionLockable
@ seeelso method BaseDispatcher : : implts_loadIt ( )
@ seeelso method Desktop : : loadComponentFromURL ( )
@ return true if frame / task is locked
false otherwise
@ threadsafe yes
*/ /*-*************************************************************************************************************/
2014-02-25 21:31:58 +01:00
sal_Bool SAL_CALL Frame : : isActionLocked ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-08-16 08:45:37 +00:00
{
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2001-12-12 12:16:39 +00:00
return ( m_nExternalLockCount ! = 0 ) ;
2001-08-16 08:45:37 +00:00
}
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : addActionLock ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-08-16 08:45:37 +00:00
{
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2001-08-16 08:45:37 +00:00
+ + m_nExternalLockCount ;
}
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : removeActionLock ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-08-16 08:45:37 +00:00
{
2002-05-23 11:54:59 +00:00
// Register no transaction here! Otherwhise we wait for ever inside possible
// implts_checkSuicide()/dispose() request ...
2001-08-16 08:45:37 +00:00
2014-03-20 09:30:14 +01:00
{
SolarMutexGuard g ;
2014-11-10 15:05:25 +01:00
SAL_WARN_IF ( m_nExternalLockCount < = 0 , " fwk " , " Frame::removeActionLock(): Frame is not locked! Possible multithreading problem detected. " ) ;
2002-05-23 11:54:59 +00:00
- - m_nExternalLockCount ;
2014-03-20 09:30:14 +01:00
}
2001-08-16 08:45:37 +00:00
2002-05-23 11:54:59 +00:00
implts_checkSuicide ( ) ;
2001-08-16 08:45:37 +00:00
}
2014-02-25 21:31:58 +01:00
void SAL_CALL Frame : : setActionLocks ( sal_Int16 nLock ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-08-16 08:45:37 +00:00
{
2014-03-20 09:30:14 +01:00
SolarMutexGuard g ;
2001-12-12 12:16:39 +00:00
// Attention: If somewhere called resetActionLocks() before and get e.g. 5 locks ...
// and tried to set these 5 ones here after his operations ...
// we can't ignore setted requests during these two calls!
// So we must add(!) these 5 locks here.
2006-10-12 09:41:49 +00:00
m_nExternalLockCount = m_nExternalLockCount + nLock ;
2001-08-16 08:45:37 +00:00
}
2014-02-25 21:31:58 +01:00
sal_Int16 SAL_CALL Frame : : resetActionLocks ( ) throw ( css : : uno : : RuntimeException , std : : exception )
2001-08-16 08:45:37 +00:00
{
2002-05-23 11:54:59 +00:00
// Register no transaction here! Otherwhise we wait for ever inside possible
// implts_checkSuicide()/dispose() request ...
sal_Int16 nCurrentLocks = 0 ;
2014-03-20 09:30:14 +01:00
{
SolarMutexGuard g ;
2002-05-23 11:54:59 +00:00
nCurrentLocks = m_nExternalLockCount ;
m_nExternalLockCount = 0 ;
2014-03-20 09:30:14 +01:00
}
2002-05-23 11:54:59 +00:00
// 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().
2013-04-15 04:49:39 +02:00
// See close() for further information
2002-05-23 11:54:59 +00:00
implts_checkSuicide ( ) ;
2001-12-12 12:16:39 +00:00
return nCurrentLocks ;
2001-08-16 08:45:37 +00:00
}
2005-07-12 13:15:16 +00:00
void Frame : : impl_initializePropInfo ( )
2001-05-02 11:58:40 +00:00
{
2005-11-04 14:44:05 +00:00
impl_setPropertyChangeBroadcaster ( static_cast < css : : frame : : XFrame * > ( this ) ) ;
2005-07-12 13:15:16 +00:00
impl_addPropertyInfo (
css : : beans : : Property (
FRAME_PROPNAME_DISPATCHRECORDERSUPPLIER ,
FRAME_PROPHANDLE_DISPATCHRECORDERSUPPLIER ,
2014-05-23 22:11:27 +02:00
cppu : : UnoType < css : : frame : : XDispatchRecorderSupplier > : : get ( ) ,
2005-07-12 13:15:16 +00:00
css : : beans : : PropertyAttribute : : TRANSIENT ) ) ;
impl_addPropertyInfo (
css : : beans : : Property (
FRAME_PROPNAME_INDICATORINTERCEPTION ,
FRAME_PROPHANDLE_INDICATORINTERCEPTION ,
2014-05-23 22:11:27 +02:00
cppu : : UnoType < css : : task : : XStatusIndicator > : : get ( ) ,
2005-07-12 13:15:16 +00:00
css : : beans : : PropertyAttribute : : TRANSIENT ) ) ;
impl_addPropertyInfo (
css : : beans : : Property (
FRAME_PROPNAME_ISHIDDEN ,
FRAME_PROPHANDLE_ISHIDDEN ,
: : getBooleanCppuType ( ) ,
css : : beans : : PropertyAttribute : : TRANSIENT | css : : beans : : PropertyAttribute : : READONLY ) ) ;
impl_addPropertyInfo (
css : : beans : : Property (
FRAME_PROPNAME_LAYOUTMANAGER ,
FRAME_PROPHANDLE_LAYOUTMANAGER ,
2014-05-23 22:11:27 +02:00
cppu : : UnoType < com : : sun : : star : : frame : : XLayoutManager > : : get ( ) ,
2005-07-12 13:15:16 +00:00
css : : beans : : PropertyAttribute : : TRANSIENT ) ) ;
impl_addPropertyInfo (
css : : beans : : Property (
FRAME_PROPNAME_TITLE ,
FRAME_PROPHANDLE_TITLE ,
2014-05-15 22:51:43 +02:00
cppu : : UnoType < OUString > : : get ( ) ,
2005-07-12 13:15:16 +00:00
css : : beans : : PropertyAttribute : : TRANSIENT ) ) ;
2000-09-18 15:33:13 +00:00
}
2013-04-07 12:06:47 +02:00
void SAL_CALL Frame : : impl_setPropertyValue ( const OUString & /*sProperty*/ ,
2005-07-12 13:15:16 +00:00
sal_Int32 nHandle ,
const css : : uno : : Any & aValue )
2005-03-29 14:33:34 +00:00
{
2005-07-12 13:15:16 +00:00
/* There is no need to lock any mutex here. Because we share the
solar mutex with our base class . And we said to our base class : " dont release it on calling us " .-)
2013-04-15 04:49:39 +02:00
see ctor of PropertySetHelper for further information .
2005-07-12 13:15:16 +00:00
*/
/* Attention: You can use nHandle only, if you are sure that all supported
properties has an unique handle . That must be guaranteed
inside method impl_initializePropInfo ( ) !
*/
switch ( nHandle )
2005-03-29 14:33:34 +00:00
{
2005-07-12 13:15:16 +00:00
case FRAME_PROPHANDLE_TITLE :
2005-03-29 14:33:34 +00:00
{
2013-04-07 12:06:47 +02:00
OUString sExternalTitle ;
2008-04-04 13:12:20 +00:00
aValue > > = sExternalTitle ;
setTitle ( sExternalTitle ) ;
2002-04-22 12:51:21 +00:00
}
break ;
2003-03-25 17:22:13 +00:00
case FRAME_PROPHANDLE_DISPATCHRECORDERSUPPLIER :
2002-04-22 12:51:21 +00:00
aValue > > = m_xDispatchRecorderSupplier ;
break ;
2004-02-25 16:48:50 +00:00
case FRAME_PROPHANDLE_LAYOUTMANAGER :
2007-07-06 11:22:50 +00:00
{
2013-05-27 12:58:50 +02:00
css : : uno : : Reference < css : : frame : : XLayoutManager2 > xOldLayoutManager = m_xLayoutManager ;
css : : uno : : Reference < css : : frame : : XLayoutManager2 > xNewLayoutManager ;
2007-07-06 11:22:50 +00:00
aValue > > = xNewLayoutManager ;
if ( xOldLayoutManager ! = xNewLayoutManager )
{
m_xLayoutManager = xNewLayoutManager ;
if ( xOldLayoutManager . is ( ) )
lcl_disableLayoutManager ( xOldLayoutManager , this ) ;
if ( xNewLayoutManager . is ( ) )
lcl_enableLayoutManager ( xNewLayoutManager , this ) ;
}
}
2003-03-25 17:22:13 +00:00
break ;
2004-11-26 13:33:19 +00:00
case FRAME_PROPHANDLE_INDICATORINTERCEPTION :
{
css : : uno : : Reference < css : : task : : XStatusIndicator > xProgress ;
aValue > > = xProgress ;
m_xIndicatorInterception = xProgress ;
}
break ;
2002-04-22 12:51:21 +00:00
default :
2013-09-08 21:49:45 +03:00
SAL_INFO ( " fwk " , " Frame::setFastPropertyValue_NoBroadcast(): Invalid handle detected! " ) ;
2002-04-22 12:51:21 +00:00
break ;
2000-09-18 15:33:13 +00:00
}
2001-05-02 11:58:40 +00:00
}
2000-09-18 15:33:13 +00:00
2013-04-07 12:06:47 +02:00
css : : uno : : Any SAL_CALL Frame : : impl_getPropertyValue ( const OUString & /*sProperty*/ ,
2005-07-12 13:15:16 +00:00
sal_Int32 nHandle )
2001-05-02 11:58:40 +00:00
{
2005-07-12 13:15:16 +00:00
/* There is no need to lock any mutex here. Because we share the
solar mutex with our base class . And we said to our base class : " dont release it on calling us " .-)
2013-04-15 04:49:39 +02:00
see ctor of PropertySetHelper for further information .
2005-07-12 13:15:16 +00:00
*/
/* Attention: You can use nHandle only, if you are sure that all supported
properties has an unique handle . That must be guaranteed
inside method impl_initializePropInfo ( ) !
*/
css : : uno : : Any aValue ;
switch ( nHandle )
2001-05-02 11:58:40 +00:00
{
2003-03-25 17:22:13 +00:00
case FRAME_PROPHANDLE_TITLE :
2008-04-04 13:12:20 +00:00
aValue < < = getTitle ( ) ;
2002-04-22 12:51:21 +00:00
break ;
2003-03-25 17:22:13 +00:00
case FRAME_PROPHANDLE_DISPATCHRECORDERSUPPLIER :
2002-04-22 12:51:21 +00:00
aValue < < = m_xDispatchRecorderSupplier ;
break ;
2003-03-25 17:22:13 +00:00
case FRAME_PROPHANDLE_ISHIDDEN :
2010-01-06 13:58:00 +01:00
aValue < < = m_bIsHidden ;
2003-03-25 17:22:13 +00:00
break ;
2004-02-25 16:48:50 +00:00
case FRAME_PROPHANDLE_LAYOUTMANAGER :
aValue < < = m_xLayoutManager ;
2003-03-25 17:22:13 +00:00
break ;
2004-11-26 13:33:19 +00:00
case FRAME_PROPHANDLE_INDICATORINTERCEPTION :
{
css : : uno : : Reference < css : : task : : XStatusIndicator > xProgress ( m_xIndicatorInterception . get ( ) , css : : uno : : UNO_QUERY ) ;
aValue = css : : uno : : makeAny ( xProgress ) ;
}
break ;
2002-04-22 12:51:21 +00:00
default :
2013-09-08 21:49:45 +03:00
SAL_INFO ( " fwk " , " Frame::getFastPropertyValue(): Invalid handle detected! " ) ;
2002-04-22 12:51:21 +00:00
break ;
2001-02-09 14:36:52 +00:00
}
2001-05-02 11:58:40 +00:00
2005-07-12 13:15:16 +00:00
return aValue ;
2000-09-18 15:33:13 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-06-11 11:52:42 +00:00
@ short dispose old container window and forget his reference
@ descr Sometimes we must repair our " modal dialog parent mechanism " too !
@ param " xWindow " , reference to old container window to dispose it
@ return An empty reference .
@ threadsafe NO !
*/ /*-*****************************************************************************************************/
void Frame : : impl_disposeContainerWindow ( css : : uno : : Reference < css : : awt : : XWindow > & xWindow )
{
2014-01-21 18:22:24 +01:00
if ( xWindow . is ( ) )
2001-06-11 11:52:42 +00:00
{
xWindow - > setVisible ( sal_False ) ;
2003-03-25 17:22:13 +00:00
// All VclComponents are XComponents; so call dispose before discarding
// a css::uno::Reference< XVclComponent >, because this frame is the owner of the window
2001-06-11 11:52:42 +00:00
xWindow - > dispose ( ) ;
xWindow = css : : uno : : Reference < css : : awt : : XWindow > ( ) ;
}
}
2000-09-18 15:33:13 +00:00
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short send frame action event to our listener
@ descr This method is threadsafe AND can be called by our dispose method too !
@ param " aAction " , describe the event for sending
*/ /*-*****************************************************************************************************/
void Frame : : implts_sendFrameActionEvent ( const css : : frame : : FrameAction & aAction )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Sometimes used by dispose() => soft exceptions!
TransactionGuard aTransaction ( m_aTransactionManager , E_SOFTEXCEPTIONS ) ;
2013-02-28 18:11:24 -04:00
// Log information about order of events to file!
2000-09-18 15:33:13 +00:00
// (only activated in debug version!)
2013-09-08 23:41:20 +03:00
SAL_INFO ( " fwk.frame " ,
" [Frame] " < < m_sName < < " send event " < <
( aAction = = css : : frame : : FrameAction_COMPONENT_ATTACHED ? OUString ( " COMPONENT ATTACHED " ) :
( aAction = = css : : frame : : FrameAction_COMPONENT_DETACHING ? OUString ( " COMPONENT DETACHING " ) :
( aAction = = css : : frame : : FrameAction_COMPONENT_REATTACHED ? OUString ( " COMPONENT REATTACHED " ) :
( aAction = = css : : frame : : FrameAction_FRAME_ACTIVATED ? OUString ( " FRAME ACTIVATED " ) :
( aAction = = css : : frame : : FrameAction_FRAME_DEACTIVATING ? OUString ( " FRAME DEACTIVATING " ) :
( aAction = = css : : frame : : FrameAction_CONTEXT_CHANGED ? OUString ( " CONTEXT CHANGED " ) :
( aAction = = css : : frame : : FrameAction_FRAME_UI_ACTIVATED ? OUString ( " FRAME UI ACTIVATED " ) :
( aAction = = css : : frame : : FrameAction_FRAME_UI_DEACTIVATING ? OUString ( " FRAME UI DEACTIVATING " ) :
( aAction = = css : : frame : : FrameAction_MAKE_FIXED_SIZE ? OUString ( " MAKE_FIXED_SIZE " ) :
OUString ( " *invalid* " ) ) ) ) ) ) ) ) ) ) ) ;
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
// Send css::frame::FrameAction event to all listener.
2000-09-18 15:33:13 +00:00
// Get container for right listener.
2001-05-02 11:58:40 +00:00
// FOLLOW LINES ARE THREADSAFE!!!
// ( OInterfaceContainerHelper is synchronized with m_aListenerContainer! )
2014-05-23 22:11:27 +02:00
: : cppu : : OInterfaceContainerHelper * pContainer = m_aListenerContainer . getContainer ( cppu : : UnoType < css : : frame : : XFrameActionListener > : : get ( ) ) ;
2000-09-18 15:33:13 +00:00
2001-05-02 11:58:40 +00:00
if ( pContainer ! = NULL )
2000-09-18 15:33:13 +00:00
{
2001-05-02 11:58:40 +00:00
// Build action event.
css : : frame : : FrameActionEvent aFrameActionEvent ( static_cast < : : cppu : : OWeakObject * > ( this ) , this , aAction ) ;
2000-09-18 15:33:13 +00:00
// Get iterator for access to listener.
2001-05-02 11:58:40 +00:00
: : cppu : : OInterfaceIteratorHelper aIterator ( * pContainer ) ;
2000-09-18 15:33:13 +00:00
// Send message to all listener.
2014-01-29 11:04:49 +01:00
while ( aIterator . hasMoreElements ( ) )
2000-09-18 15:33:13 +00:00
{
2002-05-23 11:54:59 +00:00
try
{
2014-09-29 13:55:54 +02:00
static_cast < css : : frame : : XFrameActionListener * > ( aIterator . next ( ) ) - > frameAction ( aFrameActionEvent ) ;
2002-05-23 11:54:59 +00:00
}
2011-12-14 00:03:52 +09:00
catch ( const css : : uno : : RuntimeException & )
2002-05-23 11:54:59 +00:00
{
2002-05-24 10:33:59 +00:00
aIterator . remove ( ) ;
2002-05-23 11:54:59 +00:00
}
2000-09-18 15:33:13 +00:00
}
}
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-05-02 11:58:40 +00:00
@ short helper to resize our component window
@ descr A frame contains 2 windows - a container ~ and a component window .
This method resize inner component window to full size of outer container window .
This method is threadsafe AND can be called by our dispose method too !
*/ /*-*****************************************************************************************************/
void Frame : : implts_resizeComponentWindow ( )
2000-09-18 15:33:13 +00:00
{
2006-11-01 17:17:06 +00:00
// usually the LayoutManager does the resizing
// in case there is no LayoutManager resizing has to be done here
if ( ! m_xLayoutManager . is ( ) )
{
css : : uno : : Reference < css : : awt : : XWindow > xComponentWindow ( getComponentWindow ( ) ) ;
2014-01-21 18:22:24 +01:00
if ( xComponentWindow . is ( ) )
2006-11-01 17:17:06 +00:00
{
css : : uno : : Reference < css : : awt : : XDevice > xDevice ( getContainerWindow ( ) , css : : uno : : UNO_QUERY ) ;
// Convert relativ size to output size.
css : : awt : : Rectangle aRectangle = getContainerWindow ( ) - > getPosSize ( ) ;
css : : awt : : DeviceInfo aInfo = xDevice - > getInfo ( ) ;
css : : awt : : Size aSize ( aRectangle . Width - aInfo . LeftInset - aInfo . RightInset ,
aRectangle . Height - aInfo . TopInset - aInfo . BottomInset ) ;
// Resize our component window.
xComponentWindow - > setPosSize ( 0 , 0 , aSize . Width , aSize . Height , css : : awt : : PosSize : : POSSIZE ) ;
}
}
2000-09-18 15:33:13 +00:00
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2001-10-26 08:46:09 +00:00
@ short helper to set icon on our container window ( if it is a system window ! )
2014-11-12 12:25:13 +01:00
@ descr We use our internal set controller ( if it exist ) to specify which factory he represented .
2001-10-26 08:46:09 +00:00
These information can be used to find right icon . But our controller can say it us directly
too . . . we should ask his optional property set first . . .
@ seealso method Window : : SetIcon ( )
@ onerror We do nothing .
*/ /*-*****************************************************************************************************/
void Frame : : implts_setIconOnWindow ( )
{
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Look for rejected calls.
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
2013-03-03 17:11:39 +01:00
// Make snapshot of necessary members and release lock.
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2001-10-26 08:46:09 +00:00
css : : uno : : Reference < css : : awt : : XWindow > xContainerWindow ( m_xContainerWindow , css : : uno : : UNO_QUERY ) ;
css : : uno : : Reference < css : : frame : : XController > xController ( m_xController , css : : uno : : UNO_QUERY ) ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2001-10-26 08:46:09 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
2014-01-21 18:22:24 +01:00
if ( xContainerWindow . is ( ) & & xController . is ( ) )
2001-10-26 08:46:09 +00:00
{
2014-02-22 21:20:15 +01:00
2001-10-26 08:46:09 +00:00
// a) set default value to an invalid one. So we can start further searches for right icon id, if
// first steps failed!
// We must reset it to any fallback value - if no search step returns a valid result.
sal_Int32 nIcon = - 1 ;
// b) try to find information on controller propertyset directly
// Don't forget to catch possible exceptions - because these property is an optional one!
css : : uno : : Reference < css : : beans : : XPropertySet > xSet ( xController , css : : uno : : UNO_QUERY ) ;
2014-01-21 18:22:24 +01:00
if ( xSet . is ( ) )
2001-10-26 08:46:09 +00:00
{
try
{
2011-02-25 10:42:53 +01:00
css : : uno : : Reference < css : : beans : : XPropertySetInfo > const xPSI ( xSet - > getPropertySetInfo ( ) , css : : uno : : UNO_SET_THROW ) ;
2012-07-05 20:18:35 +01:00
if ( xPSI - > hasPropertyByName ( " IconId " ) )
xSet - > getPropertyValue ( " IconId " ) > > = nIcon ;
2001-10-26 08:46:09 +00:00
}
2011-02-25 10:42:53 +01:00
catch ( css : : uno : : Exception & )
2001-10-26 08:46:09 +00:00
{
2011-02-25 10:42:53 +01:00
DBG_UNHANDLED_EXCEPTION ( ) ;
2001-10-26 08:46:09 +00:00
}
}
// c) if b) failed ... analyze argument list of currently loaded document insde the frame to find the filter.
// He can be used to detect right factory - and these can be used to match factory to icon ...
if ( nIcon = = - 1 )
{
css : : uno : : Reference < css : : frame : : XModel > xModel = xController - > getModel ( ) ;
2014-01-21 18:22:24 +01:00
if ( xModel . is ( ) )
2001-10-26 08:46:09 +00:00
{
2004-01-28 13:40:30 +00:00
SvtModuleOptions : : EFactory eFactory = SvtModuleOptions : : ClassifyFactoryByModel ( xModel ) ;
if ( eFactory ! = SvtModuleOptions : : E_UNKNOWN_FACTORY )
nIcon = SvtModuleOptions ( ) . GetFactoryIcon ( eFactory ) ;
2001-10-26 08:46:09 +00:00
}
}
// d) if all steps failed - use fallback!
if ( nIcon = = - 1 )
{
nIcon = 0 ;
}
// e) set icon on container window now
// Don't forget SolarMutex! We use vcl directly :-(
// Check window pointer for right WorkWindow class too!!!
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
{
2010-10-14 22:09:00 -05:00
SolarMutexGuard aSolarGuard ;
2014-09-23 11:20:40 +02:00
vcl : : Window * pWindow = ( VCLUnoHelper : : GetWindow ( xContainerWindow ) ) ;
2010-10-14 22:09:00 -05:00
if (
( pWindow ! = NULL ) & &
( pWindow - > GetType ( ) = = WINDOW_WORKWINDOW )
)
{
2014-09-29 13:55:54 +02:00
WorkWindow * pWorkWindow = static_cast < WorkWindow * > ( pWindow ) ;
2010-10-14 22:09:00 -05:00
pWorkWindow - > SetIcon ( ( sal_uInt16 ) nIcon ) ;
}
2001-10-26 08:46:09 +00:00
}
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
}
}
2014-02-25 18:54:02 +01:00
/*-************************************************************************************************************
2001-06-11 11:52:42 +00:00
@ short helper to start / stop listeneing for window events on container window
2013-04-15 05:32:37 +02:00
@ descr If we get a new container window , we must set it on internal member . . .
2001-06-11 11:52:42 +00:00
and stop listening at old one . . . and start listening on new one !
2013-12-20 11:25:37 +01:00
But sometimes ( in dispose ( ) call ! ) it ' s necessary to stop listeneing without starting
2001-06-11 11:52:42 +00:00
on new connections . So we split this functionality to make it easier at use .
@ seealso method initialize ( )
@ seealso method dispose ( )
@ onerror We do nothing !
2001-06-19 09:37:05 +00:00
@ threadsafe yes
2001-06-11 11:52:42 +00:00
*/ /*-*************************************************************************************************************/
2001-06-19 09:37:05 +00:00
void Frame : : implts_startWindowListening ( )
2001-06-11 11:52:42 +00:00
{
2001-06-19 09:37:05 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
TransactionGuard aTransaction ( m_aTransactionManager , E_HARDEXCEPTIONS ) ;
2001-06-11 11:52:42 +00:00
2001-06-19 09:37:05 +00:00
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
2013-03-03 17:11:39 +01:00
// Make snapshot of necessary member!
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2014-04-06 19:36:08 +03:00
css : : uno : : Reference < css : : awt : : XWindow > xContainerWindow = m_xContainerWindow ;
2013-05-21 17:38:02 +02:00
css : : uno : : Reference < css : : uno : : XComponentContext > xContext = m_xContext ;
2001-06-19 09:37:05 +00:00
css : : uno : : Reference < css : : datatransfer : : dnd : : XDropTargetListener > xDragDropListener = m_xDropTargetListener ;
css : : uno : : Reference < css : : awt : : XWindowListener > xWindowListener ( static_cast < : : cppu : : OWeakObject * > ( this ) , css : : uno : : UNO_QUERY ) ;
css : : uno : : Reference < css : : awt : : XFocusListener > xFocusListener ( static_cast < : : cppu : : OWeakObject * > ( this ) , css : : uno : : UNO_QUERY ) ;
css : : uno : : Reference < css : : awt : : XTopWindowListener > xTopWindowListener ( static_cast < : : cppu : : OWeakObject * > ( this ) , css : : uno : : UNO_QUERY ) ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2001-06-19 09:37:05 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
2014-01-21 18:22:24 +01:00
if ( xContainerWindow . is ( ) )
2001-06-19 09:37:05 +00:00
{
xContainerWindow - > addWindowListener ( xWindowListener ) ;
xContainerWindow - > addFocusListener ( xFocusListener ) ;
2001-06-11 11:52:42 +00:00
2001-06-19 09:37:05 +00:00
css : : uno : : Reference < css : : awt : : XTopWindow > xTopWindow ( xContainerWindow , css : : uno : : UNO_QUERY ) ;
2014-01-21 18:22:24 +01:00
if ( xTopWindow . is ( ) )
2001-06-11 11:52:42 +00:00
{
xTopWindow - > addTopWindowListener ( xTopWindowListener ) ;
2001-06-15 08:41:19 +00:00
2013-05-21 17:38:02 +02:00
css : : uno : : Reference < css : : awt : : XToolkit2 > xToolkit = css : : awt : : Toolkit : : create ( xContext ) ;
2012-10-17 10:52:52 +02:00
css : : uno : : Reference < css : : datatransfer : : dnd : : XDropTarget > xDropTarget = xToolkit - > getDropTarget ( xContainerWindow ) ;
2014-01-21 18:22:24 +01:00
if ( xDropTarget . is ( ) )
2001-06-15 08:41:19 +00:00
{
2012-10-17 10:52:52 +02:00
xDropTarget - > addDropTargetListener ( xDragDropListener ) ;
xDropTarget - > setActive ( sal_True ) ;
2001-06-15 08:41:19 +00:00
}
2001-06-11 11:52:42 +00:00
}
}
}
2001-06-19 09:37:05 +00:00
void Frame : : implts_stopWindowListening ( )
2001-06-11 11:52:42 +00:00
{
2001-06-19 09:37:05 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Sometimes used by dispose() => soft exceptions!
TransactionGuard aTransaction ( m_aTransactionManager , E_SOFTEXCEPTIONS ) ;
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
2013-03-03 17:11:39 +01:00
// Make snapshot of necessary member!
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2014-04-06 19:36:08 +03:00
css : : uno : : Reference < css : : awt : : XWindow > xContainerWindow = m_xContainerWindow ;
css : : uno : : Reference < css : : uno : : XComponentContext > xContext = m_xContext ;
2001-06-19 09:37:05 +00:00
css : : uno : : Reference < css : : datatransfer : : dnd : : XDropTargetListener > xDragDropListener = m_xDropTargetListener ;
css : : uno : : Reference < css : : awt : : XWindowListener > xWindowListener ( static_cast < : : cppu : : OWeakObject * > ( this ) , css : : uno : : UNO_QUERY ) ;
css : : uno : : Reference < css : : awt : : XFocusListener > xFocusListener ( static_cast < : : cppu : : OWeakObject * > ( this ) , css : : uno : : UNO_QUERY ) ;
css : : uno : : Reference < css : : awt : : XTopWindowListener > xTopWindowListener ( static_cast < : : cppu : : OWeakObject * > ( this ) , css : : uno : : UNO_QUERY ) ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2001-06-19 09:37:05 +00:00
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
2001-06-11 11:52:42 +00:00
2014-01-21 18:22:24 +01:00
if ( xContainerWindow . is ( ) )
2001-06-19 09:37:05 +00:00
{
xContainerWindow - > removeWindowListener ( xWindowListener ) ;
xContainerWindow - > removeFocusListener ( xFocusListener ) ;
2001-06-11 11:52:42 +00:00
2001-06-19 09:37:05 +00:00
css : : uno : : Reference < css : : awt : : XTopWindow > xTopWindow ( xContainerWindow , css : : uno : : UNO_QUERY ) ;
2014-01-21 18:22:24 +01:00
if ( xTopWindow . is ( ) )
2001-06-11 11:52:42 +00:00
{
xTopWindow - > removeTopWindowListener ( xTopWindowListener ) ;
2001-06-15 08:41:19 +00:00
2013-05-21 17:38:02 +02:00
css : : uno : : Reference < css : : awt : : XToolkit2 > xToolkit = css : : awt : : Toolkit : : create ( xContext ) ;
2012-10-17 10:52:52 +02:00
css : : uno : : Reference < css : : datatransfer : : dnd : : XDropTarget > xDropTarget = xToolkit - > getDropTarget ( xContainerWindow ) ;
2014-01-21 18:22:24 +01:00
if ( xDropTarget . is ( ) )
2001-06-15 08:41:19 +00:00
{
2012-10-17 10:52:52 +02:00
xDropTarget - > removeDropTargetListener ( xDragDropListener ) ;
xDropTarget - > setActive ( sal_False ) ;
2001-06-15 08:41:19 +00:00
}
2001-06-11 11:52:42 +00:00
}
}
}
2014-02-25 18:54:02 +01:00
/*-****************************************************************************************************
2002-05-23 11:54:59 +00:00
@ 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
*/ /*-*****************************************************************************************************/
void Frame : : implts_checkSuicide ( )
{
2003-03-25 17:22:13 +00:00
/* SAFE */
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2003-03-25 17:22:13 +00:00
// 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.
2014-04-04 15:53:21 +02:00
bool bSuicide = ( m_nExternalLockCount = = 0 & & m_bSelfClose ) ;
m_bSelfClose = false ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2003-03-25 17:22:13 +00:00
/* } SAFE */
2015-01-23 16:23:26 +02:00
// force close and deliver ownership to source of possible throwed veto exception
2014-11-10 15:05:25 +01:00
// Attention: Because this method is not designed to throw such exception we must suppress
2002-05-23 11:54:59 +00:00
// it for outside code!
try
{
if ( bSuicide )
close ( sal_True ) ;
}
2004-06-10 12:22:23 +00:00
catch ( const css : : util : : CloseVetoException & )
{ }
catch ( const css : : lang : : DisposedException & )
{ }
2002-05-23 11:54:59 +00:00
}
2003-03-25 17:22:13 +00:00
/** little helper to enable/disable the menu closer at the menubar of the given frame.
2002-10-07 09:21:25 +00:00
2003-03-25 17:22:13 +00:00
@ param xFrame
2004-02-25 16:48:50 +00:00
we use its layout manager to set / reset a special callback .
Its existence regulate visibility of this closer item .
2003-03-25 17:22:13 +00:00
@ param bState
< TRUE / > enable ; < FALSE / > disable this state
*/
2013-03-22 09:24:15 +02:00
void Frame : : impl_setCloser ( /*IN*/ const css : : uno : : Reference < css : : frame : : XFrame2 > & xFrame ,
2014-04-04 15:53:21 +02:00
/*IN*/ bool bState )
2003-03-25 17:22:13 +00:00
{
2014-11-10 15:05:25 +01:00
// Note: If start module is not installed - no closer has to be shown!
2004-02-25 16:48:50 +00:00
if ( ! SvtModuleOptions ( ) . IsModuleInstalled ( SvtModuleOptions : : E_SSTARTMODULE ) )
2002-10-07 09:21:25 +00:00
return ;
2003-03-25 17:22:13 +00:00
try
2002-10-07 09:21:25 +00:00
{
2006-04-07 09:19:47 +00:00
css : : uno : : Reference < css : : beans : : XPropertySet > xFrameProps ( xFrame , css : : uno : : UNO_QUERY_THROW ) ;
2005-03-01 18:38:45 +00:00
css : : uno : : Reference < css : : frame : : XLayoutManager > xLayoutManager ;
2004-02-25 16:48:50 +00:00
xFrameProps - > getPropertyValue ( FRAME_PROPNAME_LAYOUTMANAGER ) > > = xLayoutManager ;
2006-04-07 09:19:47 +00:00
css : : uno : : Reference < css : : beans : : XPropertySet > xLayoutProps ( xLayoutManager , css : : uno : : UNO_QUERY_THROW ) ;
2006-10-13 08:43:05 +00:00
xLayoutProps - > setPropertyValue ( LAYOUTMANAGER_PROPNAME_MENUBARCLOSER , css : : uno : : makeAny ( bState ) ) ;
2003-03-25 17:22:13 +00:00
}
2004-02-25 16:48:50 +00:00
catch ( const css : : uno : : RuntimeException & )
{ throw ; }
catch ( const css : : uno : : Exception & )
{ }
2003-03-25 17:22:13 +00:00
}
/** it checks, which of the top level task frames must have the special menu closer for
switching to the backing window mode .
It analyze the current list of visible top level frames . Only the last real document
frame can have this symbol . Not the help frame nor the backing task itself .
Here we do anything related to this closer . We remove it from the old frame and set it
for the new one .
*/
void Frame : : impl_checkMenuCloser ( )
{
/* SAFE { */
2014-03-20 09:30:14 +01:00
SolarMutexClearableGuard aReadLock ;
2003-03-25 17:22:13 +00:00
// only top frames, which are part of our desktop hierarchy, can
2014-02-10 16:48:09 +01:00
// do so! By the way - we need the desktop instance to have access
2003-03-25 17:22:13 +00:00
// to all other top level frames too.
css : : uno : : Reference < css : : frame : : XDesktop > xDesktop ( m_xParent , css : : uno : : UNO_QUERY ) ;
css : : uno : : Reference < css : : frame : : XFramesSupplier > xTaskSupplier ( xDesktop , css : : uno : : UNO_QUERY ) ;
if ( ! xDesktop . is ( ) | | ! xTaskSupplier . is ( ) )
return ;
2014-03-20 09:30:14 +01:00
aReadLock . clear ( ) ;
2003-03-25 17:22:13 +00:00
/* } SAFE */
// analyze the list of current open tasks
// Suppress search for other views to the same model ...
// It's not needed here and can be very expensive.
FrameListAnalyzer aAnalyzer (
xTaskSupplier ,
this ,
FrameListAnalyzer : : E_HIDDEN | FrameListAnalyzer : : E_HELP | FrameListAnalyzer : : E_BACKINGCOMPONENT ) ;
// specify the new frame, which must have this special state ...
2013-03-22 09:24:15 +02:00
css : : uno : : Reference < css : : frame : : XFrame2 > xNewCloserFrame ;
2003-03-25 17:22:13 +00:00
// a)
// If there exist ate least one other frame - there are two frames currently open.
// But we can enable this closer only, if one of these two tasks includes the help module.
// The "other frame" couldn't be the help. Because then it wouldn't be part of this "other list".
2013-02-23 17:20:45 +01:00
// In such case it will be separated to the reference aAnalyzer.m_xHelp!
2003-03-25 17:22:13 +00:00
// But we must check, if weself includes the help ...
// Check aAnalyzer.m_bReferenceIsHelp!
if (
( aAnalyzer . m_lOtherVisibleFrames . getLength ( ) = = 1 ) & &
(
( aAnalyzer . m_bReferenceIsHelp ) | |
( aAnalyzer . m_bReferenceIsHidden )
)
)
{
2003-04-24 12:33:58 +00:00
// others[0] can't be the backing component!
// Because it's set at the special member aAnalyzer.m_xBackingComponent ... :-)
2013-03-22 09:24:15 +02:00
xNewCloserFrame . set ( aAnalyzer . m_lOtherVisibleFrames [ 0 ] , css : : uno : : UNO_QUERY_THROW ) ;
2003-03-25 17:22:13 +00:00
}
2014-02-22 21:20:15 +01:00
2003-03-25 17:22:13 +00:00
// b)
// There is no other frame ... means no other document frame. The help module
2013-05-15 10:42:04 +03:00
// will be handled separately and must(!) be ignored here ... excepting weself includes the help.
2012-10-13 11:47:19 +01:00
else if (
2003-03-25 17:22:13 +00:00
( aAnalyzer . m_lOtherVisibleFrames . getLength ( ) = = 0 ) & &
( ! aAnalyzer . m_bReferenceIsHelp ) & &
2003-04-24 12:33:58 +00:00
( ! aAnalyzer . m_bReferenceIsHidden ) & &
( ! aAnalyzer . m_bReferenceIsBacking )
2003-03-25 17:22:13 +00:00
)
{
xNewCloserFrame = this ;
2002-10-07 09:21:25 +00:00
}
2013-03-03 17:11:39 +01:00
// Look for necessary actions ...
2003-03-25 17:22:13 +00:00
// Only if the closer state must be moved from one frame to another one
// or must be enabled/disabled at all.
2014-04-15 12:50:57 +02:00
SolarMutexGuard aGuard ;
2013-03-22 09:24:15 +02:00
css : : uno : : Reference < css : : frame : : XFrame2 > xCloserFrame ( m_xCloserFrame . get ( ) , css : : uno : : UNO_QUERY ) ;
2003-03-25 17:22:13 +00:00
if ( xCloserFrame ! = xNewCloserFrame )
2002-10-07 09:21:25 +00:00
{
2003-03-25 17:22:13 +00:00
if ( xCloserFrame . is ( ) )
2014-04-04 15:53:21 +02:00
impl_setCloser ( xCloserFrame , false ) ;
2003-03-25 17:22:13 +00:00
if ( xNewCloserFrame . is ( ) )
2014-04-04 15:53:21 +02:00
impl_setCloser ( xNewCloserFrame , true ) ;
2003-03-25 17:22:13 +00:00
m_xCloserFrame = xNewCloserFrame ;
2002-10-07 09:21:25 +00:00
}
}
2001-05-02 11:58:40 +00:00
// debug methods
2014-02-22 21:20:15 +01:00
2001-05-02 11:58:40 +00:00
// Its allowed to reset the active frame membervariable with a NULL-css::uno::Reference but not with a NULL-pointer!
// And we accept frames only! No tasks and desktops!
2014-04-04 15:53:21 +02:00
bool Frame : : implcp_setActiveFrame ( const css : : uno : : Reference < css : : frame : : XFrame > & xFrame )
2000-09-18 15:33:13 +00:00
{
2014-01-21 18:22:24 +01:00
return css : : uno : : Reference < css : : frame : : XDesktop > ( xFrame , css : : uno : : UNO_QUERY ) . is ( ) ;
2000-09-18 15:33:13 +00:00
}
2014-04-04 15:53:21 +02:00
bool Frame : : implcp_addFrameActionListener ( const css : : uno : : Reference < css : : frame : : XFrameActionListener > & xListener )
2000-09-18 15:33:13 +00:00
{
2014-01-21 18:22:24 +01:00
return ! xListener . is ( ) ;
2000-09-18 15:33:13 +00:00
}
2014-04-04 15:53:21 +02:00
bool Frame : : implcp_removeFrameActionListener ( const css : : uno : : Reference < css : : frame : : XFrameActionListener > & xListener )
2000-09-18 15:33:13 +00:00
{
2014-01-21 18:22:24 +01:00
return ! xListener . is ( ) ;
2000-09-18 15:33:13 +00:00
}
2014-04-04 15:53:21 +02:00
bool Frame : : implcp_addEventListener ( const css : : uno : : Reference < css : : lang : : XEventListener > & xListener )
2000-09-18 15:33:13 +00:00
{
2014-01-21 18:22:24 +01:00
return ! xListener . is ( ) ;
2000-09-18 15:33:13 +00:00
}
2014-04-04 15:53:21 +02:00
bool Frame : : implcp_removeEventListener ( const css : : uno : : Reference < css : : lang : : XEventListener > & xListener )
2000-09-18 15:33:13 +00:00
{
2014-01-21 18:22:24 +01:00
return ! xListener . is ( ) ;
2000-09-18 15:33:13 +00:00
}
2014-04-04 15:53:21 +02:00
bool Frame : : implcp_windowResized ( const css : : awt : : WindowEvent & aEvent )
2000-09-18 15:33:13 +00:00
{
2014-01-21 18:22:24 +01:00
return ! aEvent . Source . is ( ) ;
2000-09-18 15:33:13 +00:00
}
2014-04-04 15:53:21 +02:00
bool Frame : : implcp_focusGained ( const css : : awt : : FocusEvent & aEvent )
2000-09-18 15:33:13 +00:00
{
2014-01-21 18:22:24 +01:00
return ! aEvent . Source . is ( ) ;
2000-09-18 15:33:13 +00:00
}
2014-04-04 15:53:21 +02:00
bool Frame : : implcp_windowActivated ( const css : : lang : : EventObject & aEvent )
2000-09-18 15:33:13 +00:00
{
2014-01-21 18:22:24 +01:00
return ! aEvent . Source . is ( ) ;
2001-05-02 11:58:40 +00:00
}
2000-09-18 15:33:13 +00:00
2014-04-04 15:53:21 +02:00
bool Frame : : implcp_windowDeactivated ( const css : : lang : : EventObject & aEvent )
2001-05-02 11:58:40 +00:00
{
2014-01-21 18:22:24 +01:00
return ! aEvent . Source . is ( ) ;
2001-05-02 11:58:40 +00:00
}
2000-09-18 15:33:13 +00:00
2014-04-04 15:53:21 +02:00
bool Frame : : implcp_disposing ( const css : : lang : : EventObject & aEvent )
2001-05-02 11:58:40 +00:00
{
2014-01-21 18:22:24 +01:00
return ! aEvent . Source . is ( ) ;
2000-09-18 15:33:13 +00:00
}
2014-01-09 20:53:32 +01:00
}
extern " C " SAL_DLLPUBLIC_EXPORT css : : uno : : XInterface * SAL_CALL
com_sun_star_comp_framework_Frame_get_implementation (
css : : uno : : XComponentContext * context ,
2014-01-22 11:54:19 +01:00
css : : uno : : Sequence < css : : uno : : Any > const & )
2014-01-09 20:53:32 +01:00
{
2014-01-22 11:54:19 +01:00
Frame * inst = new Frame ( context ) ;
css : : uno : : XInterface * acquired_inst = cppu : : acquire ( inst ) ;
2014-01-21 15:45:43 +01:00
2014-01-22 11:54:19 +01:00
inst - > initListeners ( ) ;
return acquired_inst ;
2014-01-09 20:53:32 +01:00
}
2010-10-12 15:53:47 +02:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */