2010-10-12 08:59:03 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2008-03-06 11:28:21 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 10:04:43 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2008-03-06 11:28:21 -06:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2008-03-06 11:28:21 -06:00
|
|
|
*
|
2008-04-10 10:04:43 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2008-03-06 11:28:21 -06:00
|
|
|
*
|
2008-04-10 10:04:43 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2008-03-06 11:28:21 -06:00
|
|
|
*
|
2008-04-10 10:04:43 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2008-03-06 11:28:21 -06:00
|
|
|
*
|
2008-04-10 10:04:43 -05:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2008-03-06 11:28:21 -06:00
|
|
|
*
|
2008-04-10 10:04:43 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2008-03-06 11:28:21 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include "controllerframe.hxx"
|
|
|
|
#include "IController.hxx"
|
|
|
|
|
|
|
|
/** === begin UNO includes === **/
|
|
|
|
#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
|
|
|
|
#include <com/sun/star/awt/XTopWindow.hpp>
|
|
|
|
#include <com/sun/star/awt/XWindow2.hpp>
|
|
|
|
#include <com/sun/star/lang/DisposedException.hpp>
|
2008-10-16 01:57:26 -05:00
|
|
|
#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
|
|
|
|
#include <com/sun/star/frame/XController2.hpp>
|
2008-03-06 11:28:21 -06:00
|
|
|
/** === end UNO includes === **/
|
|
|
|
|
|
|
|
#include <cppuhelper/implbase1.hxx>
|
|
|
|
#include <rtl/ref.hxx>
|
|
|
|
#include <sfx2/objsh.hxx>
|
|
|
|
#include <tools/diagnose_ex.h>
|
CWS-TOOLING: integrate CWS dba32j
2009-11-26 09:30:10 +0100 msc r277648 : #100000 fix urgent testscript error
2009-11-25 10:27:56 +0100 msc r277625 : #i100000 fix urgent testscript error
2009-11-17 22:16:46 +0100 fs r277544 : CWS-TOOLING: rebase CWS dba32j to branches/OOO320@277531 (milestone: OOO320:m5)
2009-11-17 14:26:47 +0100 fs r277535 : ooops, didn't mean to commit this uncommented line
2009-11-14 20:50:29 +0100 fs r277505 : add a --disable-pango switch to SM's configure options, and add a patch which makes certain code respect it (well, respect it better than currently, by not using some pango_x_* functions, which are not always available, even when pango itself is present)
2009-11-14 20:47:41 +0100 fs r277504 : spelling
2009-11-13 14:04:00 +0100 fs r277502 : #i100764# (commit approved by ab@openoffice.org): getModelFromBasic: do not start with the parent's parent when looking for ThisComponent, but walk up the anchestor chain, starting with the immediate parent
2009-11-13 11:04:15 +0100 fs r277496 : #i100764# better heuristics for determining whether or not to participate in the ThisComponent game
2009-11-13 11:02:30 +0100 fs r277495 : #i100764# set the WB_EXT_DOCUMENT style at the backing component's container window, when creating it without the TaskCreator (which would normally do this)
2009-11-11 13:49:11 +0100 fs r277452 : #i106816#
2009-11-11 13:48:53 +0100 fs r277451 : fix the CREATETARBAL target, which is expected to create the zips used as prebuilts. The *inc.zip missed the NSS files in case NSS was built externally
2009-11-11 12:15:34 +0100 fs r277449 : update ignore list
2009-11-11 12:09:23 +0100 fs r277448 : add a link to the Mozilla build tools download location
2009-11-11 12:07:16 +0100 fs r277447 : add a link to the Mozilla build tools download location
2009-11-06 16:23:12 +0100 fs r277393 : #i106643#
2009-11-03 23:20:29 +0100 fs r277328 : #i106574#
reverted the recent fix for issue #i105235#, and implemented a better one.
2009-11-02 12:59:48 +0100 fs r277294 : #i106550# errorOccured: also display the error when we're not in a nested form action - form actions are allowed to be triggered by other instances as well
2009-12-01 03:53:35 -06:00
|
|
|
#include <toolkit/helper/vclunohelper.hxx>
|
|
|
|
#include <vcl/window.hxx>
|
2008-03-06 11:28:21 -06:00
|
|
|
|
|
|
|
//........................................................................
|
|
|
|
namespace dbaui
|
|
|
|
{
|
|
|
|
//........................................................................
|
|
|
|
|
|
|
|
/** === begin UNO using === **/
|
|
|
|
using ::com::sun::star::uno::Reference;
|
|
|
|
using ::com::sun::star::uno::XInterface;
|
|
|
|
using ::com::sun::star::uno::UNO_QUERY;
|
|
|
|
using ::com::sun::star::uno::UNO_QUERY_THROW;
|
|
|
|
using ::com::sun::star::uno::UNO_SET_THROW;
|
|
|
|
using ::com::sun::star::uno::Exception;
|
|
|
|
using ::com::sun::star::uno::RuntimeException;
|
|
|
|
using ::com::sun::star::uno::Any;
|
|
|
|
using ::com::sun::star::uno::makeAny;
|
|
|
|
using ::com::sun::star::frame::XFrame;
|
|
|
|
using ::com::sun::star::frame::FrameAction;
|
|
|
|
using ::com::sun::star::frame::FrameAction_FRAME_ACTIVATED;
|
|
|
|
using ::com::sun::star::frame::FrameAction_FRAME_UI_ACTIVATED;
|
|
|
|
using ::com::sun::star::frame::FrameAction_FRAME_DEACTIVATING;
|
|
|
|
using ::com::sun::star::frame::FrameAction_FRAME_UI_DEACTIVATING;
|
|
|
|
using ::com::sun::star::frame::XModel;
|
|
|
|
using ::com::sun::star::frame::XController;
|
2008-10-16 01:57:26 -05:00
|
|
|
using ::com::sun::star::frame::XController2;
|
2008-03-06 11:28:21 -06:00
|
|
|
using ::com::sun::star::frame::XFramesSupplier;
|
|
|
|
using ::com::sun::star::sdb::XOfficeDatabaseDocument;
|
|
|
|
using ::com::sun::star::awt::XTopWindow;
|
|
|
|
using ::com::sun::star::awt::XTopWindowListener;
|
|
|
|
using ::com::sun::star::awt::XWindow2;
|
|
|
|
using ::com::sun::star::lang::DisposedException;
|
|
|
|
using ::com::sun::star::lang::EventObject;
|
2008-10-16 01:57:26 -05:00
|
|
|
using ::com::sun::star::document::XDocumentEventBroadcaster;
|
CWS-TOOLING: integrate CWS dba32j
2009-11-26 09:30:10 +0100 msc r277648 : #100000 fix urgent testscript error
2009-11-25 10:27:56 +0100 msc r277625 : #i100000 fix urgent testscript error
2009-11-17 22:16:46 +0100 fs r277544 : CWS-TOOLING: rebase CWS dba32j to branches/OOO320@277531 (milestone: OOO320:m5)
2009-11-17 14:26:47 +0100 fs r277535 : ooops, didn't mean to commit this uncommented line
2009-11-14 20:50:29 +0100 fs r277505 : add a --disable-pango switch to SM's configure options, and add a patch which makes certain code respect it (well, respect it better than currently, by not using some pango_x_* functions, which are not always available, even when pango itself is present)
2009-11-14 20:47:41 +0100 fs r277504 : spelling
2009-11-13 14:04:00 +0100 fs r277502 : #i100764# (commit approved by ab@openoffice.org): getModelFromBasic: do not start with the parent's parent when looking for ThisComponent, but walk up the anchestor chain, starting with the immediate parent
2009-11-13 11:04:15 +0100 fs r277496 : #i100764# better heuristics for determining whether or not to participate in the ThisComponent game
2009-11-13 11:02:30 +0100 fs r277495 : #i100764# set the WB_EXT_DOCUMENT style at the backing component's container window, when creating it without the TaskCreator (which would normally do this)
2009-11-11 13:49:11 +0100 fs r277452 : #i106816#
2009-11-11 13:48:53 +0100 fs r277451 : fix the CREATETARBAL target, which is expected to create the zips used as prebuilts. The *inc.zip missed the NSS files in case NSS was built externally
2009-11-11 12:15:34 +0100 fs r277449 : update ignore list
2009-11-11 12:09:23 +0100 fs r277448 : add a link to the Mozilla build tools download location
2009-11-11 12:07:16 +0100 fs r277447 : add a link to the Mozilla build tools download location
2009-11-06 16:23:12 +0100 fs r277393 : #i106643#
2009-11-03 23:20:29 +0100 fs r277328 : #i106574#
reverted the recent fix for issue #i105235#, and implemented a better one.
2009-11-02 12:59:48 +0100 fs r277294 : #i106550# errorOccured: also display the error when we're not in a nested form action - form actions are allowed to be triggered by other instances as well
2009-12-01 03:53:35 -06:00
|
|
|
using ::com::sun::star::awt::XWindow;
|
2008-03-06 11:28:21 -06:00
|
|
|
/** === end UNO using === **/
|
|
|
|
|
|
|
|
//====================================================================
|
|
|
|
//= FrameWindowActivationListener
|
|
|
|
//====================================================================
|
|
|
|
typedef ::cppu::WeakImplHelper1 < XTopWindowListener
|
|
|
|
> FrameWindowActivationListener_Base;
|
|
|
|
class FrameWindowActivationListener : public FrameWindowActivationListener_Base
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FrameWindowActivationListener( ControllerFrame_Data& _rData );
|
|
|
|
|
|
|
|
void dispose();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
~FrameWindowActivationListener();
|
|
|
|
|
|
|
|
// XTopWindowListener
|
|
|
|
virtual void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
// XEventListener
|
|
|
|
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void impl_checkDisposed_throw() const;
|
2008-12-09 01:25:38 -06:00
|
|
|
void impl_registerOnFrameContainerWindow_nothrow( bool _bRegister );
|
2008-03-06 11:28:21 -06:00
|
|
|
|
|
|
|
private:
|
|
|
|
ControllerFrame_Data* m_pData;
|
|
|
|
};
|
|
|
|
|
|
|
|
//====================================================================
|
|
|
|
//= ControllerFrame_Data
|
|
|
|
//====================================================================
|
|
|
|
struct ControllerFrame_Data
|
|
|
|
{
|
|
|
|
ControllerFrame_Data( IController& _rController )
|
|
|
|
:m_rController( _rController )
|
|
|
|
,m_xFrame()
|
2008-10-16 01:57:26 -05:00
|
|
|
,m_xDocEventBroadcaster()
|
2008-03-06 11:28:21 -06:00
|
|
|
,m_pListener()
|
|
|
|
,m_bActive( false )
|
CWS-TOOLING: integrate CWS dba32j
2009-11-26 09:30:10 +0100 msc r277648 : #100000 fix urgent testscript error
2009-11-25 10:27:56 +0100 msc r277625 : #i100000 fix urgent testscript error
2009-11-17 22:16:46 +0100 fs r277544 : CWS-TOOLING: rebase CWS dba32j to branches/OOO320@277531 (milestone: OOO320:m5)
2009-11-17 14:26:47 +0100 fs r277535 : ooops, didn't mean to commit this uncommented line
2009-11-14 20:50:29 +0100 fs r277505 : add a --disable-pango switch to SM's configure options, and add a patch which makes certain code respect it (well, respect it better than currently, by not using some pango_x_* functions, which are not always available, even when pango itself is present)
2009-11-14 20:47:41 +0100 fs r277504 : spelling
2009-11-13 14:04:00 +0100 fs r277502 : #i100764# (commit approved by ab@openoffice.org): getModelFromBasic: do not start with the parent's parent when looking for ThisComponent, but walk up the anchestor chain, starting with the immediate parent
2009-11-13 11:04:15 +0100 fs r277496 : #i100764# better heuristics for determining whether or not to participate in the ThisComponent game
2009-11-13 11:02:30 +0100 fs r277495 : #i100764# set the WB_EXT_DOCUMENT style at the backing component's container window, when creating it without the TaskCreator (which would normally do this)
2009-11-11 13:49:11 +0100 fs r277452 : #i106816#
2009-11-11 13:48:53 +0100 fs r277451 : fix the CREATETARBAL target, which is expected to create the zips used as prebuilts. The *inc.zip missed the NSS files in case NSS was built externally
2009-11-11 12:15:34 +0100 fs r277449 : update ignore list
2009-11-11 12:09:23 +0100 fs r277448 : add a link to the Mozilla build tools download location
2009-11-11 12:07:16 +0100 fs r277447 : add a link to the Mozilla build tools download location
2009-11-06 16:23:12 +0100 fs r277393 : #i106643#
2009-11-03 23:20:29 +0100 fs r277328 : #i106574#
reverted the recent fix for issue #i105235#, and implemented a better one.
2009-11-02 12:59:48 +0100 fs r277294 : #i106550# errorOccured: also display the error when we're not in a nested form action - form actions are allowed to be triggered by other instances as well
2009-12-01 03:53:35 -06:00
|
|
|
,m_bIsTopLevelDocumentWindow( false )
|
2008-03-06 11:28:21 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
IController& m_rController;
|
|
|
|
Reference< XFrame > m_xFrame;
|
2008-10-16 01:57:26 -05:00
|
|
|
Reference< XDocumentEventBroadcaster > m_xDocEventBroadcaster;
|
2008-03-06 11:28:21 -06:00
|
|
|
::rtl::Reference< FrameWindowActivationListener > m_pListener;
|
|
|
|
bool m_bActive;
|
CWS-TOOLING: integrate CWS dba32j
2009-11-26 09:30:10 +0100 msc r277648 : #100000 fix urgent testscript error
2009-11-25 10:27:56 +0100 msc r277625 : #i100000 fix urgent testscript error
2009-11-17 22:16:46 +0100 fs r277544 : CWS-TOOLING: rebase CWS dba32j to branches/OOO320@277531 (milestone: OOO320:m5)
2009-11-17 14:26:47 +0100 fs r277535 : ooops, didn't mean to commit this uncommented line
2009-11-14 20:50:29 +0100 fs r277505 : add a --disable-pango switch to SM's configure options, and add a patch which makes certain code respect it (well, respect it better than currently, by not using some pango_x_* functions, which are not always available, even when pango itself is present)
2009-11-14 20:47:41 +0100 fs r277504 : spelling
2009-11-13 14:04:00 +0100 fs r277502 : #i100764# (commit approved by ab@openoffice.org): getModelFromBasic: do not start with the parent's parent when looking for ThisComponent, but walk up the anchestor chain, starting with the immediate parent
2009-11-13 11:04:15 +0100 fs r277496 : #i100764# better heuristics for determining whether or not to participate in the ThisComponent game
2009-11-13 11:02:30 +0100 fs r277495 : #i100764# set the WB_EXT_DOCUMENT style at the backing component's container window, when creating it without the TaskCreator (which would normally do this)
2009-11-11 13:49:11 +0100 fs r277452 : #i106816#
2009-11-11 13:48:53 +0100 fs r277451 : fix the CREATETARBAL target, which is expected to create the zips used as prebuilts. The *inc.zip missed the NSS files in case NSS was built externally
2009-11-11 12:15:34 +0100 fs r277449 : update ignore list
2009-11-11 12:09:23 +0100 fs r277448 : add a link to the Mozilla build tools download location
2009-11-11 12:07:16 +0100 fs r277447 : add a link to the Mozilla build tools download location
2009-11-06 16:23:12 +0100 fs r277393 : #i106643#
2009-11-03 23:20:29 +0100 fs r277328 : #i106574#
reverted the recent fix for issue #i105235#, and implemented a better one.
2009-11-02 12:59:48 +0100 fs r277294 : #i106550# errorOccured: also display the error when we're not in a nested form action - form actions are allowed to be triggered by other instances as well
2009-12-01 03:53:35 -06:00
|
|
|
bool m_bIsTopLevelDocumentWindow;
|
2008-03-06 11:28:21 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
//====================================================================
|
|
|
|
//= helper
|
|
|
|
//====================================================================
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
static void lcl_setFrame_nothrow( ControllerFrame_Data& _rData, const Reference< XFrame >& _rxFrame )
|
|
|
|
{
|
|
|
|
// release old listener
|
|
|
|
if ( _rData.m_pListener.get() )
|
|
|
|
{
|
|
|
|
_rData.m_pListener->dispose();
|
|
|
|
_rData.m_pListener = NULL;
|
|
|
|
}
|
2008-10-16 01:57:26 -05:00
|
|
|
|
2008-03-06 11:28:21 -06:00
|
|
|
// remember new frame
|
|
|
|
_rData.m_xFrame = _rxFrame;
|
2008-10-16 01:57:26 -05:00
|
|
|
|
2008-03-06 11:28:21 -06:00
|
|
|
// create new listener
|
|
|
|
if ( _rData.m_xFrame.is() )
|
|
|
|
_rData.m_pListener = new FrameWindowActivationListener( _rData );
|
2008-10-16 01:57:26 -05:00
|
|
|
|
|
|
|
// at this point in time, we can assume the controller also has a model set, if it supports models
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XController > xController( _rData.m_rController.getXController(), UNO_SET_THROW );
|
|
|
|
Reference< XModel > xModel( xController->getModel() );
|
|
|
|
if ( xModel.is() )
|
|
|
|
_rData.m_xDocEventBroadcaster.set( xModel, UNO_QUERY );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
2008-03-06 11:28:21 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
static bool lcl_isActive_nothrow( const Reference< XFrame >& _rxFrame )
|
|
|
|
{
|
|
|
|
bool bIsActive = false;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if ( _rxFrame.is() )
|
|
|
|
{
|
|
|
|
Reference< XWindow2 > xWindow( _rxFrame->getContainerWindow(), UNO_QUERY_THROW );
|
|
|
|
bIsActive = xWindow->isActive();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
return bIsActive;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
/** updates various global and local states with a new active component
|
|
|
|
|
|
|
|
In particular, the following are updated
|
|
|
|
* the global working document (aka Basic's ThisComponent in the application
|
|
|
|
Basic), with our controller's model, or the controller itself if there is no such
|
|
|
|
model.
|
|
|
|
*/
|
|
|
|
static void lcl_updateActiveComponents_nothrow( const ControllerFrame_Data& _rData )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XController > xCompController( _rData.m_rController.getXController() );
|
|
|
|
OSL_ENSURE( xCompController.is(), "lcl_updateActiveComponents_nothrow: can't do anything without a controller!" );
|
|
|
|
if ( !xCompController.is() )
|
|
|
|
return;
|
|
|
|
|
CWS-TOOLING: integrate CWS dba32j
2009-11-26 09:30:10 +0100 msc r277648 : #100000 fix urgent testscript error
2009-11-25 10:27:56 +0100 msc r277625 : #i100000 fix urgent testscript error
2009-11-17 22:16:46 +0100 fs r277544 : CWS-TOOLING: rebase CWS dba32j to branches/OOO320@277531 (milestone: OOO320:m5)
2009-11-17 14:26:47 +0100 fs r277535 : ooops, didn't mean to commit this uncommented line
2009-11-14 20:50:29 +0100 fs r277505 : add a --disable-pango switch to SM's configure options, and add a patch which makes certain code respect it (well, respect it better than currently, by not using some pango_x_* functions, which are not always available, even when pango itself is present)
2009-11-14 20:47:41 +0100 fs r277504 : spelling
2009-11-13 14:04:00 +0100 fs r277502 : #i100764# (commit approved by ab@openoffice.org): getModelFromBasic: do not start with the parent's parent when looking for ThisComponent, but walk up the anchestor chain, starting with the immediate parent
2009-11-13 11:04:15 +0100 fs r277496 : #i100764# better heuristics for determining whether or not to participate in the ThisComponent game
2009-11-13 11:02:30 +0100 fs r277495 : #i100764# set the WB_EXT_DOCUMENT style at the backing component's container window, when creating it without the TaskCreator (which would normally do this)
2009-11-11 13:49:11 +0100 fs r277452 : #i106816#
2009-11-11 13:48:53 +0100 fs r277451 : fix the CREATETARBAL target, which is expected to create the zips used as prebuilts. The *inc.zip missed the NSS files in case NSS was built externally
2009-11-11 12:15:34 +0100 fs r277449 : update ignore list
2009-11-11 12:09:23 +0100 fs r277448 : add a link to the Mozilla build tools download location
2009-11-11 12:07:16 +0100 fs r277447 : add a link to the Mozilla build tools download location
2009-11-06 16:23:12 +0100 fs r277393 : #i106643#
2009-11-03 23:20:29 +0100 fs r277328 : #i106574#
reverted the recent fix for issue #i105235#, and implemented a better one.
2009-11-02 12:59:48 +0100 fs r277294 : #i106550# errorOccured: also display the error when we're not in a nested form action - form actions are allowed to be triggered by other instances as well
2009-12-01 03:53:35 -06:00
|
|
|
if ( _rData.m_bActive && _rData.m_bIsTopLevelDocumentWindow )
|
2008-03-06 11:28:21 -06:00
|
|
|
{
|
|
|
|
// set the "current component" at the SfxObjectShell
|
|
|
|
Reference< XModel > xModel( xCompController->getModel() );
|
|
|
|
Reference< XInterface > xCurrentComponent;
|
|
|
|
if ( xModel.is() )
|
|
|
|
xCurrentComponent = xModel;
|
|
|
|
else
|
|
|
|
xCurrentComponent = xCompController;
|
|
|
|
SfxObjectShell::SetCurrentComponent( xCurrentComponent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-16 01:57:26 -05:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
/** broadcasts the OnFocus resp. OnUnfocus event
|
|
|
|
*/
|
|
|
|
static void lcl_notifyFocusChange_nothrow( ControllerFrame_Data& _rData, bool _bActive )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if ( _rData.m_xDocEventBroadcaster.is() )
|
|
|
|
{
|
2010-11-13 15:19:14 -06:00
|
|
|
::rtl::OUString sEventName = _bActive ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnFocus")) : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnUnfocus"));
|
2008-10-16 01:57:26 -05:00
|
|
|
Reference< XController2 > xController( _rData.m_rController.getXController(), UNO_QUERY_THROW );
|
|
|
|
_rData.m_xDocEventBroadcaster->notifyDocumentEvent( sEventName, xController, Any() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:28:21 -06:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
static void lcl_updateActive_nothrow( ControllerFrame_Data& _rData, bool _bActive )
|
|
|
|
{
|
|
|
|
if ( _rData.m_bActive == _bActive )
|
|
|
|
return;
|
|
|
|
_rData.m_bActive = _bActive;
|
|
|
|
|
|
|
|
lcl_updateActiveComponents_nothrow( _rData );
|
2008-10-16 01:57:26 -05:00
|
|
|
lcl_notifyFocusChange_nothrow( _rData, _bActive );
|
2008-03-06 11:28:21 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
FrameWindowActivationListener::FrameWindowActivationListener( ControllerFrame_Data& _rData )
|
|
|
|
:m_pData( &_rData )
|
|
|
|
{
|
2008-12-09 01:25:38 -06:00
|
|
|
impl_registerOnFrameContainerWindow_nothrow( true );
|
2008-03-06 11:28:21 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
FrameWindowActivationListener::~FrameWindowActivationListener()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void FrameWindowActivationListener::dispose()
|
|
|
|
{
|
2008-12-09 01:25:38 -06:00
|
|
|
impl_registerOnFrameContainerWindow_nothrow( false );
|
2008-03-06 11:28:21 -06:00
|
|
|
m_pData = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2008-12-09 01:25:38 -06:00
|
|
|
void FrameWindowActivationListener::impl_registerOnFrameContainerWindow_nothrow( bool _bRegister )
|
2008-03-06 11:28:21 -06:00
|
|
|
{
|
2008-12-09 01:25:38 -06:00
|
|
|
OSL_ENSURE( m_pData && m_pData->m_xFrame.is(), "FrameWindowActivationListener::impl_registerOnFrameContainerWindow_nothrow: no frame!" );
|
2008-03-06 11:28:21 -06:00
|
|
|
if ( !m_pData || !m_pData->m_xFrame.is() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
void ( SAL_CALL XTopWindow::*pListenerAction )( const Reference< XTopWindowListener >& ) =
|
|
|
|
_bRegister ? &XTopWindow::addTopWindowListener : &XTopWindow::removeTopWindowListener;
|
|
|
|
|
CWS-TOOLING: integrate CWS dba32j
2009-11-26 09:30:10 +0100 msc r277648 : #100000 fix urgent testscript error
2009-11-25 10:27:56 +0100 msc r277625 : #i100000 fix urgent testscript error
2009-11-17 22:16:46 +0100 fs r277544 : CWS-TOOLING: rebase CWS dba32j to branches/OOO320@277531 (milestone: OOO320:m5)
2009-11-17 14:26:47 +0100 fs r277535 : ooops, didn't mean to commit this uncommented line
2009-11-14 20:50:29 +0100 fs r277505 : add a --disable-pango switch to SM's configure options, and add a patch which makes certain code respect it (well, respect it better than currently, by not using some pango_x_* functions, which are not always available, even when pango itself is present)
2009-11-14 20:47:41 +0100 fs r277504 : spelling
2009-11-13 14:04:00 +0100 fs r277502 : #i100764# (commit approved by ab@openoffice.org): getModelFromBasic: do not start with the parent's parent when looking for ThisComponent, but walk up the anchestor chain, starting with the immediate parent
2009-11-13 11:04:15 +0100 fs r277496 : #i100764# better heuristics for determining whether or not to participate in the ThisComponent game
2009-11-13 11:02:30 +0100 fs r277495 : #i100764# set the WB_EXT_DOCUMENT style at the backing component's container window, when creating it without the TaskCreator (which would normally do this)
2009-11-11 13:49:11 +0100 fs r277452 : #i106816#
2009-11-11 13:48:53 +0100 fs r277451 : fix the CREATETARBAL target, which is expected to create the zips used as prebuilts. The *inc.zip missed the NSS files in case NSS was built externally
2009-11-11 12:15:34 +0100 fs r277449 : update ignore list
2009-11-11 12:09:23 +0100 fs r277448 : add a link to the Mozilla build tools download location
2009-11-11 12:07:16 +0100 fs r277447 : add a link to the Mozilla build tools download location
2009-11-06 16:23:12 +0100 fs r277393 : #i106643#
2009-11-03 23:20:29 +0100 fs r277328 : #i106574#
reverted the recent fix for issue #i105235#, and implemented a better one.
2009-11-02 12:59:48 +0100 fs r277294 : #i106550# errorOccured: also display the error when we're not in a nested form action - form actions are allowed to be triggered by other instances as well
2009-12-01 03:53:35 -06:00
|
|
|
const Reference< XWindow > xContainerWindow( m_pData->m_xFrame->getContainerWindow(), UNO_SET_THROW );
|
2008-12-09 01:25:38 -06:00
|
|
|
if ( _bRegister )
|
CWS-TOOLING: integrate CWS dba32j
2009-11-26 09:30:10 +0100 msc r277648 : #100000 fix urgent testscript error
2009-11-25 10:27:56 +0100 msc r277625 : #i100000 fix urgent testscript error
2009-11-17 22:16:46 +0100 fs r277544 : CWS-TOOLING: rebase CWS dba32j to branches/OOO320@277531 (milestone: OOO320:m5)
2009-11-17 14:26:47 +0100 fs r277535 : ooops, didn't mean to commit this uncommented line
2009-11-14 20:50:29 +0100 fs r277505 : add a --disable-pango switch to SM's configure options, and add a patch which makes certain code respect it (well, respect it better than currently, by not using some pango_x_* functions, which are not always available, even when pango itself is present)
2009-11-14 20:47:41 +0100 fs r277504 : spelling
2009-11-13 14:04:00 +0100 fs r277502 : #i100764# (commit approved by ab@openoffice.org): getModelFromBasic: do not start with the parent's parent when looking for ThisComponent, but walk up the anchestor chain, starting with the immediate parent
2009-11-13 11:04:15 +0100 fs r277496 : #i100764# better heuristics for determining whether or not to participate in the ThisComponent game
2009-11-13 11:02:30 +0100 fs r277495 : #i100764# set the WB_EXT_DOCUMENT style at the backing component's container window, when creating it without the TaskCreator (which would normally do this)
2009-11-11 13:49:11 +0100 fs r277452 : #i106816#
2009-11-11 13:48:53 +0100 fs r277451 : fix the CREATETARBAL target, which is expected to create the zips used as prebuilts. The *inc.zip missed the NSS files in case NSS was built externally
2009-11-11 12:15:34 +0100 fs r277449 : update ignore list
2009-11-11 12:09:23 +0100 fs r277448 : add a link to the Mozilla build tools download location
2009-11-11 12:07:16 +0100 fs r277447 : add a link to the Mozilla build tools download location
2009-11-06 16:23:12 +0100 fs r277393 : #i106643#
2009-11-03 23:20:29 +0100 fs r277328 : #i106574#
reverted the recent fix for issue #i105235#, and implemented a better one.
2009-11-02 12:59:48 +0100 fs r277294 : #i106550# errorOccured: also display the error when we're not in a nested form action - form actions are allowed to be triggered by other instances as well
2009-12-01 03:53:35 -06:00
|
|
|
{
|
|
|
|
const Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
|
|
|
|
ENSURE_OR_THROW( pContainerWindow, "no Window implementation for the frame's container window!" );
|
|
|
|
|
|
|
|
m_pData->m_bIsTopLevelDocumentWindow = ( pContainerWindow->GetExtendedStyle() & WB_EXT_DOCUMENT ) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Reference< XTopWindow > xFrameContainer( xContainerWindow, UNO_QUERY );
|
2008-12-09 01:25:38 -06:00
|
|
|
if ( xFrameContainer.is() )
|
|
|
|
(xFrameContainer.get()->*pListenerAction)( this );
|
2008-03-06 11:28:21 -06:00
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void FrameWindowActivationListener::impl_checkDisposed_throw() const
|
|
|
|
{
|
|
|
|
if ( !m_pData )
|
|
|
|
throw DisposedException( ::rtl::OUString(), *const_cast< FrameWindowActivationListener* >( this ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void SAL_CALL FrameWindowActivationListener::windowOpened( const EventObject& /*_rEvent*/ ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
// not interested in
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void SAL_CALL FrameWindowActivationListener::windowClosing( const EventObject& /*_rEvent*/ ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
// not interested in
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void SAL_CALL FrameWindowActivationListener::windowClosed( const EventObject& /*_rEvent*/ ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
// not interested in
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void SAL_CALL FrameWindowActivationListener::windowMinimized( const EventObject& /*_rEvent*/ ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
// not interested in
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void SAL_CALL FrameWindowActivationListener::windowNormalized( const EventObject& /*_rEvent*/ ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
// not interested in
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void SAL_CALL FrameWindowActivationListener::windowActivated( const EventObject& /*_rEvent*/ ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
impl_checkDisposed_throw();
|
|
|
|
lcl_updateActive_nothrow( *m_pData, true );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void SAL_CALL FrameWindowActivationListener::windowDeactivated( const EventObject& /*_rEvent*/ ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
impl_checkDisposed_throw();
|
|
|
|
lcl_updateActive_nothrow( *m_pData, false );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void SAL_CALL FrameWindowActivationListener::disposing( const EventObject& /*_rEvent*/ ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
//====================================================================
|
|
|
|
//= ControllerFrame
|
|
|
|
//====================================================================
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
ControllerFrame::ControllerFrame( IController& _rController )
|
|
|
|
:m_pData( new ControllerFrame_Data( _rController ) )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
ControllerFrame::~ControllerFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
const Reference< XFrame >& ControllerFrame::attachFrame( const Reference< XFrame >& _rxFrame )
|
|
|
|
{
|
|
|
|
// set new frame, including listener handling
|
|
|
|
lcl_setFrame_nothrow( *m_pData, _rxFrame );
|
|
|
|
|
|
|
|
// determine whether we're active
|
|
|
|
m_pData->m_bActive = lcl_isActive_nothrow( m_pData->m_xFrame );
|
|
|
|
|
|
|
|
// update active component
|
|
|
|
if ( m_pData->m_bActive )
|
2008-10-16 01:57:26 -05:00
|
|
|
{
|
2008-03-06 11:28:21 -06:00
|
|
|
lcl_updateActiveComponents_nothrow( *m_pData );
|
2008-10-16 01:57:26 -05:00
|
|
|
lcl_notifyFocusChange_nothrow( *m_pData, true );
|
|
|
|
}
|
2008-03-06 11:28:21 -06:00
|
|
|
|
|
|
|
return m_pData->m_xFrame;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
const Reference< XFrame >& ControllerFrame::getFrame() const
|
|
|
|
{
|
|
|
|
return m_pData->m_xFrame;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
bool ControllerFrame::isActive() const
|
|
|
|
{
|
|
|
|
return m_pData->m_bActive;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void ControllerFrame::frameAction( FrameAction _eAction )
|
|
|
|
{
|
|
|
|
bool bActive = m_pData->m_bActive;
|
|
|
|
|
|
|
|
switch ( _eAction )
|
|
|
|
{
|
|
|
|
case FrameAction_FRAME_ACTIVATED:
|
|
|
|
case FrameAction_FRAME_UI_ACTIVATED:
|
|
|
|
bActive = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FrameAction_FRAME_DEACTIVATING:
|
|
|
|
case FrameAction_FRAME_UI_DEACTIVATING:
|
|
|
|
bActive = false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
lcl_updateActive_nothrow( *m_pData, bActive );
|
|
|
|
}
|
|
|
|
|
|
|
|
//........................................................................
|
|
|
|
} // namespace dbaui
|
|
|
|
//........................................................................
|
2010-10-12 08:59:03 -05:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|