Tag: cws_src680_odbmacros2 User: fs Date: 2007-12-18 21:24:53+0000 Modified: dba/dbaccess/source/ui/misc/controllerframe.cxx
Log: #i49133# set the XController as CurrentComponent (i.e. AppBasic's ThisComponent) if it has no model File Changes: Directory: /dba/dbaccess/source/ui/misc/ ======================================== File [changed]: controllerframe.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/controllerframe.cxx?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +26 -7 -------------------- --- controllerframe.cxx 2007-12-13 11:20:32+0000 1.1.2.1 +++ controllerframe.cxx 2007-12-18 21:24:51+0000 1.1.2.2 @@ -4,9 +4,9 @@ * * $RCSfile: controllerframe.cxx,v $ * - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * - * last change: $Author: fs $ $Date: 2007/12/13 11:20:32 $ + * last change: $Author: fs $ $Date: 2007/12/18 21:24:51 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -63,6 +63,7 @@ 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; /** === end UNO using === **/ //==================================================================== @@ -87,13 +88,31 @@ { static void lcl_updateWorkingDocument( const ControllerFrame_Data& _rData ) { - Reference< XModel > xWorkingDocument; + Reference< XController > xController( _rData.m_rController.getXController() ); + Reference< XModel > xModel; + if ( xController.is() ) + xModel = xController->getModel(); + if ( _rData.m_bActive ) { - xWorkingDocument.set( _rData.m_rController.getAssociatedModel() ); - OSL_ENSURE( xWorkingDocument.is(), "lcl_updateWorkingDocument: no associated model!" ); + Reference< XInterface > xCurrentComponent; + if ( xModel.is() ) + xCurrentComponent = xModel; + else if ( xController.is() ) + xCurrentComponent = xController; + + OSL_ENSURE( xCurrentComponent.is(), "lcl_updateWorkingDocument: no model *and* no controller!?" ); + if ( xCurrentComponent.is() ) + SfxObjectShell::SetCurrentComponent( xCurrentComponent ); + } + else + { + Reference< XInterface > xCurrentComponent = SfxObjectShell::GetCurrentComponent(); + if ( ( xModel.is() && ( xModel == xCurrentComponent ) ) + || ( xController.is() && ( xController == xCurrentComponent ) ) + ) + SfxObjectShell::SetCurrentComponent( Reference< XInterface >() ); } - SfxObjectShell::SetWorkingDocument( xWorkingDocument ); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
