diff options
Diffstat (limited to 'dbaccess/source/ui')
-rw-r--r-- | dbaccess/source/ui/app/AppController.cxx | 27 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppController.hxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/dataview.cxx | 23 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/documentcontroller.cxx | 150 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/makefile.mk | 1 |
5 files changed, 45 insertions, 164 deletions
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index b87b7706d87f..91efd04e5daa 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -534,7 +534,8 @@ void SAL_CALL OApplicationController::disposing() } } - m_aModelConnector.clear(); + m_xModel->disconnectController( this ); + m_xModel.clear(); } } @@ -614,7 +615,6 @@ void SAL_CALL OApplicationController::disposing(const EventObject& _rSource) thr else if ( _rSource.Source == m_xModel ) { m_xModel.clear(); - m_aModelConnector.clear(); } else if ( _rSource.Source == m_xDataSource ) { @@ -2675,7 +2675,7 @@ Reference< XModel > SAL_CALL OApplicationController::getModel(void) throw( Runt } // ----------------------------------------------------------------------------- -void OApplicationController::onConnectedModel() +void OApplicationController::onAttachedFrame() { sal_Int32 nConnectedControllers( 0 ); try @@ -2704,9 +2704,15 @@ void OApplicationController::onConnectedModel() // ----------------------------------------------------------------------------- IMPL_LINK( OApplicationController, OnFirstControllerConnected, void*, /**/ ) { + ::osl::MutexGuard aGuard( getMutex() ); + + if ( !m_xModel.is() ) + { + OSL_ENSURE( false, "OApplicationController::OnFirstControllerConnected: too late!" ); + } + // if we have forms or reports which contain macros/scripts, then show a warning // which suggests the user to migrate them to the database document - Reference< XEmbeddedScripts > xDocumentScripts( m_xModel, UNO_QUERY ); if ( xDocumentScripts.is() ) { @@ -2752,6 +2758,14 @@ IMPL_LINK( OApplicationController, OnFirstControllerConnected, void*, /**/ ) } // ----------------------------------------------------------------------------- +void SAL_CALL OApplicationController::attachFrame( const Reference< XFrame > & i_rxFrame ) throw( RuntimeException ) +{ + OApplicationController_CBASE::attachFrame( i_rxFrame ); + if ( getFrame().is() ) + onAttachedFrame(); +} + +// ----------------------------------------------------------------------------- sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > & _rxModel) throw( RuntimeException ) { ::osl::MutexGuard aGuard( getMutex() ); @@ -2767,16 +2781,13 @@ sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > // at least: remove as property change listener from the old model/data source m_xModel = _rxModel; - if ( _rxModel.is() ) + if ( m_xModel.is() ) { m_xDocumentModify.set( m_xModel, UNO_QUERY_THROW ); - m_aModelConnector.connect( _rxModel, this ); - onConnectedModel(); } else { m_xDocumentModify.clear(); - m_aModelConnector.clear(); } m_xDataSource.set(xOfficeDoc.is() ? xOfficeDoc->getDataSource() : Reference<XDataSource>(),UNO_QUERY); diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx index 96ca58d6f428..669eb181d3e3 100644 --- a/dbaccess/source/ui/app/AppController.hxx +++ b/dbaccess/source/ui/app/AppController.hxx @@ -35,7 +35,6 @@ #include "AppElementType.hxx" #include "callbacks.hxx" #include "commontypes.hxx" -#include "documentcontroller.hxx" #include "dsntypes.hxx" #include "genericcontroller.hxx" #include "linkeddocuments.hxx" @@ -123,8 +122,6 @@ namespace dbaui ::cppu::OInterfaceContainerHelper m_aContextMenuInterceptors; - ModelControllerConnector - m_aModelConnector; TContainerVector m_aCurrentContainers; // the containers where we are listener on ::rtl::Reference< SubComponentManager > m_pSubComponentManager; @@ -396,12 +393,12 @@ namespace dbaui */ void showPreviewFor( const ElementType _eType,const ::rtl::OUString& _sName ); - /** called when we just connected to a new, non-NULL model + /** called we were attached to a frame In particular, this is called *after* the controller has been announced to the model (XModel::connectController) */ - void onConnectedModel(); + void onAttachedFrame(); /// determines whether the given table name denotes a view which can be altered bool impl_isAlterableView_nothrow( const ::rtl::OUString& _rTableOrViewName ) const; @@ -455,6 +452,7 @@ namespace dbaui SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&); // ::com::sun::star::frame::XController + virtual void SAL_CALL attachFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & xFrame) throw( ::com::sun::star::uno::RuntimeException ); virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException ); virtual sal_Bool SAL_CALL attachModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel) throw( ::com::sun::star::uno::RuntimeException ); virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL getModel(void) throw( ::com::sun::star::uno::RuntimeException ); diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx index 538925125425..a66f6ec6d11a 100644 --- a/dbaccess/source/ui/browser/dataview.cxx +++ b/dbaccess/source/ui/browser/dataview.cxx @@ -40,6 +40,7 @@ #ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> #endif +#include <comphelper/namedvaluecollection.hxx> #ifndef _SFXAPP_HXX //autogen wg. SFX_APP #include <sfx2/app.hxx> #endif @@ -61,6 +62,7 @@ #ifndef _SVTOOLS_IMGDEF_HXX #include <svtools/imgdef.hxx> #endif +#include <tools/diagnose_ex.h> //......................................................................... namespace dbaui @@ -221,6 +223,27 @@ namespace dbaui // Check if we need to get new images for normal/high contrast mode m_rController.notifyHiContrastChanged(); } + + if ( nType == STATE_CHANGE_INITSHOW ) + { + // now that there's a view which is finally visible, remove the "Hidden" value from the + // model's arguments. + try + { + Reference< XController > xController( m_rController.getXController(), UNO_SET_THROW ); + Reference< XModel > xModel( xController->getModel(), UNO_QUERY ); + if ( xModel.is() ) + { + ::comphelper::NamedValueCollection aArgs( xModel->getArgs() ); + aArgs.remove( "Hidden" ); + xModel->attachResource( xModel->getURL(), aArgs.getPropertyValues() ); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } } // ----------------------------------------------------------------------------- void ODataView::DataChanged( const DataChangedEvent& rDCEvt ) diff --git a/dbaccess/source/ui/misc/documentcontroller.cxx b/dbaccess/source/ui/misc/documentcontroller.cxx deleted file mode 100644 index 523307d55013..000000000000 --- a/dbaccess/source/ui/misc/documentcontroller.cxx +++ /dev/null @@ -1,150 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: documentcontroller.cxx,v $ - * $Revision: 1.5.178.4 $ - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dbaccess.hxx" - -#include "documentcontroller.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include <tools/debug.hxx> -#include <tools/diagnose_ex.h> - -//........................................................................ -namespace dbaui -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::frame; - - //==================================================================== - //= ModelControllerConnector - //==================================================================== - DBG_NAME( ModelControllerConnector ) - //-------------------------------------------------------------------- - ModelControllerConnector::ModelControllerConnector() - { - DBG_CTOR( ModelControllerConnector, NULL ); - } - - //-------------------------------------------------------------------- - ModelControllerConnector::ModelControllerConnector( const Reference< XModel >& _rxModel, const Reference< XController >& _rxController ) - :m_xModel( _rxModel ) - ,m_xController( _rxController ) - { - DBG_CTOR( ModelControllerConnector, NULL ); - DBG_ASSERT( _rxModel.is() && m_xController.is(), "ModelControllerConnector::ModelControllerConnector: invalid model or controller!" ); - impl_connect(); - } - - //-------------------------------------------------------------------- - ModelControllerConnector::ModelControllerConnector( const ModelControllerConnector& _rSource ) - { - DBG_CTOR( ModelControllerConnector, NULL ); - impl_copyFrom( _rSource ); - } - - //-------------------------------------------------------------------- - ModelControllerConnector& ModelControllerConnector::operator=( const ModelControllerConnector& _rSource ) - { - if ( this != &_rSource ) - impl_copyFrom( _rSource ); - return *this; - } - - //-------------------------------------------------------------------- - void ModelControllerConnector::connect( const Reference< XModel >& _rxModel, const Reference< XController >& _rxController ) - { - impl_disconnect(); - - m_xModel = _rxModel; - m_xController = _rxController; - - impl_connect(); - } - - //-------------------------------------------------------------------- - void ModelControllerConnector::impl_copyFrom( const ModelControllerConnector& _rSource ) - { - Model aNewModel( _rSource.m_xModel ); - Controller aNewController( _rSource.m_xController ); - - impl_disconnect(); - - m_xModel = aNewModel; - m_xController = aNewController; - - impl_connect(); - } - - //-------------------------------------------------------------------- - ModelControllerConnector::~ModelControllerConnector() - { - impl_disconnect(); - DBG_DTOR( ModelControllerConnector, NULL ); - } - - //-------------------------------------------------------------------- - void ModelControllerConnector::impl_connect() - { - try - { - Reference< XModel > xModel = m_xModel; - if ( xModel.is() && m_xController.is() ) - xModel->connectController( m_xController ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - void ModelControllerConnector::impl_disconnect() - { - try - { - Reference< XModel > xModel = m_xModel; - if ( xModel.is() && m_xController.is() ) - xModel->disconnectController( m_xController ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - -//........................................................................ -} // namespace dbaui -//........................................................................ - diff --git a/dbaccess/source/ui/misc/makefile.mk b/dbaccess/source/ui/misc/makefile.mk index e5db6954ea4d..f0d2ad133fff 100644 --- a/dbaccess/source/ui/misc/makefile.mk +++ b/dbaccess/source/ui/misc/makefile.mk @@ -76,7 +76,6 @@ SLOFILES= \ $(SLO)$/WColumnSelect.obj \ $(SLO)$/WExtendPages.obj \ $(SLO)$/WNameMatch.obj \ - $(SLO)$/documentcontroller.obj \ $(SLO)$/ToolBoxHelper.obj \ $(SLO)$/stringlistitem.obj \ $(SLO)$/charsets.obj \ |