diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-02-19 13:52:10 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-02-19 13:52:10 +0100 |
commit | eb03a387b1a95b8b4e5eea60c2b7c9c40d71597b (patch) | |
tree | 339352b2da9ebbccf19f05664010c954ca218c37 /dbaccess/source/ui | |
parent | ade45fff47747bf3774b49d923b37ce9a02a178f (diff) | |
parent | f134b69089fb4f37f987b28e08f1b9aa48311926 (diff) |
Automated merge with ssh://hg@hg.services.openoffice.org/cws/dba33e
Diffstat (limited to 'dbaccess/source/ui')
43 files changed, 1321 insertions, 1371 deletions
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index e29ce4e6901a..dbe5f54733fc 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -78,6 +78,7 @@ #include <com/sun/star/sdb/application/DatabaseObject.hpp> #include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp> #include <com/sun/star/document/XDocumentEventBroadcaster.hpp> +#include <com/sun/star/container/XHierarchicalName.hpp> /** === end UNO includes === **/ #include <tools/debug.hxx> #include <tools/diagnose_ex.h> @@ -344,8 +345,8 @@ OApplicationController::~OApplicationController() osl_incrementInterlockedCount( &m_refCount ); dispose(); } - ::std::auto_ptr< Window> aTemp(m_pView); - m_pView = NULL; + ::std::auto_ptr< Window> aTemp( getView() ); + clearView(); DBG_DTOR(OApplicationController,NULL); } @@ -444,7 +445,8 @@ void SAL_CALL OApplicationController::disposing() } } - m_aModelConnector.clear(); + m_xModel->disconnectController( this ); + m_xModel.clear(); } } @@ -453,15 +455,15 @@ void SAL_CALL OApplicationController::disposing() DBG_UNHANDLED_EXCEPTION(); } - m_pView = NULL; + clearView(); OApplicationController_CBASE::disposing(); // here the m_refCount must be equal 5 } //-------------------------------------------------------------------- sal_Bool OApplicationController::Construct(Window* _pParent) { - m_pView = new OApplicationView( _pParent, getORB(), *this, m_ePreviewMode ); - m_pView->SetUniqueId(UID_APP_VIEW); + setView( * new OApplicationView( _pParent, getORB(), *this, m_ePreviewMode ) ); + getView()->SetUniqueId(UID_APP_VIEW); // late construction sal_Bool bSuccess = sal_False; @@ -480,8 +482,8 @@ sal_Bool OApplicationController::Construct(Window* _pParent) if ( !bSuccess ) { - ::std::auto_ptr< Window> aTemp(m_pView); - m_pView = NULL; + ::std::auto_ptr< Window> aTemp( getView() ); + clearView(); return sal_False; } @@ -510,8 +512,8 @@ void SAL_CALL OApplicationController::disposing(const EventObject& _rSource) thr Reference<XConnection> xCon(_rSource.Source, UNO_QUERY); if ( xCon.is() ) { - DBG_ASSERT( ( m_xDataSourceConnection == xCon ) && getContainer() && ( getContainer()->getElementType() == E_TABLE ), - "OApplicationController::disposing: the below code will ignore this call - why?" ); + DBG_ASSERT( m_xDataSourceConnection == xCon, + "OApplicationController::disposing: which connection does this come from?" ); if ( getContainer() && getContainer()->getElementType() == E_TABLE ) getContainer()->clearPages(); @@ -524,7 +526,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 ) { @@ -1244,7 +1245,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa { ElementType eType = E_TABLE; sal_Bool bAutoPilot = sal_False; - sal_Bool bSQLView = sal_False; + ::comphelper::NamedValueCollection aCreationArgs; switch( _nId ) { @@ -1267,10 +1268,10 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa bAutoPilot = sal_True; eType = E_QUERY; break; - case ID_NEW_QUERY_SQL: - bSQLView = sal_True; - // run through case ID_NEW_QUERY_DESIGN: + aCreationArgs.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, sal_True ); + // run through + case ID_NEW_QUERY_SQL: eType = E_QUERY; break; case ID_NEW_TABLE_DESIGN_AUTO_PILOT: @@ -1284,7 +1285,10 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa if ( bAutoPilot ) getContainer()->PostUserEvent( LINK( this, OApplicationController, OnCreateWithPilot ), reinterpret_cast< void* >( eType ) ); else - newElement( eType, bSQLView ); + { + Reference< XComponent > xDocDefinition; + newElement( eType, aCreationArgs, xDocDefinition ); + } } break; case SID_APP_NEW_FOLDER: @@ -1300,10 +1304,13 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa SharedConnection xConnection( ensureConnection() ); if ( xConnection.is() ) { - QueryDesigner aDesigner( getORB(), this, getFrame(), true, SID_DB_NEW_VIEW_SQL == _nId ); + QueryDesigner aDesigner( getORB(), this, getFrame(), true ); + + ::comphelper::NamedValueCollection aCreationArgs; + aCreationArgs.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, ID_NEW_VIEW_DESIGN == _nId ); Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); - Reference< XComponent > xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY ); + Reference< XComponent > xComponent( aDesigner.createNew( xDataSource, aCreationArgs ), UNO_QUERY ); onDocumentOpened( ::rtl::OUString(), E_QUERY, E_OPEN_DESIGN, xComponent, NULL ); } } @@ -1842,14 +1849,17 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const case E_REPORT: case E_FORM: { - ::std::auto_ptr< OLinkedDocumentsAccess > aHelper = getDocumentsAccess( _eType ); - if ( !aHelper->isConnected() ) - break; + if ( !m_pSubComponentManager->activateSubFrame( _sName, _eType, _eOpenMode ) ) + { + ::std::auto_ptr< OLinkedDocumentsAccess > aHelper = getDocumentsAccess( _eType ); + if ( !aHelper->isConnected() ) + break; - Reference< XComponent > xDefinition; - xRet = aHelper->open( _sName, xDefinition, _eOpenMode, _rAdditionalArguments ); + Reference< XComponent > xDefinition; + xRet = aHelper->open( _sName, xDefinition, _eOpenMode, _rAdditionalArguments ); - onDocumentOpened( _sName, _eType, _eOpenMode, xRet, xDefinition ); + onDocumentOpened( _sName, _eType, _eOpenMode, xRet, xDefinition ); + } } break; @@ -1868,20 +1878,33 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const Any aDataSource; if ( _eOpenMode == E_OPEN_DESIGN ) { - sal_Bool bQuerySQLMode =( _nInstigatorCommand == SID_DB_APP_EDIT_SQL_VIEW ); + bool bAddViewTypeArg = false; if ( _eType == E_TABLE ) { if ( impl_isAlterableView_nothrow( _sName ) ) - pDesigner.reset( new QueryDesigner( getORB(), this, m_aCurrentFrame.getFrame(), true, bQuerySQLMode ) ); + { + pDesigner.reset( new QueryDesigner( getORB(), this, m_aCurrentFrame.getFrame(), true ) ); + bAddViewTypeArg = true; + } else + { pDesigner.reset( new TableDesigner( getORB(), this, m_aCurrentFrame.getFrame() ) ); + } } else if ( _eType == E_QUERY ) { - pDesigner.reset( new QueryDesigner( getORB(), this, m_aCurrentFrame.getFrame(), false, bQuerySQLMode ) ); + pDesigner.reset( new QueryDesigner( getORB(), this, m_aCurrentFrame.getFrame(), false ) ); + bAddViewTypeArg = true; } aDataSource <<= m_xDataSource; + + if ( bAddViewTypeArg ) + { + const bool bQueryGraphicalMode =( _nInstigatorCommand != SID_DB_APP_EDIT_SQL_VIEW ); + aArguments.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, bQueryGraphicalMode ); + } + } else { @@ -1893,7 +1916,7 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const aDataSource <<= getDatabaseName(); } - xRet.set( pDesigner->openExisting( aDataSource, _sName, aArguments.getPropertyValues() ) ); + xRet.set( pDesigner->openExisting( aDataSource, _sName, aArguments ) ); onDocumentOpened( _sName, _eType, _eOpenMode, xRet, NULL ); } } @@ -1934,14 +1957,11 @@ void OApplicationController::newElementWithPilot( ElementType _eType ) if ( aHelper->isConnected() ) { sal_Int32 nCommandType = -1; - const ::rtl::OUString sName(getCurrentlySelectedName(nCommandType)); - Reference< XComponent > xComponent,xDefinition; + const ::rtl::OUString sCurrentSelected( getCurrentlySelectedName( nCommandType ) ); if ( E_REPORT == _eType ) - xComponent = aHelper->newReportWithPilot(xDefinition,nCommandType,sName); + aHelper->newReportWithPilot( nCommandType, sCurrentSelected ); else - xComponent = aHelper->newFormWithPilot(xDefinition,nCommandType,sName); - - onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, xDefinition ); + aHelper->newFormWithPilot( nCommandType, sCurrentSelected ); } } break; @@ -1951,68 +1971,76 @@ void OApplicationController::newElementWithPilot( ElementType _eType ) ::std::auto_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess(_eType); if ( aHelper->isConnected() ) { - Reference< XComponent > xComponent; if ( E_QUERY == _eType ) - xComponent = aHelper->newQueryWithPilot(); + aHelper->newQueryWithPilot(); else - xComponent = aHelper->newTableWithPilot(); - - onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, NULL ); + aHelper->newTableWithPilot(); } } break; case E_NONE: break; } + + // no need for onDocumentOpened, the table wizard opens the created table by using + // XDatabaseDocumentUI::loadComponent method. } // ----------------------------------------------------------------------------- -void OApplicationController::newElement( ElementType _eType, sal_Bool _bSQLView ) +Reference< XComponent > OApplicationController::newElement( ElementType _eType, const ::comphelper::NamedValueCollection& i_rAdditionalArguments, + Reference< XComponent >& o_rDocumentDefinition ) { OSL_ENSURE(getContainer(),"View is NULL! -> GPF"); + Reference< XComponent > xComponent; + o_rDocumentDefinition.clear(); + switch ( _eType ) { case E_FORM: case E_REPORT: - { - ::std::auto_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess(_eType); - if ( aHelper->isConnected() ) - { - Reference< XComponent > xComponent,xDefinition; - sal_Int32 nCommandType = -1; - const ::rtl::OUString sName(getCurrentlySelectedName(nCommandType)); - xComponent = aHelper->newDocument(_eType == E_FORM ? ID_FORM_NEW_TEXT : ID_REPORT_NEW_TEXT,xDefinition,nCommandType,sName); - onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, xDefinition ); - } - } - break; + { + ::std::auto_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess( _eType ); + if ( !aHelper->isConnected() ) + break; + + xComponent = aHelper->newDocument( _eType == E_FORM ? ID_FORM_NEW_TEXT : ID_REPORT_NEW_TEXT, i_rAdditionalArguments, o_rDocumentDefinition ); + } + break; + case E_QUERY: case E_TABLE: - { - ::std::auto_ptr< DatabaseObjectView > pDesigner; - SharedConnection xConnection( ensureConnection() ); - if ( xConnection.is() ) - { - if ( _eType == E_TABLE ) - { - pDesigner.reset( new TableDesigner( getORB(), this, getFrame() ) ); - } - else if ( _eType == E_QUERY ) - { - pDesigner.reset( new QueryDesigner( getORB(), this, getFrame(), false, _bSQLView ) ); - } + { + ::std::auto_ptr< DatabaseObjectView > pDesigner; + SharedConnection xConnection( ensureConnection() ); + if ( !xConnection.is() ) + break; - Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); - Reference< XComponent > xComponent( pDesigner->createNew( xDataSource ), UNO_QUERY ); - onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, NULL ); - } + if ( _eType == E_TABLE ) + { + pDesigner.reset( new TableDesigner( getORB(), this, getFrame() ) ); } - break; + else if ( _eType == E_QUERY ) + { + pDesigner.reset( new QueryDesigner( getORB(), this, getFrame(), false ) ); + } + + Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); + xComponent.set( pDesigner->createNew( xDataSource, i_rAdditionalArguments ), UNO_QUERY ); + } + break; + default: + OSL_ENSURE( false, "OApplicationController::newElement: illegal type!" ); break; } + + if ( xComponent.is() ) + onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, o_rDocumentDefinition ); + + return xComponent; } + // ----------------------------------------------------------------------------- void OApplicationController::addContainerListener(const Reference<XNameAccess>& _xCollection) { @@ -2585,7 +2613,7 @@ Reference< XModel > SAL_CALL OApplicationController::getModel(void) throw( Runt } // ----------------------------------------------------------------------------- -void OApplicationController::onConnectedModel() +void OApplicationController::onAttachedFrame() { sal_Int32 nConnectedControllers( 0 ); try @@ -2614,9 +2642,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() ) { @@ -2662,6 +2696,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() ); @@ -2677,16 +2719,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); @@ -2762,7 +2801,7 @@ void OApplicationController::containerFound( const Reference< XContainer >& _xCo try { sName = getContainer()->getQualifiedName( NULL ); - OSL_ENSURE( sName.getLength(), "OApplicationController::newElementWithPilot: no name given!" ); + OSL_ENSURE( sName.getLength(), "OApplicationController::getCurrentlySelectedName: no name given!" ); } catch( const Exception& ) { diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx index a8c5d5a97054..de0d6d6599f3 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; @@ -200,10 +197,15 @@ namespace dbaui /** opens a new frame for creation or auto pilot @param _eType Defines the type to open - @param _bSQLView - If <TRUE/> the query design will be opened in SQL view, otherwise not. + @param i_rAdditionalArguments + Additional arguments to pass when creating the component */ - void newElement( ElementType _eType , sal_Bool _bSQLView ); + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > + newElement( + ElementType _eType, + const ::comphelper::NamedValueCollection& i_rAdditionalArguments, + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_rDocumentDefinition + ); /** creates a new database object, using an auto pilot @param _eType @@ -387,12 +389,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; @@ -405,7 +407,7 @@ namespace dbaui /** verifies the object type denotes a valid DatabaseObject, and the object name denotes an existing object of this type. Throws if not. */ - void impl_validateObjectTypeAndName_throw( const sal_Int32 _nObjectType, const ::rtl::OUString& _rObjectName ); + void impl_validateObjectTypeAndName_throw( const sal_Int32 _nObjectType, const ::boost::optional< ::rtl::OUString >& i_rObjectName ); protected: // ---------------------------------------------------------------- @@ -446,6 +448,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 ); @@ -465,9 +468,12 @@ namespace dbaui virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > > SAL_CALL getSubComponents() throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isConnected( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL connect( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::beans::Pair< ::sal_Int32, ::rtl::OUString > SAL_CALL identifySubComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& SubComponent ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL closeSubComponents( ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL loadComponent( ::sal_Int32 ObjectType, const ::rtl::OUString& ObjectName, ::sal_Bool ForEditing ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL loadComponentWithArguments( ::sal_Int32 ObjectType, const ::rtl::OUString& ObjectName, ::sal_Bool ForEditing, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL createComponent( ::sal_Int32 ObjectType, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_DocumentDefinition ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL createComponentWithArguments( ::sal_Int32 ObjectType, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_DocumentDefinition ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); // XContextMenuInterception virtual void SAL_CALL registerContextMenuInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XContextMenuInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException); diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx index ed8c5a15dd89..0e8b3c8d647c 100644 --- a/dbaccess/source/ui/app/AppControllerDnD.cxx +++ b/dbaccess/source/ui/app/AppControllerDnD.cxx @@ -613,7 +613,7 @@ void OApplicationController::getSelectionElementNames(::std::vector< ::rtl::OUSt } ::std::auto_ptr< OLinkedDocumentsAccess > pDocuments( new OLinkedDocumentsAccess( - getView(), m_aCurrentFrame.getFrame(), getORB(), xDocContainer, xConnection, getDatabaseName() + getView(), this, getORB(), xDocContainer, xConnection, getDatabaseName() ) ); return pDocuments; } diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index a0f61642dbf0..53a4440ee321 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -90,6 +90,7 @@ namespace dbaui using namespace ::dbtools; using namespace ::connectivity; using namespace ::svx; +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::util; @@ -107,6 +108,7 @@ using namespace ::com::sun::star::ucb; using ::com::sun::star::util::XCloseable; using ::com::sun::star::ui::XContextMenuInterceptor; /** === end UNO using === **/ + namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject; namespace ErrorCondition = ::com::sun::star::sdb::ErrorCondition; @@ -328,15 +330,22 @@ void SAL_CALL OApplicationController::propertyChange( const PropertyChangeEvent& ::rtl::OUString sOldName,sNewName; evt.OldValue >>= sOldName; evt.NewValue >>= sNewName; - Reference<XChild> xChild(evt.Source,UNO_QUERY); - if ( xChild.is() ) + + // if the old name is empty, then this is a newly inserted content. We're notified of it via the + // elementInserted method, so there's no need to handle it here. + + if ( sOldName.getLength() ) { - Reference<XContent> xContent(xChild->getParent(),UNO_QUERY); - if ( xContent.is() ) - sOldName = xContent->getIdentifier()->getContentIdentifier() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + sOldName; - } + Reference<XChild> xChild(evt.Source,UNO_QUERY); + if ( xChild.is() ) + { + Reference<XContent> xContent(xChild->getParent(),UNO_QUERY); + if ( xContent.is() ) + sOldName = xContent->getIdentifier()->getContentIdentifier() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + sOldName; + } - getContainer()->elementReplaced( eType , sOldName, sNewName ); + getContainer()->elementReplaced( eType , sOldName, sNewName ); + } } } @@ -385,6 +394,8 @@ Reference< XConnection > SAL_CALL OApplicationController::getActiveConnection() // ----------------------------------------------------------------------------- void SAL_CALL OApplicationController::connect( ) throw (SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( getMutex() ); + SQLExceptionInfo aError; SharedConnection xConnection = ensureConnection( &aError ); if ( !xConnection.is() ) @@ -400,8 +411,28 @@ void SAL_CALL OApplicationController::connect( ) throw (SQLException, RuntimeEx } // ----------------------------------------------------------------------------- +beans::Pair< ::sal_Int32, ::rtl::OUString > SAL_CALL OApplicationController::identifySubComponent( const Reference< XComponent >& i_rSubComponent ) throw (IllegalArgumentException, RuntimeException) +{ + ::osl::MutexGuard aGuard( getMutex() ); + + sal_Int32 nType = -1; + ::rtl::OUString sName; + + if ( !m_pSubComponentManager->lookupSubComponent( i_rSubComponent, sName, nType ) ) + throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); + + if ( nType == SID_DB_APP_DSRELDESIGN ) + // this is somewhat hacky ... we're expected to return a DatabaseObject value. However, there is no such + // value for the relation design. /me thinks we should change the API definition here ... + nType = -1; + + return beans::Pair< ::sal_Int32, ::rtl::OUString >( nType, sName ); +} + +// ----------------------------------------------------------------------------- ::sal_Bool SAL_CALL OApplicationController::closeSubComponents( ) throw (RuntimeException) { + ::osl::MutexGuard aGuard( getMutex() ); return m_pSubComponentManager->closeSubComponents(); } @@ -427,7 +458,7 @@ namespace } // ----------------------------------------------------------------------------- -void OApplicationController::impl_validateObjectTypeAndName_throw( const sal_Int32 _nObjectType, const ::rtl::OUString& _rObjectName ) +void OApplicationController::impl_validateObjectTypeAndName_throw( const sal_Int32 _nObjectType, const ::boost::optional< ::rtl::OUString >& i_rObjectName ) { // ensure we're connected if ( !isConnected() ) @@ -444,6 +475,9 @@ void OApplicationController::impl_validateObjectTypeAndName_throw( const sal_Int ) throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); + if ( !i_rObjectName ) + return; + // ensure an existing object Reference< XNameAccess > xContainer( getElements( lcl_objectType2ElementType( _nObjectType ) ) ); if ( !xContainer.is() ) @@ -456,19 +490,19 @@ void OApplicationController::impl_validateObjectTypeAndName_throw( const sal_Int { case DatabaseObject::TABLE: case DatabaseObject::QUERY: - bExistentObject = xContainer->hasByName( _rObjectName ); + bExistentObject = xContainer->hasByName( *i_rObjectName ); break; case DatabaseObject::FORM: case DatabaseObject::REPORT: { Reference< XHierarchicalNameAccess > xHierarchy( xContainer, UNO_QUERY_THROW ); - bExistentObject = xHierarchy->hasByHierarchicalName( _rObjectName ); + bExistentObject = xHierarchy->hasByHierarchicalName( *i_rObjectName ); } break; } if ( !bExistentObject ) - throw NoSuchElementException( _rObjectName, *this ); + throw NoSuchElementException( *i_rObjectName, *this ); } // ----------------------------------------------------------------------------- @@ -499,6 +533,29 @@ Reference< XComponent > SAL_CALL OApplicationController::loadComponentWithArgume } // ----------------------------------------------------------------------------- +Reference< XComponent > SAL_CALL OApplicationController::createComponent( ::sal_Int32 i_nObjectType, Reference< XComponent >& o_DocumentDefinition ) throw (IllegalArgumentException, SQLException, RuntimeException) +{ + return createComponentWithArguments( i_nObjectType, Sequence< PropertyValue >(), o_DocumentDefinition ); +} + +// ----------------------------------------------------------------------------- +Reference< XComponent > SAL_CALL OApplicationController::createComponentWithArguments( ::sal_Int32 i_nObjectType, const Sequence< PropertyValue >& i_rArguments, Reference< XComponent >& o_DocumentDefinition ) throw (IllegalArgumentException, SQLException, RuntimeException) +{ + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( getMutex() ); + + impl_validateObjectTypeAndName_throw( i_nObjectType, ::boost::optional< ::rtl::OUString >() ); + + Reference< XComponent > xComponent( newElement( + lcl_objectType2ElementType( i_nObjectType ), + ::comphelper::NamedValueCollection( i_rArguments ), + o_DocumentDefinition + ) ); + + return xComponent; +} + +// ----------------------------------------------------------------------------- void SAL_CALL OApplicationController::registerContextMenuInterceptor( const Reference< XContextMenuInterceptor >& _Interceptor ) throw (RuntimeException) { if ( _Interceptor.is() ) diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index fbc5b8d0c359..56013dc99fe4 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -1289,15 +1289,11 @@ void OAppDetailPageHelper::showPreview( const ::rtl::OUString& _sDataSourceName, ) ); pDispatcher->setTargetFrame( m_xFrame ); - Sequence < PropertyValue > aArgs( 4 ); - aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Preview")); - aArgs[0].Value <<= sal_True; - aArgs[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")); - aArgs[1].Value <<= sal_True; - aArgs[2].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate")); - aArgs[2].Value <<= sal_False; - aArgs[3].Name = PROPERTY_SHOWMENU; - aArgs[3].Value <<= sal_False; + ::comphelper::NamedValueCollection aArgs; + aArgs.put( "Preview", sal_True ); + aArgs.put( "ReadOnly", sal_True ); + aArgs.put( "AsTemplate", sal_False ); + aArgs.put( (::rtl::OUString)PROPERTY_SHOWMENU, sal_False ); Reference< XController > xPreview( pDispatcher->openExisting( makeAny( _sDataSourceName ), _sName, aArgs ), UNO_QUERY ); sal_Bool bClearPreview = !xPreview.is(); diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx index a24fe29b5974..dbc0f432efef 100644 --- a/dbaccess/source/ui/app/subcomponentmanager.cxx +++ b/dbaccess/source/ui/app/subcomponentmanager.cxx @@ -29,6 +29,7 @@ #include "subcomponentmanager.hxx" #include "AppController.hxx" +#include "dbustrings.hrc" /** === begin UNO includes === **/ #include <com/sun/star/frame/XFrame.hpp> @@ -39,6 +40,7 @@ #include <com/sun/star/embed/XComponentSupplier.hpp> #include <com/sun/star/ucb/XCommandProcessor.hpp> #include <com/sun/star/document/XDocumentEventBroadcaster.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> /** === end UNO includes === **/ #include <tools/diagnose_ex.h> @@ -49,10 +51,10 @@ #include <algorithm> #include <functional> -//........................................................................ +//...................................................................................................................... namespace dbaui { -//........................................................................ +//...................................................................................................................... /** === begin UNO using === **/ using ::com::sun::star::uno::Reference; @@ -79,40 +81,61 @@ namespace dbaui using ::com::sun::star::ucb::XCommandProcessor; using ::com::sun::star::ucb::Command; using ::com::sun::star::document::XDocumentEventBroadcaster; + using ::com::sun::star::beans::XPropertySet; + using ::com::sun::star::beans::PropertyChangeEvent; /** === end UNO using === **/ - //============================================================================== + //================================================================================================================== //= helper structs - //============================================================================== + //================================================================================================================== namespace { + //.............................................................................................................. struct SubComponentDescriptor { + /// the name of the sub component, empty if it is yet unsaved + ::rtl::OUString sName; + /// type of the component - an ElementType value, except for relation design + sal_Int32 nComponentType; + /// the mode in which the sub component has been opened + ElementOpenMode eOpenMode; /// the frame which the component resides in. Must not be <NULL/> Reference< XFrame > xFrame; /// the controller of the sub component. Must not be <NULL/> Reference< XController > xController; /// the model of the sub component. Might be <NULL/> Reference< XModel > xModel; - /// the document definition which holds the component, if any - Reference< XCommandProcessor > xComponentCommandProcessor; + /// the document definition which holds the component, if any; as CommandProcessor + Reference< XCommandProcessor > xComponentCommandProcessor; + /// the document definition which holds the component, if any; as PropertySet + Reference< XPropertySet > xDocumentDefinitionProperties; SubComponentDescriptor() - :xFrame() + :sName() + ,nComponentType( -1 ) + ,eOpenMode( E_OPEN_NORMAL ) + ,xFrame() ,xController() ,xModel() { } - SubComponentDescriptor( const Reference< XComponent >& _rxComponent ) + SubComponentDescriptor( const ::rtl::OUString& i_rName, const sal_Int32 i_nComponentType, + const ElementOpenMode i_eOpenMode, const Reference< XComponent >& i_rComponent ) + :sName( i_rName ) + ,nComponentType( i_nComponentType ) + ,eOpenMode( i_eOpenMode ) { - if ( !impl_constructFrom( _rxComponent ) ) + if ( !impl_constructFrom( i_rComponent ) ) { - Reference< XComponentSupplier > xCompSupp( _rxComponent, UNO_QUERY_THROW ); + // i_rComponent is neither a model, nor a controller, nor a frame + // => it must be a css.sdb.DocumentDefinition + Reference< XComponentSupplier > xCompSupp( i_rComponent, UNO_QUERY_THROW ); Reference< XComponent > xComponent( xCompSupp->getComponent(), UNO_QUERY_THROW ); if ( !impl_constructFrom( xComponent ) ) throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal component type." ) ), NULL ); - xComponentCommandProcessor.set( _rxComponent, UNO_QUERY_THROW ); + xComponentCommandProcessor.set( i_rComponent, UNO_QUERY_THROW ); + xDocumentDefinitionProperties.set( i_rComponent, UNO_QUERY_THROW ); } } @@ -156,6 +179,7 @@ namespace dbaui } }; + //.............................................................................................................. struct SelectSubComponent : public ::std::unary_function< SubComponentDescriptor, Reference< XComponent > > { Reference< XComponent > operator()( const SubComponentDescriptor _desc ) const @@ -167,55 +191,37 @@ namespace dbaui } }; - struct SubComponentAccessor - { - /// the name of the sub component - ::rtl::OUString sName; - /// type of the component - usually an ElementType value - sal_Int32 nComponentType; - /// the mode in which the sub component has been opened - ElementOpenMode eOpenMode; + //.............................................................................................................. + typedef ::std::vector< SubComponentDescriptor > SubComponents; - SubComponentAccessor() - :sName() - ,nComponentType( sal_Int32( E_NONE ) ) - ,eOpenMode( E_OPEN_NORMAL ) - { - } - - SubComponentAccessor( const ::rtl::OUString& _rName, const sal_Int32 _nCompType, const ElementOpenMode _eMode ) - :sName( _rName ) - ,nComponentType( _nCompType ) - ,eOpenMode( _eMode ) - { - } - }; - - struct SubComponentAccessorHash : public ::std::unary_function< SubComponentAccessor, size_t > + //.............................................................................................................. + struct SubComponentMatch : public ::std::unary_function< SubComponentDescriptor, bool > { - size_t operator()( const SubComponentAccessor& _lhs ) const + public: + SubComponentMatch( const ::rtl::OUString& i_rName, const sal_Int32 i_nComponentType, + const ElementOpenMode i_eOpenMode ) + :m_sName( i_rName ) + ,m_nComponentType( i_nComponentType ) + ,m_eOpenMode( i_eOpenMode ) { - return _lhs.sName.hashCode() + _lhs.nComponentType + size_t( _lhs.eOpenMode ); } - }; - struct SubComponentAccessorEqual : public ::std::binary_function< SubComponentAccessor, SubComponentAccessor, bool > - { - bool operator()( const SubComponentAccessor& _lhs, const SubComponentAccessor& _rhs ) const + + bool operator()( const SubComponentDescriptor& i_rCompareWith ) const { - return ( _lhs.sName == _rhs.sName ) - && ( _lhs.nComponentType == _rhs.nComponentType ) - && ( _lhs.eOpenMode == _rhs.eOpenMode ); + return ( m_sName == i_rCompareWith.sName ) + && ( m_nComponentType == i_rCompareWith.nComponentType ) + && ( m_eOpenMode == i_rCompareWith.eOpenMode ); } + private: + const ::rtl::OUString m_sName; + const sal_Int32 m_nComponentType; + const ElementOpenMode m_eOpenMode; }; - - typedef ::std::hash_map< SubComponentAccessor, SubComponentDescriptor, SubComponentAccessorHash, SubComponentAccessorEqual > - SubComponentMap; - } - //============================================================================== + //================================================================================================================== //= SubComponentManager_Data - //============================================================================== + //================================================================================================================== struct SubComponentManager_Data { SubComponentManager_Data( OApplicationController& _rController, const ::comphelper::SharedMutex& _rMutex ) @@ -226,35 +232,36 @@ namespace dbaui OApplicationController& m_rController; mutable ::comphelper::SharedMutex m_aMutex; - SubComponentMap m_aComponents; + SubComponents m_aComponents; ::osl::Mutex& getMutex() const { return m_aMutex; } }; - //==================================================================== + //================================================================================================================== //= SubComponentManager - //==================================================================== - //-------------------------------------------------------------------- + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ SubComponentManager::SubComponentManager( OApplicationController& _rController, const ::comphelper::SharedMutex& _rMutex ) :m_pData( new SubComponentManager_Data( _rController, _rMutex ) ) { } - //-------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ SubComponentManager::~SubComponentManager() { } - //-------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ void SubComponentManager::disposing() { ::osl::MutexGuard aGuard( m_pData->getMutex() ); m_pData->m_aComponents.clear(); } - //-------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ namespace { + //.............................................................................................................. bool lcl_fallbackToAnotherController( SubComponentDescriptor& _rCompDesc ) { Reference< XController > xFallback; @@ -292,7 +299,7 @@ namespace dbaui return false; } - //---------------------------------------------------------------- + //.............................................................................................................. bool lcl_closeComponent( const Reference< XCommandProcessor >& _rxCommandProcessor ) { bool bSuccess = false; @@ -313,7 +320,7 @@ namespace dbaui return bSuccess; } - //---------------------------------------------------------------- + //.............................................................................................................. bool lcl_closeComponent( const SubComponentDescriptor& _rComponent ) { if ( _rComponent.xComponentCommandProcessor.is() ) @@ -341,7 +348,7 @@ namespace dbaui return bSuccess; } - // ----------------------------------------------------------------------------- + //.............................................................................................................. void lcl_notifySubComponentEvent( const SubComponentManager_Data& _rData, const sal_Char* _pAsciiEventName, const SubComponentDescriptor& _rComponent ) { @@ -361,43 +368,74 @@ namespace dbaui } } - //-------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL SubComponentManager::propertyChange( const PropertyChangeEvent& i_rEvent ) throw (RuntimeException) + { + if ( i_rEvent.PropertyName != PROPERTY_NAME ) + // by definition, it's allowed to broadcast more than what we've registered for + return; + + // find the sub component whose name changed + for ( SubComponents::iterator comp = m_pData->m_aComponents.begin(); + comp != m_pData->m_aComponents.end(); + ++comp + ) + { + if ( comp->xDocumentDefinitionProperties != i_rEvent.Source ) + continue; + + ::rtl::OUString sNewName; + OSL_VERIFY( i_rEvent.NewValue >>= sNewName ); + + #if OSL_DEBUG_LEVEL > 0 + ::rtl::OUString sOldKnownName( comp->sName ); + ::rtl::OUString sOldName; + OSL_VERIFY( i_rEvent.OldValue >>= sOldName ); + OSL_ENSURE( sOldName == sOldKnownName, "SubComponentManager::propertyChange: inconsistency in the old names!" ); + #endif + + comp->sName = sNewName; + break; + } + } + + //------------------------------------------------------------------------------------------------------------------ void SAL_CALL SubComponentManager::disposing( const EventObject& _rSource ) throw (RuntimeException) { ::osl::ClearableMutexGuard aGuard( m_pData->getMutex() ); SubComponentDescriptor aClosedComponent; - for ( SubComponentMap::iterator comp = m_pData->m_aComponents.begin(); + for ( SubComponents::iterator comp = m_pData->m_aComponents.begin(); comp != m_pData->m_aComponents.end(); ++comp ) { bool bRemove = false; - if ( comp->second.xController == _rSource.Source ) + if ( comp->xController == _rSource.Source ) { - if ( !comp->second.xModel.is() ) + if ( !comp->xModel.is() ) { bRemove = true; } else { // maybe this is just one view to the sub document, and only this view is closed - if ( !lcl_fallbackToAnotherController( comp->second ) ) + if ( !lcl_fallbackToAnotherController( *comp ) ) { bRemove = true; } } } - else if ( comp->second.xModel == _rSource.Source ) + else if ( comp->xModel == _rSource.Source ) { bRemove = true; } if ( bRemove ) { - aClosedComponent = comp->second; + aClosedComponent = *comp; m_pData->m_aComponents.erase( comp ); break; } @@ -410,7 +448,7 @@ namespace dbaui } } - //-------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ Sequence< Reference< XComponent> > SubComponentManager::getSubComponents() const { ::osl::MutexGuard aGuard( m_pData->getMutex() ); @@ -420,12 +458,12 @@ namespace dbaui m_pData->m_aComponents.begin(), m_pData->m_aComponents.end(), aComponents.getArray(), - ::std::compose1( SelectSubComponent(), ::std::select2nd< SubComponentMap::value_type >() ) + SelectSubComponent() ); return aComponents; } - // ----------------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ sal_Bool SubComponentManager::closeSubComponents() { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); @@ -433,16 +471,13 @@ namespace dbaui try { - typedef ::std::vector< SubComponentAccessor > ComponentAccessors; - ComponentAccessors aClosedComponents; - - SubComponentMap aComponents( m_pData->m_aComponents ); - for ( SubComponentMap::const_iterator comp = aComponents.begin(); - comp != aComponents.end(); + SubComponents aWorkingCopy( m_pData->m_aComponents ); + for ( SubComponents::const_iterator comp = aWorkingCopy.begin(); + comp != aWorkingCopy.end(); ++comp ) { - lcl_closeComponent( comp->second ); + lcl_closeComponent( *comp ); } } catch ( const Exception& ) @@ -453,78 +488,120 @@ namespace dbaui return empty(); } - // ----------------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ bool SubComponentManager::empty() const { ::osl::MutexGuard aGuard( m_pData->getMutex() ); return m_pData->m_aComponents.empty(); } - // ----------------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ void SubComponentManager::onSubComponentOpened( const ::rtl::OUString& _rName, const sal_Int32 _nComponentType, const ElementOpenMode _eOpenMode, const Reference< XComponent >& _rxComponent ) { ::osl::ClearableMutexGuard aGuard( m_pData->getMutex() ); - // put into map - SubComponentAccessor aKey( _rName, _nComponentType, _eOpenMode ); - SubComponentDescriptor aElement( _rxComponent ); +#if OSL_DEBUG_LEVEL > 0 + if ( _rName.getLength() ) + { + // check there does not already exist such a component + SubComponents::const_iterator existentPos = ::std::find_if( + m_pData->m_aComponents.begin(), + m_pData->m_aComponents.end(), + SubComponentMatch( _rName, _nComponentType, _eOpenMode ) + ); + OSL_ENSURE( existentPos == m_pData->m_aComponents.end(), "already existent!" ); + } +#endif + SubComponentDescriptor aElement( _rName, _nComponentType, _eOpenMode, _rxComponent ); ENSURE_OR_THROW( aElement.xModel.is() || aElement.xController.is(), "illegal component" ); - m_pData->m_aComponents.insert( SubComponentMap::value_type( - aKey, aElement - ) ) ; + m_pData->m_aComponents.push_back( aElement ); // add as listener if ( aElement.xController.is() ) aElement.xController->addEventListener( this ); if ( aElement.xModel.is() ) aElement.xModel->addEventListener( this ); + if ( aElement.xDocumentDefinitionProperties.is() ) + aElement.xDocumentDefinitionProperties->addPropertyChangeListener( PROPERTY_NAME, this ); // notify this to interested parties aGuard.clear(); lcl_notifySubComponentEvent( *m_pData, "OnSubComponentOpened", aElement ); } - // ----------------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ bool SubComponentManager::activateSubFrame( const ::rtl::OUString& _rName, const sal_Int32 _nComponentType, const ElementOpenMode _eOpenMode ) const { ::osl::MutexGuard aGuard( m_pData->getMutex() ); - SubComponentAccessor aKey( _rName, _nComponentType, _eOpenMode ); - SubComponentMap::const_iterator pos = m_pData->m_aComponents.find( aKey ); + SubComponents::const_iterator pos = ::std::find_if( + m_pData->m_aComponents.begin(), + m_pData->m_aComponents.end(), + SubComponentMatch( _rName, _nComponentType, _eOpenMode ) + ); if ( pos == m_pData->m_aComponents.end() ) // no component with this name/type/open mode return false; - const Reference< XFrame > xFrame( pos->second.xFrame, UNO_SET_THROW ); + const Reference< XFrame > xFrame( pos->xFrame, UNO_SET_THROW ); const Reference< XTopWindow > xTopWindow( xFrame->getContainerWindow(), UNO_QUERY_THROW ); xTopWindow->toFront(); return true; } - // ----------------------------------------------------------------------------- - bool SubComponentManager::closeSubFrames( const ::rtl::OUString& _rName, const sal_Int32 _nComponentType ) + //------------------------------------------------------------------------------------------------------------------ + bool SubComponentManager::closeSubFrames( const ::rtl::OUString& i_rName, const sal_Int32 _nComponentType ) { ::osl::MutexGuard aGuard( m_pData->getMutex() ); + ENSURE_OR_RETURN_FALSE( i_rName.getLength(), "SubComponentManager::closeSubFrames: illegal name!" ); - SubComponentMap aWorkingCopy( m_pData->m_aComponents ); - for ( SubComponentMap::const_iterator comp = aWorkingCopy.begin(); + SubComponents aWorkingCopy( m_pData->m_aComponents ); + for ( SubComponents::const_iterator comp = aWorkingCopy.begin(); comp != aWorkingCopy.end(); ++comp ) { - if ( ( comp->first.sName != _rName ) || ( comp->first.nComponentType != _nComponentType ) ) + if ( ( comp->sName != i_rName ) || ( comp->nComponentType != _nComponentType ) ) continue; - if ( !lcl_closeComponent( comp->second ) ) + if ( !lcl_closeComponent( *comp ) ) return false; } return true; } -//........................................................................ + //------------------------------------------------------------------------------------------------------------------ + bool SubComponentManager::lookupSubComponent( const Reference< XComponent >& i_rComponent, + ::rtl::OUString& o_rName, sal_Int32& o_rComponentType ) + { + for ( SubComponents::const_iterator comp = m_pData->m_aComponents.begin(); + comp != m_pData->m_aComponents.end(); + ++comp + ) + { + if ( ( comp->xModel.is() + && ( comp->xModel == i_rComponent ) + ) + || ( comp->xController.is() + && ( comp->xController == i_rComponent ) + ) + || ( comp->xFrame.is() + && ( comp->xFrame == i_rComponent ) + ) + ) + { + o_rName = comp->sName; + o_rComponentType = comp->nComponentType; + return true; + } + } + return false; + } + +//...................................................................................................................... } // namespace dbaui -//........................................................................ +//...................................................................................................................... diff --git a/dbaccess/source/ui/app/subcomponentmanager.hxx b/dbaccess/source/ui/app/subcomponentmanager.hxx index fbcdf92d4bd9..372a0a211af5 100644 --- a/dbaccess/source/ui/app/subcomponentmanager.hxx +++ b/dbaccess/source/ui/app/subcomponentmanager.hxx @@ -33,7 +33,7 @@ #include "AppElementType.hxx" /** === begin UNO includes === **/ -#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> #include <com/sun/star/frame/XController.hpp> /** === end UNO includes === **/ @@ -53,7 +53,7 @@ namespace dbaui //==================================================================== //= SubComponentManager //==================================================================== - typedef ::cppu::WeakImplHelper1 < ::com::sun::star::lang::XEventListener + typedef ::cppu::WeakImplHelper1 < ::com::sun::star::beans::XPropertyChangeListener > SubComponentManager_Base; class SubComponentManager : public SubComponentManager_Base { @@ -63,6 +63,9 @@ namespace dbaui void disposing(); + // XPropertyChangeListener + virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) 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); @@ -106,6 +109,24 @@ namespace dbaui const ::rtl::OUString& _rName, const sal_Int32 _nComponentType ); + + /** searches for the given sub component + + @param i_rComponent + the sub component to look up + @param o_rName + contains, upon successful return, the name of the sub component + @param o_nComponentType + contains, upon successful return, the type of the sub component + @return + <TRUE/> if and only if the component was found + */ + bool lookupSubComponent( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& i_rComponent, + ::rtl::OUString& o_rName, + sal_Int32& o_rComponentType + ); + private: ::std::auto_ptr< SubComponentManager_Data > m_pData; }; diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index 1caae8c6bf11..5277afb37500 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -630,7 +630,6 @@ SbaXDataBrowserController::SbaXDataBrowserController(const Reference< ::com::sun ,m_sStateSaveRecord(ModuleRes(RID_STR_SAVE_CURRENT_RECORD)) ,m_sStateUndoRecord(ModuleRes(RID_STR_UNDO_MODIFY_RECORD)) ,m_sModuleIdentifier( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.DataSourceBrowser" ) ) ) - ,m_pLoadThread(NULL) ,m_pFormControllerImpl(NULL) ,m_nPendingLoadFinished(0) ,m_nFormActionNestingLevel(0) @@ -830,7 +829,7 @@ sal_Bool SbaXDataBrowserController::Construct(Window* pParent) // --------------- // create the view - m_pView = new UnoDataBrowserView( pParent, *this, getORB() ); + setView( * new UnoDataBrowserView( pParent, *this, getORB() ) ); if (!getBrowserView()) return sal_False; @@ -1292,45 +1291,6 @@ void SbaXDataBrowserController::elementReplaced(const ::com::sun::star::containe sal_Bool SbaXDataBrowserController::suspend(sal_Bool /*bSuspend*/) throw( RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::suspend" ); - // have a pending open operation ? - if (PendingLoad()) - { - ::vos::OGuard aGuard(Application::GetSolarMutex()); - if (m_nPendingLoadFinished != 0) - { // clean up directly. Otherwise there may be a pending asynchronous call - // to OnOpenFinishedMainThread, which won't be executed before we leave - // this method. Sounds like a classic infinite loop. - Application::RemoveUserEvent(m_nPendingLoadFinished); - LINK(this, SbaXDataBrowserController, OnOpenFinishedMainThread).Call(NULL); - } - else - { // set m_bClosingKillOpen to ensure that the our termination handler reacts according - // it's context - m_bClosingKillOpen = sal_True; - - // normally we would now just wait for termination of the load thread, but there is a small problem : - // In the current thread the global solar mutex is locked (that's for sure). If the loading of the - // form tries to acquire (blocking) the solar mutex, too, and we loop waiting for the other thread - // we have a classic deadlock. And bet your ass that ANYBODY in the foreign thread tries to lock - // the solar mutex. Almost all the UNO-capsules around normal C++ classes use the solar mutex for - // "thread safety" (which doesn't deserve that name anymore ;), e.g. the XNumberFormatter-implementation - // does. - // So we have to do a fake : we tell the loading thread that we aren't interested in the results anymore - // and the thread deletes itself (and the data source) as soon as it is done. As it holds the last - // references to the form (and thus, indirectly, to the grid) they will be cleared as soon as the thread dies. - // So all is fine. Except the small flaw that the form is still loading in the background while the - // window that should display it is already dead. - // If we could release the solar mutex in this thread and block it 'til the loader is finished we could - // solve it in a less dirty way, but uinfortunatelly we don't know how often this thread acquired the mutex. - // With high effort we could reach this with releasing the mutex until a third thread - which has to be - // created - can acquire it.Then we block, the third thread releases the mutex (and dies) and the loader - // thread would be able to finish. But that sounds difficult and fault-prone, so I think it's not worth it ... - ((LoadFormThread*)m_pLoadThread)->SetTerminationHdl(Link()); - // and of course we tell the thread to stop .... - ((LoadFormThread*)m_pLoadThread)->StopIt(); - } - - } DBG_ASSERT(m_nPendingLoadFinished == 0, "SbaXDataBrowserController::suspend : there shouldn't be a pending load !"); m_aAsyncGetCellFocus.CancelCall(); @@ -1346,42 +1306,30 @@ void SbaXDataBrowserController::disposing() // the base class SbaXDataBrowserController_Base::OGenericUnoController::disposing(); - if (!PendingLoad()) + // the data source + Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); + if (xFormSet.is()) { - // don't do the removeXxxListener calls if there is a pending load, this may lead to a deadlock : - // as in this thread the SolarMutex is locked (that's for sure) and removeXxxListener locks - // the form's mutex. But in the loading thread both mutexes are acquired in reverse order. - // That's no problem that we don't remove ourself here, as the load thread is responsible for the form - // at the moment. So if the loading is finished, the form will be disposed (by the load thread), and - // we get the "disposing" event where we can do the removeXxxListener calls. - // The alternative for this handling would be that the form has two mutexes : one for handling it's - // listeners and properties and so on, on for it's pure cursor actions - - // the data source - Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); - if (xFormSet.is()) - { - xFormSet->removePropertyChangeListener(PROPERTY_ISNEW, static_cast<XPropertyChangeListener*>(this)); - xFormSet->removePropertyChangeListener(PROPERTY_ISMODIFIED, static_cast<XPropertyChangeListener*>(this)); - xFormSet->removePropertyChangeListener(PROPERTY_ROWCOUNT, static_cast<XPropertyChangeListener*>(this)); - xFormSet->removePropertyChangeListener(PROPERTY_ACTIVECOMMAND, static_cast<XPropertyChangeListener*>(this)); - xFormSet->removePropertyChangeListener(PROPERTY_ORDER, static_cast<XPropertyChangeListener*>(this)); - xFormSet->removePropertyChangeListener(PROPERTY_FILTER, static_cast<XPropertyChangeListener*>(this)); - xFormSet->removePropertyChangeListener(PROPERTY_HAVING_CLAUSE, static_cast<XPropertyChangeListener*>(this)); - xFormSet->removePropertyChangeListener(PROPERTY_APPLYFILTER, static_cast<XPropertyChangeListener*>(this)); - } + xFormSet->removePropertyChangeListener(PROPERTY_ISNEW, static_cast<XPropertyChangeListener*>(this)); + xFormSet->removePropertyChangeListener(PROPERTY_ISMODIFIED, static_cast<XPropertyChangeListener*>(this)); + xFormSet->removePropertyChangeListener(PROPERTY_ROWCOUNT, static_cast<XPropertyChangeListener*>(this)); + xFormSet->removePropertyChangeListener(PROPERTY_ACTIVECOMMAND, static_cast<XPropertyChangeListener*>(this)); + xFormSet->removePropertyChangeListener(PROPERTY_ORDER, static_cast<XPropertyChangeListener*>(this)); + xFormSet->removePropertyChangeListener(PROPERTY_FILTER, static_cast<XPropertyChangeListener*>(this)); + xFormSet->removePropertyChangeListener(PROPERTY_HAVING_CLAUSE, static_cast<XPropertyChangeListener*>(this)); + xFormSet->removePropertyChangeListener(PROPERTY_APPLYFILTER, static_cast<XPropertyChangeListener*>(this)); + } - Reference< ::com::sun::star::sdb::XSQLErrorBroadcaster > xFormError(getRowSet(), UNO_QUERY); - if (xFormError.is()) - xFormError->removeSQLErrorListener((::com::sun::star::sdb::XSQLErrorListener*)this); + Reference< ::com::sun::star::sdb::XSQLErrorBroadcaster > xFormError(getRowSet(), UNO_QUERY); + if (xFormError.is()) + xFormError->removeSQLErrorListener((::com::sun::star::sdb::XSQLErrorListener*)this); - if (m_xLoadable.is()) - m_xLoadable->removeLoadListener(this); + if (m_xLoadable.is()) + m_xLoadable->removeLoadListener(this); - Reference< ::com::sun::star::form::XDatabaseParameterBroadcaster > xFormParameter(getRowSet(), UNO_QUERY); - if (xFormParameter.is()) - xFormParameter->removeParameterListener((::com::sun::star::form::XDatabaseParameterListener*)this); - } + Reference< ::com::sun::star::form::XDatabaseParameterBroadcaster > xFormParameter(getRowSet(), UNO_QUERY); + if (xFormParameter.is()) + xFormParameter->removeParameterListener((::com::sun::star::form::XDatabaseParameterListener*)this); removeModelListeners(getControlModel()); @@ -1397,29 +1345,24 @@ void SbaXDataBrowserController::disposing() { removeControlListeners(getBrowserView()->getGridControl()); // don't delete explicitly, this is done by the owner (and user) of this controller (me hopes ...) - m_pView = NULL; + clearView(); } if(m_aInvalidateClipboard.IsActive()) m_aInvalidateClipboard.Stop(); - // dispose the data source - // if there is a pending load we decided to give the responsibility for the data source to the open thread - // (see ::suspend) - if (!PendingLoad()) + // dispose the row set + try { - try - { - ::comphelper::disposeComponent(m_xRowSet); + ::comphelper::disposeComponent(m_xRowSet); - m_xRowSet = NULL; - m_xColumnsSupplier = NULL; - m_xLoadable = NULL; - } - catch(Exception&) - { - OSL_ENSURE(0,"Exception thrown by dispose"); - } + m_xRowSet = NULL; + m_xColumnsSupplier = NULL; + m_xLoadable = NULL; + } + catch(Exception&) + { + OSL_ENSURE(0,"Exception thrown by dispose"); } try { @@ -1539,7 +1482,7 @@ sal_Bool SbaXDataBrowserController::approveParameter(const ::com::sun::star::for pParamRequest->addContinuation(pAbort); // create the handler, let it handle the request - Reference< XInteractionHandler > xHandler(getORB()->createInstance(SERVICE_SDB_INTERACTION_HANDLER), UNO_QUERY); + Reference< XInteractionHandler > xHandler(getORB()->createInstance(SERVICE_TASK_INTERACTION_HANDLER), UNO_QUERY); if (xHandler.is()) xHandler->handle(xParamRequest); @@ -1637,9 +1580,6 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const aReturn.bEnabled = m_xParser->getFilter().getLength() || m_xParser->getHavingClause().getLength() || m_xParser->getOrder().getLength(); return aReturn; } - // no chance while loading the form - if (PendingLoad()) - return aReturn; // no chance without valid models if (isValid() && !isValidCursor()) return aReturn; @@ -2641,45 +2581,6 @@ IMPL_LINK(SbaXDataBrowserController, OnCanceledNotFound, FmFoundRecordInformatio } //------------------------------------------------------------------------------ -IMPL_LINK(SbaXDataBrowserController, OnOpenFinishedMainThread, void*, EMPTYARG) -{ - ::vos::OGuard aGuard(Application::GetSolarMutex()); - if (!m_nPendingLoadFinished) - // it's possible that the direct call of this link from within suspend caused this method to be executed - // in another thread while we were waiting for the mutex in this thread - return 0; - m_nPendingLoadFinished = 0; - - if ( static_cast< LoadFormThread* >( m_pLoadThread )->WasCanceled() ) - setLoadingCancelled(); - - delete m_pLoadThread; - m_pLoadThread = NULL; - - LoadFinished(sal_False); - - return 0L; -} - -//------------------------------------------------------------------------------ -IMPL_LINK(SbaXDataBrowserController, OnOpenFinished, void*, EMPTYARG) -{ - ::osl::MutexGuard aCheckGuard(m_aAsyncLoadSafety); - - if (m_bClosingKillOpen) - { - delete m_pLoadThread; - m_pLoadThread = NULL; - } - else - // all cleaning has to run in the main thread, not here (this is called synchronously from the LoadThread) - // so we use an user event - m_nPendingLoadFinished = Application::PostUserEvent(LINK(this, SbaXDataBrowserController, OnOpenFinishedMainThread)); - - return 0L; -} - -//------------------------------------------------------------------------------ IMPL_LINK(SbaXDataBrowserController, OnAsyncGetCellFocus, void*, EMPTYARG) { SbaGridControl* pVclGrid = getBrowserView() ? getBrowserView()->getVclControl() : NULL; @@ -3035,171 +2936,6 @@ bool LoadFormHelper::WaitUntilReallyLoaded(bool _bOnlyIfLoaded) return true; } -//================================================================== -// LoadFormThread - a thread for asynchronously loading a form -//================================================================== -//------------------------------------------------------------------------------ -void LoadFormThread::run() -{ - // On instantiation of a SfxCancellable the application is notified and 'switches on' the red stop button. - // Unfortunally this is conditioned with the acquirement of the solar mutex, and the application tries - // only once and ignores the notification if it fails. - // To prevent that we get the solar mutex and _block_ 'til we got it. - // As we are in the 'top level execution' of this thread (with a rather small stack and no other mutexes locked) - // we shouldn't experience problems with deadlocks ... - ::vos::OClearableGuard aSolarGuard(Application::GetSolarMutex()); - ThreadStopper* pStopper = new ThreadStopper(this, m_sStopperCaption); - aSolarGuard.clear(); - - // we're not canceled yet - ::osl::ClearableMutexGuard aResetGuard(m_aAccessSafety); - m_bCanceled = sal_False; - aResetGuard.clear(); - - LoadFormHelper* pHelper = new LoadFormHelper(m_xRowSet); - pHelper->acquire(); - - // start it - bool bErrorOccured = false; - Reference< XLoadable > xLoadable(m_xRowSet, UNO_QUERY); - try - { - Reference< XRowSet > xMove(m_xRowSet, UNO_QUERY); - DBG_ASSERT(xLoadable.is() && xMove.is(), "LoadFormThread::run : invalid cursor !"); - xLoadable->load(); - // go to the first record if the load was successfull. - Reference< XColumnsSupplier > xColumnsSupplier(m_xRowSet, UNO_QUERY); - Reference< ::com::sun::star::container::XNameAccess > xCols = xColumnsSupplier.is() ? xColumnsSupplier->getColumns() : Reference< ::com::sun::star::container::XNameAccess > (); - if (xCols.is() && xCols->hasElements()) - xMove->first(); - else - bErrorOccured = true; - } - catch(Exception&) - { - bErrorOccured = true; - } - - // check if we were canceled - ::osl::ClearableMutexGuard aTestGuard(m_aAccessSafety); - bool bReallyCanceled = m_bCanceled ? true : false;; - aTestGuard.clear(); - - bReallyCanceled |= bErrorOccured; - - // the load on the form is "slightly asyncronous" (which isn't covered by it's specification, anyway), so wait - // some time .... - // (though me thinks that the load of the new api is synchronous, so we won't need this LoadFormHelper anymore ...) - if (!bReallyCanceled) - pHelper->WaitUntilReallyLoaded(true); - - pHelper->cancel(); - pHelper->release(); - - // yes, we were, but eventually the cancel request didn't reach the data source in time - if (bReallyCanceled && xLoadable.is() && xLoadable->isLoaded()) - xLoadable->unload(); - - pStopper->OwnerTerminated(); - // this will cause the stopper to delete itself (in the main thread) so we don't have to take care of the - // solar mutex -} - -//------------------------------------------------------------------------------ -void LoadFormThread::onTerminated() -{ - ::osl::ClearableMutexGuard aGuard(m_aAccessSafety); - if (m_aTerminationHandler.IsSet()) - { - // within the call of our termination handler we may be deleted, so do anything which is a member - // access before the call ... - // FS - #69801# - 02.12.99 - Link aHandler(m_aTerminationHandler); - aGuard.clear(); - aHandler.Call(this); - } - else - { - // we are fully responsible for the data source and for ourself, so dispose the former ... - try - { - ::comphelper::disposeComponent(m_xRowSet); - - m_xRowSet = NULL; - } - catch(Exception&) - { - OSL_ENSURE(0,"Exception thrown by dispose"); - } - // ... and delete the latter - aGuard.clear(); // like above - releasing the mutex is a member access ... - delete this; - } -} - -//------------------------------------------------------------------------------ -void LoadFormThread::StopIt() -{ - ::osl::ClearableMutexGuard aResetGuard(m_aAccessSafety); - m_bCanceled = sal_True; - aResetGuard.clear(); - - Reference< XColumnsSupplier > xColumnsSupplier(m_xRowSet, UNO_QUERY); - if (!xColumnsSupplier.is()) - { - DBG_ERROR("LoadFormThread::StopIt : invalid data source !"); - return; - } - Reference< ::com::sun::star::container::XNameAccess > xCols(xColumnsSupplier->getColumns(), UNO_QUERY); - if (!xCols.is() || !xCols->hasElements()) - // the cursor isn't alive, don't need to cancel - return; - - Reference< ::com::sun::star::util::XCancellable > xCancel(m_xRowSet, UNO_QUERY); - if (xCancel.is()) - { - try { xCancel->cancel(); } catch(SQLException&) {} - // with this the cursor returns from it's load call, this terminates our run, this get's our termination handler to - // be called - // (the try-catch is just in case the cancel wasn't neccessary anymore) - } -} - -//------------------------------------------------------------------------------ -LoadFormThread::ThreadStopper::ThreadStopper(LoadFormThread* pOwner, const String& rTitle) - :SfxCancellable(SFX_APP()->GetCancelManager(), rTitle) - ,m_pOwner(pOwner) -{ -} - -//------------------------------------------------------------------------------ -void LoadFormThread::ThreadStopper::Cancel() -{ - if (!m_pOwner) - return; - - ::osl::MutexGuard aGuard(m_pOwner->m_aAccessSafety); - if (IsCancelled()) - // we already did pass this to our owner - return; - - SfxCancellable::Cancel(); - m_pOwner->StopIt(); -} - -//------------------------------------------------------------------------------ -void LoadFormThread::ThreadStopper::OwnerTerminated() -{ - m_pOwner = NULL; - Application::PostUserEvent(LINK(this, LoadFormThread::ThreadStopper, OnDeleteInMainThread), this); -} - -//------------------------------------------------------------------------------ -IMPL_LINK(LoadFormThread::ThreadStopper, OnDeleteInMainThread, LoadFormThread::ThreadStopper*, pThis) -{ - delete pThis; - return 0L; -} // ----------------------------------------------------------------------------- sal_Int16 SbaXDataBrowserController::getCurrentColumnPosition() { 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/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index dc2734a0414a..150c701aab20 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -251,6 +251,7 @@ DBG_NAME(OGenericUnoController) // ------------------------------------------------------------------------- OGenericUnoController::OGenericUnoController(const Reference< XMultiServiceFactory >& _rM) :OGenericUnoController_Base( getMutex() ) + ,m_pView(NULL) #ifdef DBG_UTIL ,m_bDescribingSupportedFeatures( false ) #endif @@ -258,7 +259,6 @@ OGenericUnoController::OGenericUnoController(const Reference< XMultiServiceFacto ,m_aAsyncCloseTask(LINK(this, OGenericUnoController, OnAsyncCloseTask)) ,m_xServiceFactory(_rM) ,m_aCurrentFrame( *this ) - ,m_pView(NULL) ,m_bPreview(sal_False) ,m_bReadOnly(sal_False) ,m_bCurrentlyModified(sal_False) @@ -286,13 +286,13 @@ OGenericUnoController::OGenericUnoController(const Reference< XMultiServiceFacto // ----------------------------------------------------------------------------- OGenericUnoController::OGenericUnoController() :OGenericUnoController_Base( getMutex() ) + ,m_pView(NULL) #ifdef DBG_UTIL ,m_bDescribingSupportedFeatures( false ) #endif ,m_aAsyncInvalidateAll(LINK(this, OGenericUnoController, OnAsyncInvalidateAll)) ,m_aAsyncCloseTask(LINK(this, OGenericUnoController, OnAsyncCloseTask)) ,m_aCurrentFrame( *this ) - ,m_pView(NULL) ,m_bPreview(sal_False) ,m_bReadOnly(sal_False) ,m_bCurrentlyModified(sal_False) @@ -415,7 +415,7 @@ void SAL_CALL OGenericUnoController::initialize( const Sequence< Any >& aArgumen // no one clears my view if I won't ::std::auto_ptr<Window> aTemp(m_pView); m_pView = NULL; - throw e; + throw; } } @@ -480,6 +480,14 @@ Reference< XWindow > SAL_CALL OGenericUnoController::getComponentWindow() throw } // ----------------------------------------------------------------------- +Sequence< PropertyValue > SAL_CALL OGenericUnoController::getCreationArguments() throw (RuntimeException) +{ + // currently we do not support any creation args, so anything passed to XModel2::createViewController would be + // lost, so we can equally return an empty sequence here + return Sequence< PropertyValue >(); +} + +// ----------------------------------------------------------------------- void OGenericUnoController::attachFrame( const Reference< XFrame >& _rxFrame ) throw( RuntimeException ) { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 1e10e9421047..24c4667e50b6 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -1661,10 +1661,6 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const if (isValid() && !isValidCursor() && nId != ID_BROWSER_CLOSE) return aReturn; - // no chance while loading the form - if (PendingLoad()) - return aReturn; - switch (nId) { case ID_BROWSER_INSERTCOLUMNS: @@ -3384,7 +3380,7 @@ void SbaTableQueryBrowser::implAdministrate( SvLBoxEntry* _pApplyTo ) { Reference< XInteractionHandler > xInteractionHandler( getORB()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.InteractionHandler" ) ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), UNO_QUERY ); OSL_ENSURE( xInteractionHandler.is(), "SbaTableQueryBrowser::implAdministrate: no interaction handler available!" ); diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index fa1a6f946eee..6df0e46b84b9 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -1128,7 +1128,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument() m_xFrameLoader.set( m_xDesktop, UNO_QUERY_THROW ); m_xInteractionHandler.set( _rxORB->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.InteractionHandler" ) ) + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), UNO_QUERY_THROW ); } diff --git a/dbaccess/source/ui/inc/JoinController.hxx b/dbaccess/source/ui/inc/JoinController.hxx index 786839e4e6fc..6561e7b9f282 100644 --- a/dbaccess/source/ui/inc/JoinController.hxx +++ b/dbaccess/source/ui/inc/JoinController.hxx @@ -52,6 +52,11 @@ #endif #include <boost/shared_ptr.hpp> +namespace comphelper +{ + class NamedValueCollection; +} + class VCLXWindow; namespace dbaui { @@ -82,22 +87,22 @@ namespace dbaui virtual void Execute(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs); /** loads the information for the windows. - @param _aViewProps + @param i_rViewSettings The properties which comes from the layout information. */ - void loadTableWindows(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aViewProps); + void loadTableWindows( const ::comphelper::NamedValueCollection& i_rViewSettings ); /** loads the information for one window. @param _rTable The properties which comes from the layout information. */ - void loadTableWindow(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _rTable); + void loadTableWindow( const ::comphelper::NamedValueCollection& i_rTableWindowSettings ); /** saves the TableWindows structure in a sequence of property values @param _rViewProps Contains the new sequence. */ - void saveTableWindows(::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _rViewProps); + void saveTableWindows( ::comphelper::NamedValueCollection& o_rViewSettings ) const; virtual ~OJoinController(); public: @@ -112,7 +117,7 @@ namespace dbaui // --------------------------------------------------------------- // OSingleDocumentController overridables virtual void reconnect( sal_Bool _bUI ); - virtual void setModified( sal_Bool _bModified = sal_True ); + virtual void impl_onModifyChanged(); // --------------------------------------------------------------- // own overridables diff --git a/dbaccess/source/ui/inc/QueryDesignView.hxx b/dbaccess/source/ui/inc/QueryDesignView.hxx index 6a97719e0c27..cf501441e4ee 100644 --- a/dbaccess/source/ui/inc/QueryDesignView.hxx +++ b/dbaccess/source/ui/inc/QueryDesignView.hxx @@ -167,6 +167,10 @@ namespace dbaui */ bool initByParseIterator( ::dbtools::SQLExceptionInfo* _pErrorInfo ); + void initByFieldDescriptions( + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rFieldDescriptions + ); + ::connectivity::OSQLParseNode* getPredicateTreeFromEntry( OTableFieldDescRef pEntry, const String& _sCriteria, ::rtl::OUString& _rsErrorMessage, diff --git a/dbaccess/source/ui/inc/QueryViewSwitch.hxx b/dbaccess/source/ui/inc/QueryViewSwitch.hxx index c0692ba48af0..abeccbac4ce2 100644 --- a/dbaccess/source/ui/inc/QueryViewSwitch.hxx +++ b/dbaccess/source/ui/inc/QueryViewSwitch.hxx @@ -78,6 +78,7 @@ namespace dbaui old state) */ bool switchView( ::dbtools::SQLExceptionInfo* _pErrorInfo ); + void forceInitialView(); sal_Bool isSlotEnabled(sal_Int32 _nSlotId); void setSlotEnabled(sal_Int32 _nSlotId,sal_Bool _bEnable); void setNoneVisbleRow(sal_Int32 _nRows); @@ -96,6 +97,10 @@ namespace dbaui protected: // return the Rectangle where I can paint myself virtual void resizeDocumentView(Rectangle& rRect); + + private: + void impl_forceSQLView(); + bool impl_postViewSwitch( const bool i_bGraphicalDesign, const bool i_bSuccess ); }; } #endif // DBAUI_QUERYVIEWSWITCH_HXX diff --git a/dbaccess/source/ui/inc/RelationController.hxx b/dbaccess/source/ui/inc/RelationController.hxx index 6bc1561e0785..fe080672a5bf 100644 --- a/dbaccess/source/ui/inc/RelationController.hxx +++ b/dbaccess/source/ui/inc/RelationController.hxx @@ -60,7 +60,7 @@ namespace dbaui // execute a feature virtual void Execute(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs); - ORelationDesignView* getRelationView() { return static_cast<ORelationDesignView*>(m_pView); } + ORelationDesignView* getRelationView() { return static_cast<ORelationDesignView*>( getView() ); } void loadData(); TTableWindowData::value_type existsTable(const ::rtl::OUString& _rComposedTableName,sal_Bool _bCase) const; diff --git a/dbaccess/source/ui/inc/TableController.hxx b/dbaccess/source/ui/inc/TableController.hxx index 736fd7bdf6a8..1ccc72668dc9 100644 --- a/dbaccess/source/ui/inc/TableController.hxx +++ b/dbaccess/source/ui/inc/TableController.hxx @@ -130,7 +130,7 @@ namespace dbaui inline sal_Bool isAutoIncrementValueEnabled() const { return m_bAllowAutoIncrementValue; } inline const ::rtl::OUString& getAutoIncrementValue() const { return m_sAutoIncrementValue; } - virtual void setModified(sal_Bool _bModified=sal_True); + virtual void impl_onModifyChanged(); // const ::connectivity::OSQLParseNode* getParseTree() const { return m_aSqlIterator.getParseTree();} // need for undo's and redo's diff --git a/dbaccess/source/ui/inc/TableFieldDescription.hxx b/dbaccess/source/ui/inc/TableFieldDescription.hxx index 9230bef621c3..64d17909fcce 100644 --- a/dbaccess/source/ui/inc/TableFieldDescription.hxx +++ b/dbaccess/source/ui/inc/TableFieldDescription.hxx @@ -47,13 +47,19 @@ #include <vos/ref.hxx> #endif +namespace comphelper +{ + class NamedValueCollection; +} + class Window; namespace dbaui { class OTableFieldDesc : public ::vos::OReference { private: - ::std::vector< ::rtl::OUString> m_vecCriteria; + ::std::vector< ::rtl::OUString > + m_aCriteria; ::rtl::OUString m_aTableName; ::rtl::OUString m_aAliasName; // table range @@ -131,18 +137,18 @@ namespace dbaui sal_Bool HasCriteria() const { - ::std::vector< ::rtl::OUString>::const_iterator aIter = m_vecCriteria.begin(); - ::std::vector< ::rtl::OUString>::const_iterator aEnd = m_vecCriteria.end(); + ::std::vector< ::rtl::OUString>::const_iterator aIter = m_aCriteria.begin(); + ::std::vector< ::rtl::OUString>::const_iterator aEnd = m_aCriteria.end(); for(;aIter != aEnd;++aIter) if(aIter->getLength()) break; return aIter != aEnd; } - const ::std::vector< ::rtl::OUString>& GetCriteria() const { return m_vecCriteria;} + const ::std::vector< ::rtl::OUString>& GetCriteria() const { return m_aCriteria; } - void Load(const ::com::sun::star::beans::PropertyValue& _rProperty); - void Save(::com::sun::star::beans::PropertyValue& _rProperty); + void Load( const ::com::sun::star::beans::PropertyValue& i_rSettings, const bool i_bIncludingCriteria ); + void Save( ::comphelper::NamedValueCollection& o_rSettings, const bool i_bIncludingCriteria ); }; //------------------------------------------------------------------ diff --git a/dbaccess/source/ui/inc/brwctrlr.hxx b/dbaccess/source/ui/inc/brwctrlr.hxx index d94f76b8dcc9..a4f05670252b 100644 --- a/dbaccess/source/ui/inc/brwctrlr.hxx +++ b/dbaccess/source/ui/inc/brwctrlr.hxx @@ -56,7 +56,6 @@ #include <svtools/transfer.hxx> #include <osl/mutex.hxx> #include <vos/thread.hxx> -#include <svl/cancel.hxx> #include <cppuhelper/implbase9.hxx> #include <svtools/cliplistener.hxx> @@ -122,7 +121,6 @@ namespace dbaui ::rtl::OUString m_sModuleIdentifier; // members for asynchronous load operations - ::vos::OThread* m_pLoadThread; // the thread wherein the form is loaded FormControllerImpl* m_pFormControllerImpl; // implementing the XFormController ULONG m_nPendingLoadFinished; // the event used to tell ourself that the load is finished @@ -166,7 +164,7 @@ namespace dbaui public: SbaXDataBrowserController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM); - UnoDataBrowserView* getBrowserView() const { return static_cast< UnoDataBrowserView*>(m_pView); } + UnoDataBrowserView* getBrowserView() const { return static_cast< UnoDataBrowserView*>(getView()); } // late construction virtual sal_Bool Construct(Window* pParent); @@ -319,9 +317,6 @@ namespace dbaui // a PropertySet corresponding to the cursor field a column is bound to // if nViewPos is (sal_uInt16)-1 (the default) then the field for the current column will be retrieved - sal_Bool PendingLoad() const { return m_pLoadThread != NULL; } - // is there an asyncronous load operation in progress ? - void enterFormAction(); void leaveFormAction(); @@ -362,74 +357,10 @@ namespace dbaui DECL_LINK(OnFoundData, FmFoundRecordInformation*); DECL_LINK(OnCanceledNotFound, FmFoundRecordInformation*); - // callbacks for the completed loading process - DECL_LINK(OnOpenFinished, void*); - DECL_LINK(OnOpenFinishedMainThread, void*); - // OnOpenFinsihed is called in a foreign thread (the one which does the loading) so it simply posts the - // OnOpenFinishedMainThread-link (which will be called in the main thread, then) as user event. - // (the alternative would be to lock the SolarMutex in OnOpenFinished to avoid problems with the needed updates, - // but playing with this mutex seems very hazardous to me ....) DECL_LINK(OnAsyncGetCellFocus, void*); DECL_LINK( OnAsyncDisplayError, void* ); }; - - //================================================================== - // LoadFormThread - a thread for asynchronously loading a form - //================================================================== - class LoadFormThread : public ::vos::OThread - { - ::osl::Mutex m_aAccessSafety; // for securing the multi-thread access - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet; // the data source to be loaded - - Link m_aTerminationHandler; // the handler to be called upon termination - sal_Bool m_bCanceled; // StopIt has been called ? - String m_sStopperCaption; // the caption for the ThreadStopper - - // a ThreadStopper will be instantiated so that the open can be canceled via the UI - class ThreadStopper : protected SfxCancellable - { - LoadFormThread* m_pOwner; - - public: - ThreadStopper(LoadFormThread* pOwner, const String& rTitle); - virtual ~ThreadStopper() { } - - virtual void Cancel(); - - virtual void OwnerTerminated(); - // Normally the Owner (a LoadFormThread) would delete the stopper when terminated. - // Unfortunally the application doesn't remove the 'red light' when a SfxCancellable is deleted - // if it (the app) can't acquire the solar mutex. The deletion is IGNORED then. So we have to make - // sure that a) the stopper is deleted from inside the main thread (where the solar mutex is locked) - // and b) that in the time between the termination of the thread and the deletion of the stopper - // the latter doesn't access the former. - // The OwnerTerminated cares for both aspects. - // SO DON'T DELETE THE STOPPER EXPLICITLY ! - - protected: - // HACK HACK HACK HACK HACK : this should be private, but MSVC doesn't accept the LINK-macro then .... - DECL_LINK(OnDeleteInMainThread, ThreadStopper*); - }; - friend class LoadFormThread::ThreadStopper; - - public: - LoadFormThread(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > & _xRowSet, const String& _rStopperCaption) : m_xRowSet(_xRowSet), m_sStopperCaption(_rStopperCaption) { } - - virtual void SAL_CALL run(); - virtual void SAL_CALL onTerminated(); - - void SetTerminationHdl(const Link& aTermHdl) { m_aTerminationHandler = aTermHdl; } - // the handler will be called synchronously (the parameter is a pointer to the thread) - // if no termination handler is set, the thread disposes the data source and deletes - // itself upon termination - - // cancels the process. to be called from another thread (of course ;) - void StopIt(); - - // ask if the load canceled - sal_Bool WasCanceled() const { return m_bCanceled; } - }; } #endif // _SBA_BWRCTRLR_HXX diff --git a/dbaccess/source/ui/inc/databaseobjectview.hxx b/dbaccess/source/ui/inc/databaseobjectview.hxx index 07c77e388196..b295aae146a0 100644 --- a/dbaccess/source/ui/inc/databaseobjectview.hxx +++ b/dbaccess/source/ui/inc/databaseobjectview.hxx @@ -67,6 +67,7 @@ #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ #include <com/sun/star/uno/Sequence.hxx> #endif +#include <comphelper/namedvaluecollection.hxx> #include <boost/shared_ptr.hpp> @@ -93,10 +94,11 @@ namespace dbaui m_xApplication; ::rtl::OUString m_sComponentURL; + private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > doDispatch( - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rDispatchArguments + const ::comphelper::NamedValueCollection& i_rDispatchArgs ); protected: @@ -116,11 +118,11 @@ namespace dbaui virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > doCreateView( const ::com::sun::star::uno::Any& _rDataSource, const ::rtl::OUString& _rObjectName, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rCreationArgs + const ::comphelper::NamedValueCollection& i_rCreationArgs ); virtual void fillDispatchArgs( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rDispatchArguments, + ::comphelper::NamedValueCollection& i_rDispatchArgs, const ::com::sun::star::uno::Any& _rDataSource, const ::rtl::OUString& _rObjectName ); @@ -158,7 +160,8 @@ namespace dbaui */ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > createNew( - const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource >& _xDataSource + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource >& _xDataSource, + const ::comphelper::NamedValueCollection& i_rDispatchArgs = ::comphelper::NamedValueCollection() ); /** opens a view for an existent object @@ -176,7 +179,7 @@ namespace dbaui openExisting( const ::com::sun::star::uno::Any& _aDataSource, const ::rtl::OUString& _rName, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs + const ::comphelper::NamedValueCollection& i_rDispatchArgs ); }; @@ -186,12 +189,11 @@ namespace dbaui class QueryDesigner : public DatabaseObjectView { protected: - sal_Int32 m_nCommandType; - sal_Bool m_bPreferSQLView; + sal_Int32 m_nCommandType; protected: virtual void fillDispatchArgs( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rDispatchArguments, + ::comphelper::NamedValueCollection& i_rDispatchArgs, const ::com::sun::star::uno::Any& _aDataSource, const ::rtl::OUString& _rObjectName ); @@ -201,8 +203,7 @@ namespace dbaui const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame, - bool _bCreateView, - sal_Bool _bPreferSQLView + bool _bCreateView ); }; @@ -213,7 +214,7 @@ namespace dbaui { protected: virtual void fillDispatchArgs( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rDispatchArguments, + ::comphelper::NamedValueCollection& i_rDispatchArgs, const ::com::sun::star::uno::Any& _aDataSource, const ::rtl::OUString& _rObjectName ); @@ -221,7 +222,7 @@ namespace dbaui virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > doCreateView( const ::com::sun::star::uno::Any& _rDataSource, const ::rtl::OUString& _rObjectName, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rCreationArgs + const ::comphelper::NamedValueCollection& i_rCreationArgs ); public: @@ -254,7 +255,7 @@ namespace dbaui protected: virtual void fillDispatchArgs( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rDispatchArguments, + ::comphelper::NamedValueCollection& i_rDispatchArgs, const ::com::sun::star::uno::Any& _aDataSource, const ::rtl::OUString& _rQualifiedName ); diff --git a/dbaccess/source/ui/inc/linkeddocuments.hxx b/dbaccess/source/ui/inc/linkeddocuments.hxx index 8807e3b71840..cc4824058000 100644 --- a/dbaccess/source/ui/inc/linkeddocuments.hxx +++ b/dbaccess/source/ui/inc/linkeddocuments.hxx @@ -55,6 +55,7 @@ #ifndef _COM_SUN_STAR_UCB_XCONTENT_HPP_ #include <com/sun/star/ucb/XContent.hpp> #endif +#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp> #ifndef _LINK_HXX #include <tools/link.hxx> #endif @@ -83,8 +84,8 @@ namespace dbaui m_xDocumentContainer; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> m_xConnection; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > - m_xParentFrame; + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI > + m_xDocumentUI; Window* m_pDialogParent; String m_sCurrentlyEditing; ::rtl::OUString @@ -92,13 +93,13 @@ namespace dbaui public: OLinkedDocumentsAccess( - Window* _pDialogParent - ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame - ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB - ,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainer - ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection - ,const ::rtl::OUString& _sDataSourceName - ); + Window* _pDialogParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& i_rDocumentUI, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainer, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection, + const ::rtl::OUString& _sDataSourceName + ); ~OLinkedDocumentsAccess(); inline sal_Bool isConnected() const { return m_xConnection.is(); } @@ -113,30 +114,21 @@ namespace dbaui ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > newDocument( - sal_Int32 _nNewFormId, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _xDefinition, - const sal_Int32 _nCommandType, - const ::rtl::OUString& _sObjectName + sal_Int32 i_nActionID, + const ::comphelper::NamedValueCollection& i_rCreationArgs, + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_rDefinition ); - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > - newFormWithPilot( - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _xDefinition, + void newFormWithPilot( const sal_Int32 _nCommandType = -1, const ::rtl::OUString& _rObjectName = ::rtl::OUString() ); - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > - newReportWithPilot( - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _xDefinition, + void newReportWithPilot( const sal_Int32 _nCommandType = -1, const ::rtl::OUString& _rObjectName = ::rtl::OUString() ); - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > - newQueryWithPilot(); - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > - newTableWithPilot(); + void newQueryWithPilot(); + void newTableWithPilot(); enum RESULT { @@ -148,15 +140,14 @@ namespace dbaui ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > impl_open( const ::rtl::OUString& _rLinkName, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _xDefinition, + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _xDefinition, ElementOpenMode _eOpenMode, const ::comphelper::NamedValueCollection& _rAdditionalArgs ); - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > + void impl_newWithPilot( const char* _pWizardService, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _xDefinition, const sal_Int32 _nCommandType, const ::rtl::OUString& _rObjectName ); diff --git a/dbaccess/source/ui/inc/querycontainerwindow.hxx b/dbaccess/source/ui/inc/querycontainerwindow.hxx index 44af65ed2b2a..8d7bb4f7999f 100644 --- a/dbaccess/source/ui/inc/querycontainerwindow.hxx +++ b/dbaccess/source/ui/inc/querycontainerwindow.hxx @@ -118,6 +118,7 @@ namespace dbaui bool reset( ::dbtools::SQLExceptionInfo* _pErrorInfo ) { return m_pViewSwitch->reset( _pErrorInfo ); } bool switchView( ::dbtools::SQLExceptionInfo* _pErrorInfo ); + void forceInitialView(); virtual void GetFocus(); diff --git a/dbaccess/source/ui/inc/querycontroller.hxx b/dbaccess/source/ui/inc/querycontroller.hxx index 6db721095c15..ad50cb4a7ab0 100644 --- a/dbaccess/source/ui/inc/querycontroller.hxx +++ b/dbaccess/source/ui/inc/querycontroller.hxx @@ -56,6 +56,11 @@ #include <connectivity/sqlparse.hxx> #include <svl/undo.hxx> +namespace comphelper +{ + class NamedValueCollection; +} + class VCLXWindow; namespace dbaui { @@ -125,8 +130,8 @@ namespace dbaui void executeQuery(); bool doSaveAsDoc(sal_Bool _bSaveAs); - void saveViewSettings(::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _rViewProps); - void loadViewSettings(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _rViewProps); + void saveViewSettings( ::comphelper::NamedValueCollection& o_rViewSettings, const bool i_includingCriteria ) const; + void loadViewSettings( const ::comphelper::NamedValueCollection& o_rViewSettings ); ::rtl::OUString translateStatement( bool _bFireStatementChange = true ); ::rtl::OUString getDefaultName() const; @@ -142,7 +147,7 @@ namespace dbaui virtual void reconnect( sal_Bool _bUI ); virtual ::rtl::OUString getPrivateTitle( ) const; - OQueryContainerWindow* getContainer() const { return static_cast< OQueryContainerWindow* >( getView() ); } + OQueryContainerWindow* getContainer() const { return static_cast< OQueryContainerWindow* >( getView() ); } public: OQueryController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM); @@ -153,7 +158,7 @@ namespace dbaui void clearFields(); - virtual void setModified(sal_Bool _bModified=sal_True); + virtual void impl_onModifyChanged(); // should the statement be parsed by our own sql parser sal_Bool isEsacpeProcessing() const { return m_bEscapeProcessing; } @@ -170,6 +175,9 @@ namespace dbaui sal_Int32 getColWidth(sal_uInt16 _nColPos) const; + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& + getFieldInformation() const { return m_aFieldInformation; } + ::connectivity::OSQLParser& getParser() { return m_aSqlParser; } ::connectivity::OSQLParseTreeIterator& getParseIterator() { return *m_pSqlIterator; } @@ -195,18 +203,38 @@ namespace dbaui static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&); + // XController + virtual ::com::sun::star::uno::Any SAL_CALL getViewData(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL restoreViewData(const ::com::sun::star::uno::Any& Data) throw( ::com::sun::star::uno::RuntimeException ); + private: virtual void onLoadedMenu(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& _xLayoutManager); // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any& rConvertedValue, + ::com::sun::star::uno::Any& rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) throw (::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) throw (::com::sun::star::uno::Exception ); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + virtual OJoinDesignView* getJoinView(); // ask the user if the design should be saved when it is modified virtual short saveModified(); virtual void reset(); virtual void impl_initialize(); - void impl_reset(); + void impl_reset( const bool i_bIgnoreQuerySettings = false ); /// tells the user that we needed to switch to SQL view automatically void impl_showAutoSQLViewError( const ::com::sun::star::uno::Any& _rErrorDetails ); @@ -225,6 +253,9 @@ namespace dbaui private: DECL_LINK( OnExecuteAddTable, void* ); + + private: + using OQueryController_PBase::getFastPropertyValue; }; } #endif // DBAUI_QUERYCONTROLLER_HXX diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 8d7e24e2792c..2da2f31d5186 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -378,11 +378,11 @@ SQLExceptionInfo createConnection( const Reference< ::com::sun::star::beans::XP } else { // instantiate the default SDB interaction handler - Reference< XInteractionHandler > xHandler(_rMF->createInstance(SERVICE_SDB_INTERACTION_HANDLER), UNO_QUERY); + Reference< XInteractionHandler > xHandler(_rMF->createInstance(SERVICE_TASK_INTERACTION_HANDLER), UNO_QUERY); if (!xHandler.is()) { OSL_ENSURE(sal_False, "createConnection: could not instantiate an interaction handler!"); - // ShowServiceNotAvailableError(NULL, String(SERVICE_SDB_INTERACTION_HANDLER), sal_True); + // ShowServiceNotAvailableError(NULL, String(SERVICE_TASK_INTERACTION_HANDLER), sal_True); // TODO: a real parent! } else diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index b178947bf5f9..43c2b10e9f9e 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -709,7 +709,7 @@ OCopyTableWizard::OCopyTableWizard( Window* pParent, const ::rtl::OUString& _rDe ::dbaui::fillTypeInfo( _xConnection, m_sTypeNames, m_aTypeInfo, m_aTypeInfoIndex ); ::dbaui::fillTypeInfo( _xConnection, m_sTypeNames, m_aDestTypeInfo, m_aDestTypeInfoIndex ); - m_xInteractionHandler.set( m_xFactory->createInstance( SERVICE_SDB_INTERACTION_HANDLER ), UNO_QUERY); + m_xInteractionHandler.set( m_xFactory->createInstance( SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY); OCopyTable* pPage1( new OCopyTable( this ) ); pPage1->disallowViews(); diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx index 24debbe9bf7d..3f9e94453d78 100644 --- a/dbaccess/source/ui/misc/databaseobjectview.cxx +++ b/dbaccess/source/ui/misc/databaseobjectview.cxx @@ -49,7 +49,6 @@ #include <comphelper/extract.hxx> #include <comphelper/sequence.hxx> -#include <comphelper/namedvaluecollection.hxx> #include <connectivity/dbtools.hxx> #include <osl/diagnose.h> #include <toolkit/helper/vclunohelper.hxx> @@ -78,11 +77,11 @@ namespace dbaui const Reference< XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >& _rxParentFrame, const ::rtl::OUString& _rComponentURL ) - :m_xORB ( _rxORB ) - ,m_xParentFrame ( _rxParentFrame ) - ,m_xFrameLoader ( ) - ,m_xApplication ( _rxApplication ) - ,m_sComponentURL( _rComponentURL ) + :m_xORB ( _rxORB ) + ,m_xParentFrame ( _rxParentFrame ) + ,m_xFrameLoader ( ) + ,m_xApplication ( _rxApplication ) + ,m_sComponentURL ( _rComponentURL ) { OSL_ENSURE( m_xORB.is(), "DatabaseObjectView::DatabaseObjectView: invalid service factory!" ); OSL_ENSURE( m_xApplication.is(), "DatabaseObjectView::DatabaseObjectView: invalid connection!" ); @@ -98,32 +97,33 @@ namespace dbaui } //---------------------------------------------------------------------- - Reference< XComponent > DatabaseObjectView::createNew(const Reference< XDataSource >& _xDataSource ) + Reference< XComponent > DatabaseObjectView::createNew( const Reference< XDataSource >& _xDataSource, const ::comphelper::NamedValueCollection& i_rDispatchArgs ) { - return doCreateView( makeAny( _xDataSource ), ::rtl::OUString(), Sequence< PropertyValue >() ); + return doCreateView( makeAny( _xDataSource ), ::rtl::OUString(), i_rDispatchArgs ); } //---------------------------------------------------------------------- - Reference< XComponent > DatabaseObjectView::openExisting( const Any& _rDataSource, const ::rtl::OUString& _rName, const Sequence< PropertyValue >& _rArgs ) + Reference< XComponent > DatabaseObjectView::openExisting( const Any& _rDataSource, const ::rtl::OUString& _rName, + const ::comphelper::NamedValueCollection& i_rDispatchArgs ) { - return doCreateView( _rDataSource, _rName, _rArgs ); + return doCreateView( _rDataSource, _rName, i_rDispatchArgs ); } //---------------------------------------------------------------------- Reference< XComponent > DatabaseObjectView::doCreateView( const Any& _rDataSource, const ::rtl::OUString& _rObjectName, - const Sequence< PropertyValue >& _rCreationArgs ) + const ::comphelper::NamedValueCollection& i_rCreationArgs ) { - Sequence< PropertyValue > aDispatchArgs; - fillDispatchArgs( aDispatchArgs, _rDataSource, _rObjectName ); + ::comphelper::NamedValueCollection aDispatchArgs; - ::comphelper::NamedValueCollection aDispArgs( aDispatchArgs ); - aDispArgs.merge( _rCreationArgs, true ); + aDispatchArgs.merge( i_rCreationArgs, false ); // false => do not overwrite + fillDispatchArgs( aDispatchArgs, _rDataSource, _rObjectName ); + aDispatchArgs.merge( i_rCreationArgs, true ); // true => do overwrite - return doDispatch( aDispArgs.getPropertyValues() ); + return doDispatch( aDispatchArgs ); } //---------------------------------------------------------------------- - Reference< XComponent > DatabaseObjectView::doDispatch( const Sequence< PropertyValue >& _rArgs ) + Reference< XComponent > DatabaseObjectView::doDispatch( const ::comphelper::NamedValueCollection& i_rDispatchArgs ) { Reference< XComponent > xReturn; if ( m_xORB.is() ) @@ -163,7 +163,7 @@ namespace dbaui m_sComponentURL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_self")), 0, - _rArgs + i_rDispatchArgs.getPropertyValues() ); if ( !xReturn.is() ) @@ -179,29 +179,23 @@ namespace dbaui //---------------------------------------------------------------------- void DatabaseObjectView::fillDispatchArgs( - Sequence< PropertyValue >& _rDispatchArguments, + ::comphelper::NamedValueCollection& i_rDispatchArgs, const Any& _aDataSource, const ::rtl::OUString& /* _rName */ ) { - sal_Int32 nPos = _rDispatchArguments.getLength(); - _rDispatchArguments.realloc( nPos + 2 ); - ::rtl::OUString sDataSource; Reference<XDataSource> xDataSource; if ( _aDataSource >>= sDataSource ) { - _rDispatchArguments[nPos ].Name = PROPERTY_DATASOURCENAME; - _rDispatchArguments[nPos++].Value <<= sDataSource; + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_DATASOURCENAME, sDataSource ); } else if ( _aDataSource >>= xDataSource ) { - _rDispatchArguments[nPos ].Name = PROPERTY_DATASOURCE; - _rDispatchArguments[nPos++].Value <<= xDataSource; + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_DATASOURCE, xDataSource ); } - _rDispatchArguments[nPos ].Name = PROPERTY_ACTIVE_CONNECTION; - _rDispatchArguments[nPos++].Value <<= getConnection(); + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_ACTIVE_CONNECTION, getConnection() ); } //====================================================================== @@ -209,48 +203,32 @@ namespace dbaui //====================================================================== //---------------------------------------------------------------------- QueryDesigner::QueryDesigner( const Reference< XMultiServiceFactory >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, - const Reference< XFrame >& _rxParentFrame, - bool _bCreateView, sal_Bool _bPreferSQLView ) - :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast< ::rtl::OUString >( _bCreateView ? URL_COMPONENT_VIEWDESIGN : URL_COMPONENT_QUERYDESIGN ) ) + const Reference< XFrame >& _rxParentFrame, bool _bCreateView ) + :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, _bCreateView ? URL_COMPONENT_VIEWDESIGN : URL_COMPONENT_QUERYDESIGN ) ,m_nCommandType( _bCreateView ? CommandType::TABLE : CommandType::QUERY ) - ,m_bPreferSQLView( _bPreferSQLView ) { } //---------------------------------------------------------------------- - void QueryDesigner::fillDispatchArgs( Sequence< PropertyValue >& _rDispatchArguments, const Any& _aDataSource, + void QueryDesigner::fillDispatchArgs( ::comphelper::NamedValueCollection& i_rDispatchArgs, const Any& _aDataSource, const ::rtl::OUString& _rObjectName ) { - DatabaseObjectView::fillDispatchArgs( _rDispatchArguments, _aDataSource, _rObjectName ); + DatabaseObjectView::fillDispatchArgs( i_rDispatchArgs, _aDataSource, _rObjectName ); - bool bIncludeQueryName = 0 != _rObjectName.getLength(); - bool bEditViewAsSQLCommand = ( m_nCommandType == CommandType::TABLE ) && m_bPreferSQLView; + const bool bIncludeQueryName = 0 != _rObjectName.getLength(); + const bool bGraphicalDesign = i_rDispatchArgs.getOrDefault( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, sal_True ); + const bool bEditViewAsSQLCommand = ( m_nCommandType == CommandType::TABLE ) && !bGraphicalDesign; - sal_Int32 nPos = _rDispatchArguments.getLength(); - - sal_Int32 nNewLen = _rDispatchArguments.getLength() + 2; - if ( bIncludeQueryName ) - ++nNewLen; - if ( bEditViewAsSQLCommand ) - ++nNewLen; - _rDispatchArguments.realloc( nNewLen ); - - _rDispatchArguments[nPos ].Name = PROPERTY_GRAPHICAL_DESIGN; - _rDispatchArguments[nPos++].Value <<= ::cppu::bool2any( !m_bPreferSQLView ); - - _rDispatchArguments[nPos ].Name = PROPERTY_COMMAND_TYPE; - _rDispatchArguments[nPos++].Value <<= m_nCommandType; + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_COMMAND_TYPE, m_nCommandType ); if ( bIncludeQueryName ) { - _rDispatchArguments[nPos ].Name = PROPERTY_COMMAND; - _rDispatchArguments[nPos++].Value <<= _rObjectName; + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_COMMAND, _rObjectName ); } if ( bEditViewAsSQLCommand ) { - _rDispatchArguments[nPos ].Name = PROPERTY_ESCAPE_PROCESSING; - _rDispatchArguments[nPos++].Value <<= sal_Bool( sal_False ); + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_ESCAPE_PROCESSING, sal_False ); } } @@ -264,24 +242,20 @@ namespace dbaui } //---------------------------------------------------------------------- - void TableDesigner::fillDispatchArgs( Sequence< PropertyValue >& _rDispatchArguments, const Any& _aDataSource, + void TableDesigner::fillDispatchArgs( ::comphelper::NamedValueCollection& i_rDispatchArgs, const Any& _aDataSource, const ::rtl::OUString& _rObjectName ) { - DatabaseObjectView::fillDispatchArgs( _rDispatchArguments, _aDataSource, _rObjectName ); - sal_Bool bIncludeName = 0 != _rObjectName.getLength(); + DatabaseObjectView::fillDispatchArgs( i_rDispatchArgs, _aDataSource, _rObjectName ); - if (bIncludeName) + if ( 0 != _rObjectName.getLength() ) { - sal_Int32 nPos = _rDispatchArguments.getLength(); - _rDispatchArguments.realloc(_rDispatchArguments.getLength() + 1); - _rDispatchArguments[nPos ].Name = PROPERTY_CURRENTTABLE; - _rDispatchArguments[nPos++].Value <<= _rObjectName; + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_CURRENTTABLE, _rObjectName ); } } //---------------------------------------------------------------------- Reference< XComponent > TableDesigner::doCreateView( const Any& _rDataSource, const ::rtl::OUString& _rObjectName, - const Sequence< PropertyValue >& _rCreationArgs ) + const ::comphelper::NamedValueCollection& i_rCreationArgs ) { bool bIsNewDesign = ( _rObjectName.getLength() == 0 ); @@ -291,7 +265,7 @@ namespace dbaui xDesigner = impl_getConnectionProvidedDesigner_nothrow( _rObjectName ); if ( !xDesigner.is() ) - return DatabaseObjectView::doCreateView( _rDataSource, _rObjectName, _rCreationArgs ); + return DatabaseObjectView::doCreateView( _rDataSource, _rObjectName, i_rCreationArgs ); // try whether the designer is a dialog Reference< XExecutableDialog > xDialog( xDesigner, UNO_QUERY_THROW ); @@ -336,10 +310,10 @@ namespace dbaui } //---------------------------------------------------------------------- - void ResultSetBrowser::fillDispatchArgs(Sequence< PropertyValue >& _rDispatchArguments, const Any& _aDataSource, + void ResultSetBrowser::fillDispatchArgs( ::comphelper::NamedValueCollection& i_rDispatchArgs, const Any& _aDataSource, const ::rtl::OUString& _rQualifiedName) { - DatabaseObjectView::fillDispatchArgs( _rDispatchArguments, _aDataSource, _rQualifiedName ); + DatabaseObjectView::fillDispatchArgs( i_rDispatchArgs, _aDataSource, _rQualifiedName ); OSL_ENSURE( 0 != _rQualifiedName.getLength(),"A Table name must be set"); ::rtl::OUString sCatalog; ::rtl::OUString sSchema; @@ -347,26 +321,15 @@ namespace dbaui if ( m_bTable ) ::dbtools::qualifiedNameComponents( getConnection()->getMetaData(), _rQualifiedName, sCatalog, sSchema, sTable, ::dbtools::eInDataManipulation ); - sal_Int32 nPos = _rDispatchArguments.getLength(); - _rDispatchArguments.realloc( _rDispatchArguments.getLength() + 3 + ( m_bTable ? 3 : 0 ) ); - - _rDispatchArguments[nPos ].Name = PROPERTY_COMMAND_TYPE; - _rDispatchArguments[nPos++].Value <<= (m_bTable ? CommandType::TABLE : CommandType::QUERY); - - _rDispatchArguments[nPos ].Name = PROPERTY_COMMAND; - _rDispatchArguments[nPos++].Value <<= _rQualifiedName; - - _rDispatchArguments[nPos ].Name = PROPERTY_ENABLE_BROWSER; - _rDispatchArguments[nPos++].Value <<= sal_False; + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_COMMAND_TYPE, (m_bTable ? CommandType::TABLE : CommandType::QUERY) ); + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_COMMAND, _rQualifiedName ); + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_ENABLE_BROWSER, sal_False ); if ( m_bTable ) { - _rDispatchArguments[nPos ].Name = PROPERTY_UPDATE_CATALOGNAME; - _rDispatchArguments[nPos++].Value <<= sCatalog; - _rDispatchArguments[nPos ].Name = PROPERTY_UPDATE_SCHEMANAME; - _rDispatchArguments[nPos++].Value <<= sSchema; - _rDispatchArguments[nPos ].Name = PROPERTY_UPDATE_TABLENAME; - _rDispatchArguments[nPos++].Value <<= sTable; + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_UPDATE_CATALOGNAME, sCatalog ); + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_UPDATE_SCHEMANAME, sSchema ); + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_UPDATE_TABLENAME, sTable ); } } diff --git a/dbaccess/source/ui/misc/datasourceconnector.cxx b/dbaccess/source/ui/misc/datasourceconnector.cxx index 409e86150843..1fc25a14702c 100644 --- a/dbaccess/source/ui/misc/datasourceconnector.cxx +++ b/dbaccess/source/ui/misc/datasourceconnector.cxx @@ -195,9 +195,9 @@ namespace dbaui if ( !xHandler.is() ) { // instantiate the default SDB interaction handler - xHandler = Reference< XInteractionHandler >( m_xORB->createInstance( SERVICE_SDB_INTERACTION_HANDLER ), UNO_QUERY ); + xHandler = Reference< XInteractionHandler >( m_xORB->createInstance( SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY ); if ( !xHandler.is() ) - ShowServiceNotAvailableError(m_pErrorMessageParent, String(SERVICE_SDB_INTERACTION_HANDLER), sal_True); + ShowServiceNotAvailableError(m_pErrorMessageParent, (::rtl::OUString)SERVICE_TASK_INTERACTION_HANDLER, sal_True); } if ( xHandler.is() ) diff --git a/dbaccess/source/ui/misc/documentcontroller.cxx b/dbaccess/source/ui/misc/documentcontroller.cxx deleted file mode 100644 index 62400fdf1269..000000000000 --- a/dbaccess/source/ui/misc/documentcontroller.cxx +++ /dev/null @@ -1,140 +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 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/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx index 13549b72d84c..68bf52c49e5c 100644 --- a/dbaccess/source/ui/misc/linkeddocuments.cxx +++ b/dbaccess/source/ui/misc/linkeddocuments.cxx @@ -67,8 +67,8 @@ #ifndef _COM_SUN_STAR_UCB_XCOMMANDPROCESSOR_HPP_ #include <com/sun/star/ucb/XCommandProcessor.hpp> #endif -#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_ -#include <com/sun/star/ucb/OpenCommandArgument2.hpp> +#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT_HPP_ +#include <com/sun/star/ucb/OpenCommandArgument.hpp> #endif #ifndef _COM_SUN_STAR_UCB_OPENMODE_HPP_ #include <com/sun/star/ucb/OpenMode.hpp> @@ -155,6 +155,7 @@ namespace dbaui using namespace ::com::sun::star::util; using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::sdbc; + using namespace ::com::sun::star::sdb::application; using namespace ::com::sun::star::task; using namespace ::svt; @@ -192,17 +193,13 @@ namespace dbaui //================================================================== DBG_NAME(OLinkedDocumentsAccess) //------------------------------------------------------------------ - OLinkedDocumentsAccess::OLinkedDocumentsAccess(Window* _pDialogParent - , const Reference< XFrame >& _rxParentFrame - , const Reference< XMultiServiceFactory >& _rxORB - , const Reference< XNameAccess >& _rxContainer - , const Reference< XConnection>& _xConnection - , const ::rtl::OUString& _sDataSourceName - ) + OLinkedDocumentsAccess::OLinkedDocumentsAccess( Window* _pDialogParent, const Reference< XDatabaseDocumentUI >& i_rDocumentUI, + const Reference< XMultiServiceFactory >& _rxORB, const Reference< XNameAccess >& _rxContainer, + const Reference< XConnection>& _xConnection, const ::rtl::OUString& _sDataSourceName ) :m_xORB(_rxORB) ,m_xDocumentContainer(_rxContainer) ,m_xConnection(_xConnection) - ,m_xParentFrame(_rxParentFrame) + ,m_xDocumentUI( i_rDocumentUI ) ,m_pDialogParent(_pDialogParent) ,m_sDataSourceName(_sDataSourceName) { @@ -271,112 +268,101 @@ namespace dbaui return xRet; } //------------------------------------------------------------------ - Reference< XComponent> OLinkedDocumentsAccess::impl_newWithPilot( const char* _pWizardService, - Reference< XComponent >& _xDefinition, const sal_Int32 _nCommandType, const ::rtl::OUString& _rObjectName ) + void OLinkedDocumentsAccess::impl_newWithPilot( const char* _pWizardService, + const sal_Int32 _nCommandType, const ::rtl::OUString& _rObjectName ) { - Reference< XComponent> xRet; try { - ::svx::ODataAccessDescriptor aDesc; - aDesc.setDataSource(m_sDataSourceName); + ::comphelper::NamedValueCollection aArgs; + aArgs.put( "DataSourceName", m_sDataSourceName ); + + if ( m_xConnection.is() ) + aArgs.put( "ActiveConnection", m_xConnection ); + if ( _rObjectName.getLength() && ( _nCommandType != -1 ) ) { - aDesc[::svx::daCommandType] <<= _nCommandType; - aDesc[::svx::daCommand] <<= _rObjectName; + aArgs.put( "CommandType", _nCommandType ); + aArgs.put( "Command", _rObjectName ); } - if ( m_xConnection.is() ) - aDesc[::svx::daConnection] <<= m_xConnection; - Sequence<Any> aSeq = aDesc.createAnySequence(); - const sal_Int32 nLength = aSeq.getLength(); - aSeq.realloc(nLength + 1 ); - PropertyValue aVal; - aVal.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentFrame")); - aVal.Value <<= m_xParentFrame; - aSeq[nLength] <<= aVal; + aArgs.put( "DocumentUI", m_xDocumentUI ); - Reference< XJobExecutor > xFormWizard; + Reference< XJobExecutor > xWizard; { WaitObject aWaitCursor( m_pDialogParent ); - xFormWizard.set(m_xORB->createInstanceWithArguments(::rtl::OUString::createFromAscii(_pWizardService),aSeq),UNO_QUERY); - } - if ( xFormWizard.is() ) - { - xFormWizard->trigger(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("start"))); - Reference<XPropertySet> xProp(xFormWizard,UNO_QUERY); - if ( xProp.is() ) - { - Reference<XPropertySetInfo> xInfo = xProp->getPropertySetInfo(); - if ( xInfo->hasPropertyByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Document"))) ) - { - _xDefinition.set(xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentDefinition"))),UNO_QUERY); - xRet.set(xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Document"))),UNO_QUERY); - } - } - xFormWizard->trigger(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("end"))); - ::comphelper::disposeComponent(xFormWizard); + xWizard.set( m_xORB->createInstanceWithArguments( + ::rtl::OUString::createFromAscii( _pWizardService ), + aArgs.getWrappedPropertyValues() + ), UNO_QUERY_THROW ); } + + xWizard->trigger( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "start" ) ) ); + ::comphelper::disposeComponent( xWizard ); } catch(const Exception& e) { - (void) e; - OSL_ENSURE(sal_False, "OLinkedDocumentsAccess::newWithPilot: caught an exception while loading the object!"); + DBG_UNHANDLED_EXCEPTION(); } - return xRet; } //------------------------------------------------------------------ - Reference< XComponent> OLinkedDocumentsAccess::newFormWithPilot(Reference< XComponent >& _xDefinition,const sal_Int32 _nCommandType,const ::rtl::OUString& _rObjectName) + void OLinkedDocumentsAccess::newFormWithPilot( const sal_Int32 _nCommandType,const ::rtl::OUString& _rObjectName ) { - return impl_newWithPilot( "com.sun.star.wizards.form.CallFormWizard", _xDefinition, _nCommandType, _rObjectName ); + impl_newWithPilot( "com.sun.star.wizards.form.CallFormWizard", _nCommandType, _rObjectName ); } //------------------------------------------------------------------ - Reference< XComponent> OLinkedDocumentsAccess::newReportWithPilot( Reference< XComponent >& _xDefinition, const sal_Int32 _nCommandType, const ::rtl::OUString& _rObjectName ) + void OLinkedDocumentsAccess::newReportWithPilot( const sal_Int32 _nCommandType, const ::rtl::OUString& _rObjectName ) { - return impl_newWithPilot( "com.sun.star.wizards.report.CallReportWizard", _xDefinition, _nCommandType, _rObjectName ); + impl_newWithPilot( "com.sun.star.wizards.report.CallReportWizard", _nCommandType, _rObjectName ); } //------------------------------------------------------------------ - Reference< XComponent> OLinkedDocumentsAccess::newTableWithPilot() + void OLinkedDocumentsAccess::newTableWithPilot() { - Reference< XComponent > xDefinition; - return impl_newWithPilot( "com.sun.star.wizards.table.CallTableWizard", xDefinition, -1, ::rtl::OUString() ); + impl_newWithPilot( "com.sun.star.wizards.table.CallTableWizard", -1, ::rtl::OUString() ); } //------------------------------------------------------------------ - Reference< XComponent> OLinkedDocumentsAccess::newQueryWithPilot() + void OLinkedDocumentsAccess::newQueryWithPilot() { - Reference< XComponent > xDefinition; - return impl_newWithPilot( "com.sun.star.wizards.query.CallQueryWizard", xDefinition, -1, ::rtl::OUString() ); + impl_newWithPilot( "com.sun.star.wizards.query.CallQueryWizard", -1, ::rtl::OUString() ); } //------------------------------------------------------------------ - Reference< XComponent > OLinkedDocumentsAccess::newDocument( sal_Int32 _nNewFormId, Reference< XComponent >& _xDefinition, const sal_Int32 _nCommandType, const ::rtl::OUString& _sObjectName ) + Reference< XComponent > OLinkedDocumentsAccess::newDocument( sal_Int32 i_nActionID, + const ::comphelper::NamedValueCollection& i_rCreationArgs, Reference< XComponent >& o_rDefinition ) { OSL_ENSURE(m_xDocumentContainer.is(), "OLinkedDocumentsAccess::newDocument: invalid document container!"); - // determine the URL to use for the new document + // determine the class ID to use for the new document Sequence<sal_Int8> aClassId; - switch (_nNewFormId) + if ( !i_rCreationArgs.has( "ClassID" ) + && !i_rCreationArgs.has( "MediaType" ) + && !i_rCreationArgs.has( "DocumentServiceName" ) + ) { - case ID_FORM_NEW_TEXT: - aClassId = lcl_GetSequenceClassID(SO3_SW_CLASSID); - OSL_ENSURE(aClassId == comphelper::MimeConfigurationHelper::GetSequenceClassID(SO3_SW_CLASSID),"Not equal"); - break; + switch ( i_nActionID ) + { + case ID_FORM_NEW_TEXT: + aClassId = lcl_GetSequenceClassID(SO3_SW_CLASSID); + OSL_ENSURE(aClassId == comphelper::MimeConfigurationHelper::GetSequenceClassID(SO3_SW_CLASSID),"Not equal"); + break; - case ID_FORM_NEW_CALC: - aClassId = lcl_GetSequenceClassID(SO3_SC_CLASSID); - break; + case ID_FORM_NEW_CALC: + aClassId = lcl_GetSequenceClassID(SO3_SC_CLASSID); + break; - case ID_FORM_NEW_IMPRESS: - aClassId = lcl_GetSequenceClassID(SO3_SIMPRESS_CLASSID); - break; - case ID_REPORT_NEW_TEXT: - aClassId = comphelper::MimeConfigurationHelper::GetSequenceClassID(SO3_RPT_CLASSID_90); - break; + case ID_FORM_NEW_IMPRESS: + aClassId = lcl_GetSequenceClassID(SO3_SIMPRESS_CLASSID); + break; - case SID_DB_FORM_NEW_PILOT: - default: - OSL_ENSURE(sal_False, "OLinkedDocumentsAccess::newDocument: please use newFormWithPilot!"); - return Reference< XComponent >(); + case ID_REPORT_NEW_TEXT: + aClassId = comphelper::MimeConfigurationHelper::GetSequenceClassID(SO3_RPT_CLASSID_90); + break; + default: + OSL_ENSURE( sal_False, "OLinkedDocumentsAccess::newDocument: please use newFormWithPilot!" ); + return Reference< XComponent >(); + + } } + // load the document as template Reference< XComponent > xNewDocument; try @@ -385,36 +371,37 @@ namespace dbaui Reference<XMultiServiceFactory> xORB(m_xDocumentContainer,UNO_QUERY); if ( xORB.is() ) { - Sequence< Any > aArguments(2); - - PropertyValue aValue; - - aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ClassID")); - aValue.Value <<= aClassId; - aArguments[0] <<= aValue; - - aValue.Name = PROPERTY_ACTIVE_CONNECTION; - aValue.Value <<= m_xConnection; - aArguments[1] <<= aValue; - - Reference<XCommandProcessor> xContent(xORB->createInstanceWithArguments(SERVICE_SDB_DOCUMENTDEFINITION,aArguments),UNO_QUERY); - if ( xContent.is() ) + ::comphelper::NamedValueCollection aCreationArgs( i_rCreationArgs ); + if ( aClassId.getLength() ) + aCreationArgs.put( "ClassID", aClassId ); + aCreationArgs.put( (::rtl::OUString)PROPERTY_ACTIVE_CONNECTION, m_xConnection ); + + // separate values which are real creation args from args relevant for opening the doc + ::comphelper::NamedValueCollection aCommandArgs; + if ( aCreationArgs.has( "Hidden" ) ) { - _xDefinition.set(xContent,UNO_QUERY); - Command aCommand; - aCommand.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("openDesign")); - OpenCommandArgument2 aOpenCommand; - aOpenCommand.Mode = OpenMode::DOCUMENT; - aCommand.Argument <<= aOpenCommand; - WaitObject aWaitCursor( m_pDialogParent ); - xNewDocument.set(xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >()),UNO_QUERY); - Reference<XPropertySet> xProp(xNewDocument,UNO_QUERY); - if ( xProp.is() && _sObjectName.getLength() ) - { - xProp->setPropertyValue(PROPERTY_COMMAND_TYPE,makeAny(_nCommandType)); - xProp->setPropertyValue(PROPERTY_COMMAND,makeAny(_sObjectName)); - } + aCommandArgs.put( "Hidden", aCreationArgs.get( "Hidden" ) ); + aCreationArgs.remove( "Hidden" ); } + + Reference< XCommandProcessor > xContent( xORB->createInstanceWithArguments( + SERVICE_SDB_DOCUMENTDEFINITION, + aCreationArgs.getWrappedPropertyValues() + ), + UNO_QUERY_THROW + ); + o_rDefinition.set( xContent, UNO_QUERY ); + + // put the OpenMode into the OpenArgs + OpenCommandArgument aOpenModeArg; + aOpenModeArg.Mode = OpenMode::DOCUMENT; + aCommandArgs.put( "OpenMode", aOpenModeArg ); + + Command aCommand; + aCommand.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "openDesign" ) ); + aCommand.Argument <<= aCommandArgs.getPropertyValues(); + WaitObject aWaitCursor( m_pDialogParent ); + xNewDocument.set( xContent->execute( aCommand, xContent->createCommandIdentifier(), NULL ), UNO_QUERY ); } } catch(const Exception& ) 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 \ diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx index ecc898cbecbc..de2acf1d571d 100644 --- a/dbaccess/source/ui/misc/singledoccontroller.cxx +++ b/dbaccess/source/ui/misc/singledoccontroller.cxx @@ -97,6 +97,7 @@ namespace dbaui using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::frame::XUntitledNumbers; + using ::com::sun::star::beans::PropertyVetoException; /** === end UNO using === **/ class DataSourceHolder @@ -143,6 +144,9 @@ namespace dbaui OModuleClient m_aModuleClient; ::dbtools::SQLExceptionInfo m_aCurrentError; // contains the current error which can be set through IEnvironment + ::cppu::OInterfaceContainerHelper + m_aModifyListeners; + // <properties> SharedConnection m_xConnection; ::dbtools::DatabaseMetaData m_aSdbMetaData; @@ -157,8 +161,9 @@ namespace dbaui sal_Bool m_bModified; // is the data modified bool m_bNotAttached; - OSingleDocumentControllerImpl() + OSingleDocumentControllerImpl( ::osl::Mutex& i_rMutex ) :m_aDocScriptSupport() + ,m_aModifyListeners( i_rMutex ) ,m_nDocStartNumber(0) ,m_bSuspended( sal_False ) ,m_bEditable(sal_True) @@ -188,7 +193,7 @@ namespace dbaui //-------------------------------------------------------------------- OSingleDocumentController::OSingleDocumentController(const Reference< XMultiServiceFactory >& _rxORB) :OSingleDocumentController_Base( _rxORB ) - ,m_pImpl(new OSingleDocumentControllerImpl()) + ,m_pImpl( new OSingleDocumentControllerImpl( getMutex() ) ) { } @@ -543,15 +548,6 @@ namespace dbaui InvalidateFeature(ID_BROWSER_UNDO); InvalidateFeature(ID_BROWSER_REDO); } - // ----------------------------------------------------------------------------- - void OSingleDocumentController::setModified(sal_Bool _bModified) - { - m_pImpl->m_bModified = _bModified; - InvalidateFeature(ID_BROWSER_SAVEDOC); - - if ( isFeatureSupported( ID_BROWSER_SAVEASDOC ) ) - InvalidateFeature(ID_BROWSER_SAVEASDOC); - } // ----------------------------------------------------------------------------- ::rtl::OUString OSingleDocumentController::getDataSourceName() const @@ -594,12 +590,6 @@ namespace dbaui } // ----------------------------------------------------------------------------- - sal_Bool OSingleDocumentController::isModified() const - { - return m_pImpl->m_bModified; - } - - // ----------------------------------------------------------------------------- void OSingleDocumentController::setEditable(sal_Bool _bEditable) { m_pImpl->m_bEditable = _bEditable; @@ -705,6 +695,57 @@ namespace dbaui return Reference< XEmbeddedScripts >( getDatabaseDocument(), UNO_QUERY_THROW ); } + // ----------------------------------------------------------------------------- + void SAL_CALL OSingleDocumentController::addModifyListener( const Reference< XModifyListener >& i_Listener ) throw (RuntimeException) + { + ::osl::MutexGuard aGuard( getMutex() ); + m_pImpl->m_aModifyListeners.addInterface( i_Listener ); + } + + // ----------------------------------------------------------------------------- + void SAL_CALL OSingleDocumentController::removeModifyListener( const Reference< XModifyListener >& i_Listener ) throw (RuntimeException) + { + ::osl::MutexGuard aGuard( getMutex() ); + m_pImpl->m_aModifyListeners.removeInterface( i_Listener ); + } + + // ----------------------------------------------------------------------------- + ::sal_Bool SAL_CALL OSingleDocumentController::isModified( ) throw (RuntimeException) + { + ::osl::MutexGuard aGuard( getMutex() ); + return impl_isModified(); + } + + // ----------------------------------------------------------------------------- + void SAL_CALL OSingleDocumentController::setModified( ::sal_Bool i_bModified ) throw (PropertyVetoException, RuntimeException) + { + ::osl::ClearableMutexGuard aGuard( getMutex() ); + + if ( m_pImpl->m_bModified == i_bModified ) + return; + + m_pImpl->m_bModified = i_bModified; + impl_onModifyChanged(); + + EventObject aEvent( *this ); + aGuard.clear(); + m_pImpl->m_aModifyListeners.notifyEach( &XModifyListener::modified, aEvent ); + } + + // ----------------------------------------------------------------------------- + sal_Bool OSingleDocumentController::impl_isModified() const + { + return m_pImpl->m_bModified; + } + + // ----------------------------------------------------------------------------- + void OSingleDocumentController::impl_onModifyChanged() + { + InvalidateFeature( ID_BROWSER_SAVEDOC ); + if ( isFeatureSupported( ID_BROWSER_SAVEASDOC ) ) + InvalidateFeature( ID_BROWSER_SAVEASDOC ); + } + //........................................................................ } // namespace dbaui //........................................................................ diff --git a/dbaccess/source/ui/querydesign/JoinController.cxx b/dbaccess/source/ui/querydesign/JoinController.cxx index 95531ed3bbaa..0582230e0191 100644 --- a/dbaccess/source/ui/querydesign/JoinController.cxx +++ b/dbaccess/source/ui/querydesign/JoinController.cxx @@ -283,7 +283,7 @@ void OJoinController::disposing() OJoinController_BASE::disposing(); - m_pView = NULL; + clearView(); m_vTableConnectionData.clear(); m_vTableData.clear(); @@ -297,10 +297,10 @@ void OJoinController::reconnect( sal_Bool _bUI ) } // ----------------------------------------------------------------------------- -void OJoinController::setModified(sal_Bool _bModified) +void OJoinController::impl_onModifyChanged() { - OJoinController_BASE::setModified(_bModified); - InvalidateFeature(SID_RELATION_ADD_RELATION); + OJoinController_BASE::impl_onModifyChanged(); + InvalidateFeature( SID_RELATION_ADD_RELATION ); } // ----------------------------------------------------------------------------- void OJoinController::SaveTabWinPosSize(OTableWindow* pTabWin, long nOffsetX, long nOffsetY) @@ -329,9 +329,6 @@ FeatureState OJoinController::GetState(sal_uInt16 _nId) const case ID_BROWSER_EDITDOC: aReturn.bChecked = isEditable(); break; - case ID_BROWSER_SAVEDOC: - aReturn.bEnabled = isConnected() && isModified(); - break; case ID_BROWSER_ADDTABLE: aReturn.bEnabled = ( getView() != NULL ) && const_cast< OJoinController* >( this )->getJoinView()->getTableView()->IsAddAllowed(); @@ -458,73 +455,45 @@ sal_Bool SAL_CALL OJoinController::suspend(sal_Bool _bSuspend) throw( RuntimeExc return bCheck; } // ----------------------------------------------------------------------------- -void OJoinController::loadTableWindows(const Sequence<PropertyValue>& aViewProps) +void OJoinController::loadTableWindows( const ::comphelper::NamedValueCollection& i_rViewSettings ) { m_vTableData.clear(); - const PropertyValue *pIter = aViewProps.getConstArray(); - const PropertyValue *pEnd = pIter + aViewProps.getLength(); - for (; pIter != pEnd; ++pIter) + m_aMinimumTableViewSize = Point(); + + Sequence< PropertyValue > aWindowData; + aWindowData = i_rViewSettings.getOrDefault( "Tables", aWindowData ); + + const PropertyValue* pTablesIter = aWindowData.getConstArray(); + const PropertyValue* pTablesEnd = pTablesIter + aWindowData.getLength(); + for ( ; pTablesIter != pTablesEnd; ++pTablesIter ) { - if ( pIter->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Tables" ) ) ) - { - m_aMinimumTableViewSize = Point(); - Sequence<PropertyValue> aWindow; - pIter->Value >>= aWindow; - const PropertyValue *pTablesIter = aWindow.getConstArray(); - const PropertyValue *pTablesEnd = pTablesIter + aWindow.getLength(); - for (; pTablesIter != pTablesEnd; ++pTablesIter) - { - Sequence<PropertyValue> aTable; - pTablesIter->Value >>= aTable; - loadTableWindow(aTable); - } - if ( m_aMinimumTableViewSize != Point() ) - { - getJoinView()->getScrollHelper()->resetRange(m_aMinimumTableViewSize); - } - break; - } + ::comphelper::NamedValueCollection aSingleTableData( pTablesIter->Value ); + loadTableWindow( aSingleTableData ); + } + if ( m_aMinimumTableViewSize != Point() ) + { + getJoinView()->getScrollHelper()->resetRange( m_aMinimumTableViewSize ); } } + // ----------------------------------------------------------------------------- -void OJoinController::loadTableWindow(const Sequence<PropertyValue>& _rTable) +void OJoinController::loadTableWindow( const ::comphelper::NamedValueCollection& i_rTableWindowSettings ) { sal_Int32 nX = -1, nY = -1, nHeight = -1, nWidth = -1; ::rtl::OUString sComposedName,sTableName,sWindowName; sal_Bool bShowAll = false; - const PropertyValue *pIter = _rTable.getConstArray(); - const PropertyValue *pEnd = pIter + _rTable.getLength(); - for (; pIter != pEnd; ++pIter) - { - if ( pIter->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ComposedName" ) ) ) - pIter->Value >>= sComposedName; - else if ( pIter->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "TableName" ) ) ) - pIter->Value >>= sTableName; - else if ( pIter->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "WindowName" ) ) ) - pIter->Value >>= sWindowName; - else if ( pIter->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "WindowTop" ) ) ) - { - pIter->Value >>= nY; - } - else if ( pIter->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "WindowLeft" ) ) ) - { - pIter->Value >>= nX; - } - else if ( pIter->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "WindowWidth" ) ) ) - { - pIter->Value >>= nWidth; - } - else if ( pIter->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "WindowHeight" ) ) ) - { - pIter->Value >>= nHeight; - } - else if ( pIter->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ShowAll" ) ) ) - { - pIter->Value >>= bShowAll; - } - } + + sComposedName = i_rTableWindowSettings.getOrDefault( "ComposedName", sComposedName ); + sTableName = i_rTableWindowSettings.getOrDefault( "TableName", sTableName ); + sWindowName = i_rTableWindowSettings.getOrDefault( "WindowName", sWindowName ); + nY = i_rTableWindowSettings.getOrDefault( "WindowTop", nY ); + nX = i_rTableWindowSettings.getOrDefault( "WindowLeft", nX ); + nWidth = i_rTableWindowSettings.getOrDefault( "WindowWidth", nWidth ); + nHeight = i_rTableWindowSettings.getOrDefault( "WindowHeight", nHeight ); + bShowAll = i_rTableWindowSettings.getOrDefault( "ShowAll", bShowAll ); + TTableWindowData::value_type pData = createTableWindowData(sComposedName,sTableName,sWindowName); if ( pData ) { @@ -539,56 +508,31 @@ void OJoinController::loadTableWindow(const Sequence<PropertyValue>& _rTable) } } // ----------------------------------------------------------------------------- -void OJoinController::saveTableWindows(Sequence<PropertyValue>& _rViewProps) +void OJoinController::saveTableWindows( ::comphelper::NamedValueCollection& o_rViewSettings ) const { if ( !m_vTableData.empty() ) { - PropertyValue *pViewIter = _rViewProps.getArray(); - PropertyValue *pEnd = pViewIter + _rViewProps.getLength(); - const static ::rtl::OUString s_sTables(RTL_CONSTASCII_USTRINGPARAM("Tables")); - for (; pViewIter != pEnd && pViewIter->Name != s_sTables; ++pViewIter) - ; + ::comphelper::NamedValueCollection aAllTablesData; - if ( pViewIter == pEnd ) + TTableWindowData::const_iterator aIter = m_vTableData.begin(); + TTableWindowData::const_iterator aEnd = m_vTableData.end(); + for ( sal_Int32 i = 1; aIter != aEnd; ++aIter, ++i ) { - sal_Int32 nLen = _rViewProps.getLength(); - _rViewProps.realloc( nLen + 1 ); - pViewIter = _rViewProps.getArray() + nLen; - pViewIter->Name = s_sTables; + ::comphelper::NamedValueCollection aWindowData; + aWindowData.put( "ComposedName", (*aIter)->GetComposedName() ); + aWindowData.put( "TableName", (*aIter)->GetTableName() ); + aWindowData.put( "WindowName", (*aIter)->GetWinName() ); + aWindowData.put( "WindowTop", (*aIter)->GetPosition().Y() ); + aWindowData.put( "WindowLeft", (*aIter)->GetPosition().X() ); + aWindowData.put( "WindowWidth", (*aIter)->GetSize().Width() ); + aWindowData.put( "WindowHeight", (*aIter)->GetSize().Height() ); + aWindowData.put( "ShowAll", (*aIter)->IsShowAll() ); + + const ::rtl::OUString sTableName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Table" ) ) + ::rtl::OUString::valueOf( i ) ); + aAllTablesData.put( sTableName, aWindowData.getPropertyValues() ); } - Sequence<PropertyValue> aTables(m_vTableData.size()); - PropertyValue *pIter = aTables.getArray(); - - Sequence<PropertyValue> aWindow(8); - - TTableWindowData::iterator aIter = m_vTableData.begin(); - TTableWindowData::iterator aEnd = m_vTableData.end(); - for(sal_Int32 i = 1;aIter != aEnd;++aIter,++pIter,++i) - { - pIter->Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Table")) + ::rtl::OUString::valueOf(i); - - sal_Int32 nPos = 0; - aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ComposedName")); - aWindow[nPos++].Value <<= (*aIter)->GetComposedName(); - aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TableName")); - aWindow[nPos++].Value <<= (*aIter)->GetTableName(); - aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WindowName")); - aWindow[nPos++].Value <<= (*aIter)->GetWinName(); - aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WindowTop")); - aWindow[nPos++].Value <<= (*aIter)->GetPosition().Y(); - aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WindowLeft")); - aWindow[nPos++].Value <<= (*aIter)->GetPosition().X(); - aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WindowWidth")); - aWindow[nPos++].Value <<= (*aIter)->GetSize().Width(); - aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WindowHeight")); - aWindow[nPos++].Value <<= (*aIter)->GetSize().Height(); - aWindow[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowAll")); - aWindow[nPos++].Value <<= (*aIter)->IsShowAll(); - - pIter->Value <<= aWindow; - } - pViewIter->Value <<= aTables; + o_rViewSettings.put( "Tables", aAllTablesData.getPropertyValues() ); } } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index f482c99c5bb4..3f927076f4a9 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -1992,6 +1992,7 @@ namespace (*aIter) = NULL; OTableFields().swap( rUnUsedFields ); } + //------------------------------------------------------------------------------ SqlParseError InitFromParseNodeImpl(OQueryDesignView* _pView,OSelectionBrowseBox* _pSelectionBrw) { @@ -2605,7 +2606,7 @@ IMPL_LINK( OQueryDesignView, SplitHdl, void*, /*p*/ ) m_bInSplitHandler = sal_True; m_aSplitter.SetPosPixel( Point( m_aSplitter.GetPosPixel().X(),m_aSplitter.GetSplitPosPixel() ) ); static_cast<OQueryController&>(getController()).setSplitPos(m_aSplitter.GetSplitPosPixel()); - static_cast<OQueryController&>(getController()).setModified(); + static_cast<OQueryController&>(getController()).setModified( sal_True ); Resize(); m_bInSplitHandler = sal_True; } @@ -3180,6 +3181,30 @@ void OQueryDesignView::setNoneVisbleRow(sal_Int32 _nRows) { m_pSelectionBox->SetNoneVisbleRow(_nRows); } + +// ----------------------------------------------------------------------------- +void OQueryDesignView::initByFieldDescriptions( const Sequence< PropertyValue >& i_rFieldDescriptions ) +{ + OQueryController& rController = static_cast< OQueryController& >( getController() ); + + m_pSelectionBox->PreFill(); + m_pSelectionBox->SetReadOnly( rController.isReadOnly() ); + m_pSelectionBox->Fill(); + + for ( const PropertyValue* field = i_rFieldDescriptions.getConstArray(); + field != i_rFieldDescriptions.getConstArray() + i_rFieldDescriptions.getLength(); + ++field + ) + { + ::vos::ORef< OTableFieldDesc > pField( new OTableFieldDesc() ); + pField->Load( *field, true ); + InsertField( pField, sal_True, sal_False ); + } + + rController.getUndoMgr()->Clear(); + m_pSelectionBox->Invalidate(); +} + // ----------------------------------------------------------------------------- bool OQueryDesignView::initByParseIterator( ::dbtools::SQLExceptionInfo* _pErrorInfo ) { diff --git a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx index 36b7afe6d727..90ff0685e229 100644 --- a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx +++ b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx @@ -208,37 +208,68 @@ OQueryContainerWindow* OQueryViewSwitch::getContainer() const } // ----------------------------------------------------------------------------- -bool OQueryViewSwitch::switchView( ::dbtools::SQLExceptionInfo* _pErrorInfo ) +void OQueryViewSwitch::impl_forceSQLView() { - sal_Bool bRet = sal_True; - sal_Bool bGraphicalDesign = static_cast<OQueryController&>(m_pDesignView->getController()).isGraphicalDesign(); - OAddTableDlg* pAddTabDialog( getAddTableDialog() ); - OQueryContainerWindow* pContainer = getContainer(); + // hide the "Add Table" dialog + m_bAddTableDialogWasVisible = pAddTabDialog ? pAddTabDialog->IsVisible() : false; + if ( m_bAddTableDialogWasVisible ) + pAddTabDialog->Hide(); + + // tell the views they're in/active + m_pDesignView->stopTimer(); + m_pTextView->getSqlEdit()->startTimer(); + + // set the most recent statement at the text view + m_pTextView->clear(); + m_pTextView->setStatement(static_cast<OQueryController&>(m_pDesignView->getController()).getStatement()); +} + +// ----------------------------------------------------------------------------- +void OQueryViewSwitch::forceInitialView() +{ + OQueryController& rQueryController( static_cast< OQueryController& >( m_pDesignView->getController() ) ); + const sal_Bool bGraphicalDesign = rQueryController.isGraphicalDesign(); if ( !bGraphicalDesign ) + impl_forceSQLView(); + else { - // hide the "Add Table" dialog - m_bAddTableDialogWasVisible = pAddTabDialog ? pAddTabDialog->IsVisible() : false; - if ( m_bAddTableDialogWasVisible ) - pAddTabDialog->Hide(); + // tell the text view it's inactive now + m_pTextView->getSqlEdit()->stopTimer(); + + // update the "Add Table" dialog + OAddTableDlg* pAddTabDialog( getAddTableDialog() ); + if ( pAddTabDialog ) + pAddTabDialog->Update(); - // tell the views they're in/active - m_pDesignView->stopTimer(); - m_pTextView->getSqlEdit()->startTimer(); + // initialize the design view + m_pDesignView->initByFieldDescriptions( rQueryController.getFieldInformation() ); - // set the most recent statement at the text view - m_pTextView->clear(); - m_pTextView->setStatement(static_cast<OQueryController&>(m_pDesignView->getController()).getStatement()); + // tell the design view it's active now + m_pDesignView->startTimer(); + } + + impl_postViewSwitch( bGraphicalDesign, true ); +} + +// ----------------------------------------------------------------------------- +bool OQueryViewSwitch::switchView( ::dbtools::SQLExceptionInfo* _pErrorInfo ) +{ + sal_Bool bRet = sal_True; + sal_Bool bGraphicalDesign = static_cast<OQueryController&>(m_pDesignView->getController()).isGraphicalDesign(); + + if ( !bGraphicalDesign ) + { + impl_forceSQLView(); } else { // tell the text view it's inactive now m_pTextView->getSqlEdit()->stopTimer(); - ::rtl::OUString sOldStatement = static_cast<OQueryController&>(m_pDesignView->getController()).getStatement(); - // update the "Add Table" dialog + OAddTableDlg* pAddTabDialog( getAddTableDialog() ); if ( pAddTabDialog ) pAddTabDialog->Update(); @@ -249,24 +280,34 @@ bool OQueryViewSwitch::switchView( ::dbtools::SQLExceptionInfo* _pErrorInfo ) m_pDesignView->startTimer(); } - if ( bRet ) + return impl_postViewSwitch( bGraphicalDesign, bRet ); +} + +// ----------------------------------------------------------------------------- +bool OQueryViewSwitch::impl_postViewSwitch( const bool i_bGraphicalDesign, const bool i_bSuccess ) +{ + if ( i_bSuccess ) { - m_pTextView->Show ( !bGraphicalDesign ); - m_pDesignView->Show ( bGraphicalDesign ); - if ( bGraphicalDesign && m_bAddTableDialogWasVisible && pAddTabDialog ) - pAddTabDialog->Show(); + m_pTextView->Show ( !i_bGraphicalDesign ); + m_pDesignView->Show ( i_bGraphicalDesign ); + OAddTableDlg* pAddTabDialog( getAddTableDialog() ); + if ( pAddTabDialog ) + if ( i_bGraphicalDesign && m_bAddTableDialogWasVisible ) + pAddTabDialog->Show(); GrabFocus(); } + OQueryContainerWindow* pContainer = getContainer(); if ( pContainer ) pContainer->Resize(); m_pDesignView->getController().getUndoMgr()->Clear(); m_pDesignView->getController().InvalidateAll(); - return bRet; + return i_bSuccess; } + // ----------------------------------------------------------------------------- OAddTableDlg* OQueryViewSwitch::getAddTableDialog() { diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 16fd0a9211ef..0b37832245ae 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -1371,7 +1371,7 @@ void OSelectionBrowseBox::RemoveColumn(USHORT _nColumnId) ActivateCell( nCurrentRow, nCurCol ); - rController.setModified(); + rController.setModified( sal_True ); invalidateUndoRedo(); } @@ -1658,7 +1658,7 @@ void OSelectionBrowseBox::InsertColumn(OTableFieldDescRef pEntry, USHORT& _nColu Invalidate( aInvalidRect ); ActivateCell( nCurrentRow, nCurCol ); - static_cast<OQueryController&>(getDesignView()->getController()).setModified(); + static_cast<OQueryController&>(getDesignView()->getController()).setModified( sal_True ); invalidateUndoRedo(); } @@ -2036,7 +2036,7 @@ void OSelectionBrowseBox::CellModified() } break; } - static_cast<OQueryController&>(getDesignView()->getController()).setModified(); + static_cast<OQueryController&>(getDesignView()->getController()).setModified( sal_True ); } //------------------------------------------------------------------------------ @@ -2141,12 +2141,12 @@ void OSelectionBrowseBox::Command(const CommandEvent& rEvt) break; case ID_QUERY_DISTINCT: static_cast<OQueryController&>(getDesignView()->getController()).setDistinct(!static_cast<OQueryController&>(getDesignView()->getController()).isDistinct()); - static_cast<OQueryController&>(getDesignView()->getController()).setModified(); + static_cast<OQueryController&>(getDesignView()->getController()).setModified( sal_True ); static_cast<OQueryController&>(getDesignView()->getController()).InvalidateFeature( SID_QUERY_DISTINCT_VALUES ); break; } - static_cast<OQueryController&>(getDesignView()->getController()).setModified(); + static_cast<OQueryController&>(getDesignView()->getController()).setModified( sal_True ); } } else @@ -2479,7 +2479,7 @@ void OSelectionBrowseBox::SetCellContents(sal_Int32 nRow, USHORT nColId, const S if (bWasEditing) ActivateCell(nCellIndex, nColId); - static_cast<OQueryController&>(getDesignView()->getController()).setModified(); + static_cast<OQueryController&>(getDesignView()->getController()).setModified( sal_True ); } //------------------------------------------------------------------------------ sal_uInt32 OSelectionBrowseBox::GetTotalCellWidth(long nRow, sal_uInt16 nColId) const @@ -2507,7 +2507,7 @@ void OSelectionBrowseBox::ColumnResized(sal_uInt16 nColId) DBG_ASSERT(nPos <= getFields().size(),"ColumnResized:: nColId sollte nicht groesser als List::count sein!"); OTableFieldDescRef pEntry = getEntry(nPos-1); DBG_ASSERT(pEntry.isValid(), "OSelectionBrowseBox::ColumnResized : keine FieldDescription !"); - static_cast<OQueryController&>(getDesignView()->getController()).setModified(); + static_cast<OQueryController&>(getDesignView()->getController()).setModified( sal_True ); EditBrowseBox::ColumnResized(nColId); if ( pEntry.isValid()) diff --git a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx index a00bc3dbd54c..3ecb836692de 100644 --- a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx +++ b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx @@ -40,9 +40,9 @@ #ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ #include <com/sun/star/sdbc/DataType.hpp> #endif -#ifndef _COMPHELPER_STREAMSECTION_HXX_ -#include <comphelper/streamsection.hxx> -#endif +#include <comphelper/namedvaluecollection.hxx> + +#include <functional> using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::uno; @@ -99,7 +99,7 @@ OTableFieldDesc& OTableFieldDesc::operator=( const OTableFieldDesc& rRS ) if (&rRS == this) return *this; - m_vecCriteria = rRS.m_vecCriteria; + m_aCriteria = rRS.GetCriteria(); m_aTableName = rRS.GetTable(); m_aAliasName = rRS.GetAlias(); // table range m_aFieldName = rRS.GetField(); // column @@ -130,7 +130,7 @@ sal_Bool OTableFieldDesc::operator==( const OTableFieldDesc& rDesc ) m_aFieldName != rDesc.GetField() || m_aTableName != rDesc.GetTable() || m_bGroupBy != rDesc.IsGroupBy() || - m_vecCriteria != rDesc.GetCriteria() || + m_aCriteria != rDesc.GetCriteria() || m_bVisible != rDesc.IsVisible() ); } @@ -139,13 +139,13 @@ sal_Bool OTableFieldDesc::operator==( const OTableFieldDesc& rDesc ) void OTableFieldDesc::SetCriteria( sal_uInt16 nIdx, const ::rtl::OUString& rCrit) { DBG_CHKTHIS(OTableFieldDesc,NULL); - if (nIdx < m_vecCriteria.size()) - m_vecCriteria[nIdx] = rCrit; + if (nIdx < m_aCriteria.size()) + m_aCriteria[nIdx] = rCrit; else { - for(sal_Int32 i=m_vecCriteria.size();i<nIdx;++i) - m_vecCriteria.push_back( ::rtl::OUString()); - m_vecCriteria.push_back(rCrit); + for(sal_Int32 i=m_aCriteria.size();i<nIdx;++i) + m_aCriteria.push_back( ::rtl::OUString()); + m_aCriteria.push_back(rCrit); } } @@ -154,92 +154,94 @@ void OTableFieldDesc::SetCriteria( sal_uInt16 nIdx, const ::rtl::OUString& rCrit { DBG_CHKTHIS(OTableFieldDesc,NULL); ::rtl::OUString aRetStr; - if( nIdx < m_vecCriteria.size()) - aRetStr = m_vecCriteria[nIdx]; + if( nIdx < m_aCriteria.size()) + aRetStr = m_aCriteria[nIdx]; return aRetStr; } // ----------------------------------------------------------------------------- -void OTableFieldDesc::Load(const ::com::sun::star::beans::PropertyValue& _rProperty) +namespace { - DBG_CHKTHIS(OTableFieldDesc,NULL); - Sequence<PropertyValue> aFieldDesc; - _rProperty.Value >>= aFieldDesc; - //if ( aFieldDesc.getLength() == 12 ) + struct SelectPropertyValueAsString : public ::std::unary_function< PropertyValue, ::rtl::OUString > { - sal_Int32 nCount = aFieldDesc.getLength(); - for (sal_Int32 nPos = 0; nPos < nCount; ++nPos) + ::rtl::OUString operator()( const PropertyValue& i_rPropValue ) const { - if ( aFieldDesc[nPos].Name.equalsAscii("AliasName") ) - aFieldDesc[nPos].Value >>= m_aAliasName; - else if ( aFieldDesc[nPos].Name.equalsAscii("TableName") ) - aFieldDesc[nPos].Value >>= m_aTableName; - else if ( aFieldDesc[nPos].Name.equalsAscii("FieldName") ) - aFieldDesc[nPos].Value >>= m_aFieldName; - else if ( aFieldDesc[nPos].Name.equalsAscii("FieldAlias") ) - aFieldDesc[nPos].Value >>= m_aFieldAlias; - else if ( aFieldDesc[nPos].Name.equalsAscii("FunctionName") ) - aFieldDesc[nPos].Value >>= m_aFunctionName; - else if ( aFieldDesc[nPos].Name.equalsAscii("DataType") ) - aFieldDesc[nPos].Value >>= m_eDataType; - else if ( aFieldDesc[nPos].Name.equalsAscii("FunctionType") ) - aFieldDesc[nPos].Value >>= m_eFunctionType; - else if ( aFieldDesc[nPos].Name.equalsAscii("FieldType") ) - { - sal_Int32 nTemp = 0; - aFieldDesc[nPos].Value >>= nTemp; - m_eFieldType = static_cast<ETableFieldType>(nTemp); - } - else if ( aFieldDesc[nPos].Name.equalsAscii("OrderDir") ) - { - sal_Int32 nTemp = 0; - aFieldDesc[nPos].Value >>= nTemp; - m_eOrderDir = static_cast<EOrderDir>(nTemp); - } - else if ( aFieldDesc[nPos].Name.equalsAscii("ColWidth") ) - aFieldDesc[nPos].Value >>= m_nColWidth; - else if ( aFieldDesc[nPos].Name.equalsAscii("GroupBy") ) - aFieldDesc[nPos].Value >>= m_bGroupBy; - else if ( aFieldDesc[nPos].Name.equalsAscii("Visible") ) - aFieldDesc[nPos].Value >>= m_bVisible; + ::rtl::OUString sValue; + OSL_VERIFY( i_rPropValue.Value >>= sValue ); + return sValue; } + }; +} + +// ----------------------------------------------------------------------------- +void OTableFieldDesc::Load( const ::com::sun::star::beans::PropertyValue& i_rSettings, const bool i_bIncludingCriteria ) +{ + DBG_CHKTHIS(OTableFieldDesc,NULL); + + ::comphelper::NamedValueCollection aFieldDesc( i_rSettings.Value ); + m_aAliasName = aFieldDesc.getOrDefault( "AliasName", m_aAliasName ); + m_aTableName = aFieldDesc.getOrDefault( "TableName", m_aTableName ); + m_aFieldName = aFieldDesc.getOrDefault( "FieldName", m_aFieldName ); + m_aFieldAlias = aFieldDesc.getOrDefault( "FieldAlias", m_aFieldAlias ); + m_aFunctionName = aFieldDesc.getOrDefault( "FunctionName", m_aFunctionName ); + m_eDataType = aFieldDesc.getOrDefault( "DataType", m_eDataType ); + m_eFunctionType = aFieldDesc.getOrDefault( "FunctionType", m_eFunctionType ); + m_nColWidth = aFieldDesc.getOrDefault( "ColWidth", m_nColWidth ); + m_bGroupBy = aFieldDesc.getOrDefault( "GroupBy", m_bGroupBy ); + m_bVisible = aFieldDesc.getOrDefault( "Visible", m_bVisible ); + + m_eFieldType = static_cast< ETableFieldType >( aFieldDesc.getOrDefault( "FieldType", static_cast< sal_Int32 >( m_eFieldType ) ) ); + m_eOrderDir = static_cast< EOrderDir >( aFieldDesc.getOrDefault( "OrderDir", static_cast< sal_Int32 >( m_eOrderDir ) ) ); + + if ( i_bIncludingCriteria ) + { + const Sequence< PropertyValue > aCriteria( aFieldDesc.getOrDefault( "Criteria", Sequence< PropertyValue >() ) ); + m_aCriteria.resize( aCriteria.getLength() ); + ::std::transform( + aCriteria.getConstArray(), + aCriteria.getConstArray() + aCriteria.getLength(), + m_aCriteria.begin(), + SelectPropertyValueAsString() + ); } } //------------------------------------------------------------------------------ -void OTableFieldDesc::Save(::com::sun::star::beans::PropertyValue& _rProperty) +void OTableFieldDesc::Save( ::comphelper::NamedValueCollection& o_rSettings, const bool i_bIncludingCriteria ) { DBG_CHKTHIS(OTableFieldDesc,NULL); + o_rSettings.put( "AliasName", m_aAliasName ); + o_rSettings.put( "TableName", m_aTableName ); + o_rSettings.put( "FieldName", m_aFieldName ); + o_rSettings.put( "FieldAlias", m_aFieldAlias ); + o_rSettings.put( "FunctionName", m_aFunctionName ); + o_rSettings.put( "DataType", m_eDataType ); + o_rSettings.put( "FunctionType", (sal_Int32)m_eFunctionType ); + o_rSettings.put( "FieldType", (sal_Int32)m_eFieldType ); + o_rSettings.put( "OrderDir", (sal_Int32)m_eOrderDir ); + o_rSettings.put( "ColWidth", m_nColWidth ); + o_rSettings.put( "GroupBy", m_bGroupBy ); + o_rSettings.put( "Visible", m_bVisible ); + + if ( i_bIncludingCriteria ) + { + if ( !m_aCriteria.empty() ) + { + sal_Int32 c = 0; + Sequence< PropertyValue > aCriteria( m_aCriteria.size() ); + for ( ::std::vector< ::rtl::OUString >::const_iterator crit = m_aCriteria.begin(); + crit != m_aCriteria.end(); + ++crit, ++c + ) + { + aCriteria[c].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Criterion_" ) ) + ::rtl::OUString::valueOf( c ); + aCriteria[c].Value <<= *crit; + } - Sequence<PropertyValue> aFieldDesc(13); - sal_Int32 nPos = 0; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AliasName")); - aFieldDesc[nPos++].Value <<= m_aAliasName; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TableName")); - aFieldDesc[nPos++].Value <<= m_aTableName; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldName")); - aFieldDesc[nPos++].Value <<= m_aFieldName; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldAlias")); - aFieldDesc[nPos++].Value <<= m_aFieldAlias; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FunctionName")); - aFieldDesc[nPos++].Value <<= m_aFunctionName; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataType")); - aFieldDesc[nPos++].Value <<= m_eDataType; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FunctionType")); - aFieldDesc[nPos++].Value <<= (sal_Int32)m_eFunctionType; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldType")); - aFieldDesc[nPos++].Value <<= (sal_Int32)m_eFieldType; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OrderDir")); - aFieldDesc[nPos++].Value <<= (sal_Int32)m_eOrderDir; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ColWidth")); - aFieldDesc[nPos++].Value <<= m_nColWidth; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GroupBy")); - aFieldDesc[nPos++].Value <<= m_bGroupBy; - aFieldDesc[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Visible")); - aFieldDesc[nPos++].Value <<= m_bVisible; - - _rProperty.Value <<= aFieldDesc; + o_rSettings.put( "Criteria", aCriteria ); + } + } } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx index 785e29bb9a0c..91e85454a399 100644 --- a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx +++ b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx @@ -126,6 +126,12 @@ namespace dbaui } // ----------------------------------------------------------------------------- + void OQueryContainerWindow::forceInitialView() + { + return m_pViewSwitch->forceInitialView(); + } + + // ----------------------------------------------------------------------------- void OQueryContainerWindow::resizeAll( const Rectangle& _rPlayground ) { Rectangle aPlayground( _rPlayground ); diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index ca1bc56f01ef..380c8646c5bf 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -81,6 +81,7 @@ #include <comphelper/basicio.hxx> #include <comphelper/extract.hxx> +#include <comphelper/property.hxx> #include <comphelper/seqstream.hxx> #include <comphelper/streamsection.hxx> #include <comphelper/types.hxx> @@ -374,6 +375,50 @@ Reference< XPropertySetInfo > SAL_CALL OQueryController::getPropertySetInfo() th } //------------------------------------------------------------------------- +sal_Bool SAL_CALL OQueryController::convertFastPropertyValue( Any& o_rConvertedValue, Any& o_rOldValue, sal_Int32 i_nHandle, const Any& i_rValue ) throw (IllegalArgumentException) +{ + return OPropertyContainer::convertFastPropertyValue( o_rConvertedValue, o_rOldValue, i_nHandle, i_rValue ); +} + +//------------------------------------------------------------------------- +void SAL_CALL OQueryController::setFastPropertyValue_NoBroadcast( sal_Int32 i_nHandle, const Any& i_rValue ) throw ( Exception ) +{ + OPropertyContainer::setFastPropertyValue_NoBroadcast( i_nHandle, i_rValue ); +} + +//------------------------------------------------------------------------- +void SAL_CALL OQueryController::getFastPropertyValue( Any& o_rValue, sal_Int32 i_nHandle ) const +{ + switch ( i_nHandle ) + { + case PROPERTY_ID_CURRENT_QUERY_DESIGN: + { + ::comphelper::NamedValueCollection aCurrentDesign; + aCurrentDesign.put( "GraphicalDesign", isGraphicalDesign() ); + aCurrentDesign.put( (::rtl::OUString)PROPERTY_ESCAPE_PROCESSING, m_bEscapeProcessing ); + + if ( isGraphicalDesign() ) + { + getContainer()->SaveUIConfig(); + saveViewSettings( aCurrentDesign, true ); + aCurrentDesign.put( "Statement", m_sStatement ); + } + else + { + aCurrentDesign.put( "Statement", getContainer()->getStatement() ); + } + + o_rValue <<= aCurrentDesign.getPropertyValues(); + } + break; + + default: + OPropertyContainer::getFastPropertyValue( o_rValue, i_nHandle ); + break; + } +} + +//------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper& OQueryController::getInfoHelper() { return *const_cast< OQueryController* >( this )->getArrayHelper(); @@ -383,7 +428,24 @@ Reference< XPropertySetInfo > SAL_CALL OQueryController::getPropertySetInfo() th ::cppu::IPropertyArrayHelper* OQueryController::createArrayHelper( ) const { Sequence< Property > aProps; - describeProperties(aProps); + describeProperties( aProps ); + + // one additional property: + const sal_Int32 nLength = aProps.getLength(); + aProps.realloc( nLength + 1 ); + aProps[ nLength ] = Property( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CurrentQueryDesign" ) ), + PROPERTY_ID_CURRENT_QUERY_DESIGN, + ::cppu::UnoType< Sequence< PropertyValue > >::get(), + PropertyAttribute::READONLY + ); + + ::std::sort( + aProps.getArray(), + aProps.getArray() + aProps.getLength(), + ::comphelper::PropertyCompareByName() + ); + return new ::cppu::OPropertyArrayHelper(aProps); } @@ -448,7 +510,7 @@ FeatureState OQueryController::GetState(sal_uInt16 _nId) const aReturn.bEnabled = !editingCommand() && !editingView() && (!m_bGraphicalDesign || !(m_vTableFieldDesc.empty() || m_vTableData.empty())); break; case ID_BROWSER_SAVEDOC: - aReturn.bEnabled = isModified() && (!m_bGraphicalDesign || !(m_vTableFieldDesc.empty() || m_vTableData.empty())); + aReturn.bEnabled = impl_isModified() && (!m_bGraphicalDesign || !(m_vTableFieldDesc.empty() || m_vTableData.empty())); break; case SID_PRINTDOCDIRECT: break; @@ -797,6 +859,9 @@ void OQueryController::impl_initialize() ::rtl::OUString sCommand; m_nCommandType = CommandType::QUERY; + // + // reading parameters + // // legacy parameters first (later overwritten by regular parameters) ::rtl::OUString sIndependentSQLCommand; if ( rArguments.get_ensureType( "IndependentSQLCommand", sIndependentSQLCommand ) ) @@ -866,6 +931,37 @@ void OQueryController::impl_initialize() m_bGraphicalDesign = false; } + // ................................................................................................................. + // . initial design + bool bForceInitialDesign = false; + Sequence< PropertyValue > aCurrentQueryDesignProps; + aCurrentQueryDesignProps = rArguments.getOrDefault( "CurrentQueryDesign", aCurrentQueryDesignProps ); + + if ( aCurrentQueryDesignProps.getLength() ) + { + ::comphelper::NamedValueCollection aCurrentQueryDesign( aCurrentQueryDesignProps ); + if ( aCurrentQueryDesign.has( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN ) ) + { + aCurrentQueryDesign.get_ensureType( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, m_bGraphicalDesign ); + } + if ( aCurrentQueryDesign.has( (::rtl::OUString)PROPERTY_ESCAPE_PROCESSING ) ) + { + aCurrentQueryDesign.get_ensureType( (::rtl::OUString)PROPERTY_ESCAPE_PROCESSING, m_bEscapeProcessing ); + } + if ( aCurrentQueryDesign.has( "Statement" ) ) + { + ::rtl::OUString sStatement; + aCurrentQueryDesign.get_ensureType( "Statement", sStatement ); + aCurrentQueryDesign.remove( "Statement" ); + setStatement_fireEvent( sStatement ); + } + + loadViewSettings( aCurrentQueryDesign ); + + bForceInitialDesign = true; + } + + // if ( !ensureConnected( sal_False ) ) { // we have no connection so what else should we do m_bGraphicalDesign = sal_False; @@ -920,20 +1016,30 @@ void OQueryController::impl_initialize() try { getContainer()->initialize(); - impl_reset(); + impl_reset( bForceInitialDesign ); - bool bAttemptedGraphicalDesign = m_bGraphicalDesign; SQLExceptionInfo aError; - impl_setViewMode( &aError ); + const bool bAttemptedGraphicalDesign = m_bGraphicalDesign; + + if ( bForceInitialDesign ) + { + getContainer()->forceInitialView(); + } + else + { + impl_setViewMode( &aError ); + } + if ( aError.isValid() && bAttemptedGraphicalDesign && !m_bGraphicalDesign ) { + // we tried initializing the graphical view, this failed, and we were automatically switched to SQL + // view => tell this to the user if ( !editingView() ) { impl_showAutoSQLViewError( aError.get() ); } } - getUndoMgr()->Clear(); if ( ( m_bGraphicalDesign ) @@ -1014,7 +1120,7 @@ sal_Bool OQueryController::Construct(Window* pParent) { // TODO: we have to check if we should create the text- or the design- view - m_pView = new OQueryContainerWindow( pParent, *this, getORB() ); + setView( * new OQueryContainerWindow( pParent, *this, getORB() ) ); return OJoinController::Construct(pParent); } @@ -1046,9 +1152,9 @@ void OQueryController::describeSupportedFeatures() #endif } // ----------------------------------------------------------------------------- -void OQueryController::setModified(sal_Bool _bModified) +void OQueryController::impl_onModifyChanged() { - OJoinController::setModified(_bModified); + OJoinController::impl_onModifyChanged(); InvalidateFeature(SID_BROWSER_CLEAR_QUERY); InvalidateFeature(ID_BROWSER_SAVEASDOC); InvalidateFeature(ID_BROWSER_QUERY_EXECUTE); @@ -1096,69 +1202,41 @@ void OQueryController::reconnect(sal_Bool _bUI) InvalidateAll(); } } + // ----------------------------------------------------------------------------- -void OQueryController::saveViewSettings(Sequence<PropertyValue>& _rViewProps) +void OQueryController::saveViewSettings( ::comphelper::NamedValueCollection& o_rViewSettings, const bool i_includingCriteria ) const { - OTableFields::const_iterator aFieldIter = m_vTableFieldDesc.begin(); - OTableFields::const_iterator aFieldEnd = m_vTableFieldDesc.end(); - sal_Int32 nCount = 0; - for(;aFieldIter != aFieldEnd;++aFieldIter) - { - if(!(*aFieldIter)->IsEmpty()) - ++nCount; - } - - sal_Int32 nLen = _rViewProps.getLength(); + saveTableWindows( o_rViewSettings ); - _rViewProps.realloc( nLen + 2 + (nCount != 0 ? 1 : 0) ); - PropertyValue *pIter = _rViewProps.getArray() + nLen; + OTableFields::const_iterator field = m_vTableFieldDesc.begin(); + OTableFields::const_iterator fieldEnd = m_vTableFieldDesc.end(); - if ( nCount != 0 ) + ::comphelper::NamedValueCollection aAllFieldsData; + ::comphelper::NamedValueCollection aFieldData; + for ( sal_Int32 i = 1; field != fieldEnd; ++field, ++i ) { - pIter->Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fields")); - - Sequence<PropertyValue> aFields(nCount); - PropertyValue *pFieldsIter = aFields.getArray(); - // the fielddata - aFieldIter = m_vTableFieldDesc.begin(); - for(sal_Int32 i = 1;aFieldIter !=aFieldEnd;++aFieldIter,++i) + if ( !(*field)->IsEmpty() ) { - if ( !(*aFieldIter)->IsEmpty() ) - { - pFieldsIter->Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Field")) + ::rtl::OUString::valueOf(i); - (*aFieldIter)->Save(*pFieldsIter++); - } + aFieldData.clear(); + (*field)->Save( aFieldData, i_includingCriteria ); + + const ::rtl::OUString sFieldSettingName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Field" ) ) + ::rtl::OUString::valueOf( i ); + aAllFieldsData.put( sFieldSettingName, aFieldData.getPropertyValues() ); } - pIter->Value <<= aFields; - ++pIter; } - pIter->Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SplitterPosition")); - pIter->Value <<= m_nSplitPos; - ++pIter; - pIter->Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleRows")); - pIter->Value <<= m_nVisibleRows; + o_rViewSettings.put( "Fields", aAllFieldsData.getPropertyValues() ); + o_rViewSettings.put( "SplitterPosition", m_nSplitPos ); + o_rViewSettings.put( "VisibleRows", m_nVisibleRows ); } // ----------------------------------------------------------------------------- -void OQueryController::loadViewSettings(const Sequence<PropertyValue>& _rViewProps) +void OQueryController::loadViewSettings( const ::comphelper::NamedValueCollection& o_rViewSettings ) { - const PropertyValue *pIter = _rViewProps.getConstArray(); - const PropertyValue *pEnd = pIter + _rViewProps.getLength(); - for (; pIter != pEnd; ++pIter) - { - if ( pIter->Name.equalsAscii("SplitterPosition") ) - { - pIter->Value >>= m_nSplitPos; - } - else if ( pIter->Name.equalsAscii("VisibleRows") ) - { - pIter->Value >>= m_nVisibleRows; - } - else if ( pIter->Name.equalsAscii("Fields") ) - { - pIter->Value >>= m_aFieldInformation; - } - } + loadTableWindows( o_rViewSettings ); + + m_nSplitPos = o_rViewSettings.getOrDefault( "SplitterPosition", m_nSplitPos ); + m_nVisibleRows = o_rViewSettings.getOrDefault( "VisibleRows", m_nVisibleRows ); + m_aFieldInformation = o_rViewSettings.getOrDefault( "Fields", m_aFieldInformation ); } // ----------------------------------------------------------------------------- sal_Int32 OQueryController::getColWidth(sal_uInt16 _nColPos) const @@ -1166,7 +1244,7 @@ sal_Int32 OQueryController::getColWidth(sal_uInt16 _nColPos) const if ( _nColPos < m_aFieldInformation.getLength() ) { ::std::auto_ptr<OTableFieldDesc> pField( new OTableFieldDesc()); - pField->Load(m_aFieldInformation[_nColPos]); + pField->Load( m_aFieldInformation[ _nColPos ], false ); return pField->GetColWidth(); } return 0; @@ -1438,12 +1516,7 @@ bool OQueryController::doSaveAsDoc(sal_Bool _bSaveAs) xQuery->setPropertyValue( PROPERTY_UPDATE_TABLENAME, makeAny( m_sUpdateTableName ) ); xQuery->setPropertyValue( PROPERTY_ESCAPE_PROCESSING,::cppu::bool2any( m_bEscapeProcessing ) ); - // layout information - getContainer()->SaveUIConfig(); - Sequence< PropertyValue > aLayout; - saveTableWindows( aLayout ); - saveViewSettings( aLayout ); - xQuery->setPropertyValue( PROPERTY_LAYOUTINFORMATION, makeAny( aLayout ) ); + xQuery->setPropertyValue( PROPERTY_LAYOUTINFORMATION, getViewData() ); } } @@ -1591,13 +1664,13 @@ short OQueryController::saveModified() return nRet; } // ----------------------------------------------------------------------------- -void OQueryController::impl_reset() +void OQueryController::impl_reset( const bool i_bForceCurrentControllerSettings ) { bool bValid = false; Sequence< PropertyValue > aLayoutInformation; // get command from the query if a query name was supplied - if ( !editingCommand() ) + if ( !i_bForceCurrentControllerSettings && !editingCommand() ) { if ( m_sName.getLength() ) { @@ -1647,15 +1720,14 @@ void OQueryController::impl_reset() { try { - // load the layoutInformation - loadTableWindows(aLayoutInformation); - loadViewSettings(aLayoutInformation); + loadViewSettings( aLayoutInformation ); } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } } + if ( m_sStatement.getLength() ) { setQueryComposer(); @@ -1679,7 +1751,7 @@ void OQueryController::impl_reset() m_pSqlIterator->traverseAll(); if ( m_pSqlIterator->hasErrors() ) { - if ( !editingView() ) + if ( !i_bForceCurrentControllerSettings && !editingView() ) { impl_showAutoSQLViewError( makeAny( m_pSqlIterator->getErrors() ) ); } @@ -1688,7 +1760,7 @@ void OQueryController::impl_reset() } else { - if ( !editingView() ) + if ( !i_bForceCurrentControllerSettings && !editingView() ) { String aTitle(ModuleRes(STR_SVT_SQL_SYNTAX_ERROR)); OSQLMessageBox aDlg(getView(),aTitle,aErrorMsg); @@ -1776,6 +1848,23 @@ bool OQueryController::allowQueries() const } // ----------------------------------------------------------------------------- +Any SAL_CALL OQueryController::getViewData() throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( getMutex() ); + + getContainer()->SaveUIConfig(); + + ::comphelper::NamedValueCollection aViewSettings; + saveViewSettings( aViewSettings, false ); + + return makeAny( aViewSettings.getPropertyValues() ); +} +// ----------------------------------------------------------------------------- +void SAL_CALL OQueryController::restoreViewData(const Any& /*Data*/) throw( RuntimeException ) +{ + // TODO +} + // ----------------------------------------------------------------------------- } // namespace dbaui // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx index 3bd2aa12a8ae..d59ef63642e0 100644 --- a/dbaccess/source/ui/relationdesign/RelationController.cxx +++ b/dbaccess/source/ui/relationdesign/RelationController.cxx @@ -160,7 +160,7 @@ FeatureState ORelationController::GetState(sal_uInt16 _nId) const aReturn.bChecked = false; break; case ID_BROWSER_SAVEDOC: - aReturn.bEnabled = haveDataSource() && isModified(); + aReturn.bEnabled = haveDataSource() && impl_isModified(); break; default: aReturn = OJoinController::GetState(_nId); @@ -189,20 +189,21 @@ void ORelationController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue { if ( haveDataSource() && getDataSource()->getPropertySetInfo()->hasPropertyByName(PROPERTY_LAYOUTINFORMATION) ) { - Sequence<PropertyValue> aWindows; - saveTableWindows(aWindows); - getDataSource()->setPropertyValue(PROPERTY_LAYOUTINFORMATION,makeAny(aWindows)); + ::comphelper::NamedValueCollection aWindowsData; + saveTableWindows( aWindowsData ); + getDataSource()->setPropertyValue( PROPERTY_LAYOUTINFORMATION, makeAny( aWindowsData.getPropertyValues() ) ); setModified(sal_False); } } - catch(Exception&) + catch ( const Exception& ) { + DBG_UNHANDLED_EXCEPTION(); } } } break; case SID_RELATION_ADD_RELATION: - static_cast<ORelationTableView*>(static_cast<ORelationDesignView*>(m_pView)->getTableView())->AddNewRelation(); + static_cast<ORelationTableView*>(static_cast<ORelationDesignView*>( getView() )->getTableView())->AddNewRelation(); break; default: OJoinController::Execute(_nId,aArgs); @@ -263,10 +264,8 @@ void ORelationController::impl_initialize() // ----------------------------------------------------------------------------- sal_Bool ORelationController::Construct(Window* pParent) { - m_pView = new ORelationDesignView( pParent, *this, getORB() ); + setView( * new ORelationDesignView( pParent, *this, getORB() ) ); OJoinController::Construct(pParent); -// m_pView->Construct(); -// m_pView->Show(); return sal_True; } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index 1eed02543cda..7bce4d10ec70 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -207,7 +207,7 @@ void OTableController::stopTableListening() void OTableController::disposing() { OTableController_BASE::disposing(); - m_pView = NULL; + clearView(); m_vRowList.clear(); } @@ -227,7 +227,7 @@ FeatureState OTableController::GetState(sal_uInt16 _nId) const aReturn.bEnabled = m_bNew || isEditable();// the editable flag is set through this one -> || isAddAllowed() || isDropAllowed() || isAlterAllowed(); break; case ID_BROWSER_SAVEDOC: - aReturn.bEnabled = isModified(); + aReturn.bEnabled = impl_isModified(); if ( aReturn.bEnabled ) { ::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aIter = ::std::find_if(m_vRowList.begin(),m_vRowList.end(), @@ -256,7 +256,7 @@ FeatureState OTableController::GetState(sal_uInt16 _nId) const break; case SID_INDEXDESIGN: aReturn.bEnabled = - ( ( ((!m_bNew && isModified()) || isModified()) + ( ( ((!m_bNew && impl_isModified()) || impl_isModified()) || Reference< XIndexesSupplier >(m_xTable, UNO_QUERY).is() ) && isConnected() @@ -579,7 +579,7 @@ void OTableController::impl_initialize() // ----------------------------------------------------------------------------- sal_Bool OTableController::Construct(Window* pParent) { - m_pView = new OTableDesignView( pParent, getORB(), *this ); + setView( * new OTableDesignView( pParent, getORB(), *this ) ); OTableController_BASE::Construct(pParent); // m_pView->Construct(); // m_pView->Show(); @@ -671,10 +671,10 @@ SfxUndoManager* OTableController::getUndoMgr() return &m_aUndoManager; } // ----------------------------------------------------------------------------- -void OTableController::setModified(sal_Bool _bModified) +void OTableController::impl_onModifyChanged() { - OSingleDocumentController::setModified(_bModified); - InvalidateFeature(SID_INDEXDESIGN); + OSingleDocumentController::impl_onModifyChanged(); + InvalidateFeature( SID_INDEXDESIGN ); } // ----------------------------------------------------------------------------- void SAL_CALL OTableController::disposing( const EventObject& _rSource ) throw(RuntimeException) diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index aa2b87fca329..4352cdbf548f 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -1521,7 +1521,7 @@ void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments ) ); } if ( !m_xInteractionHandler.is() ) - m_xInteractionHandler.set( m_aContext.createComponent( "com.sun.star.sdb.InteractionHandler" ), UNO_QUERY_THROW ); + m_xInteractionHandler.set( m_aContext.createComponent( "com.sun.star.task.InteractionHandler" ), UNO_QUERY_THROW ); InteractionHandler xSourceDocHandler; Reference< XPropertySet > xSourceDescriptor( impl_ensureDataAccessDescriptor_throw( _rArguments, 0, m_xSourceConnection, xSourceDocHandler ) ); diff --git a/dbaccess/source/ui/uno/dbinteraction.cxx b/dbaccess/source/ui/uno/dbinteraction.cxx index b1290f9ee0be..12aee39f308a 100644 --- a/dbaccess/source/ui/uno/dbinteraction.cxx +++ b/dbaccess/source/ui/uno/dbinteraction.cxx @@ -100,7 +100,8 @@ extern "C" void SAL_CALL createRegistryInfo_OInteractionHandler() { - static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OInteractionHandler > aOInteractionHandler_AutoRegistration; + static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::SQLExceptionInteractionHandler > aSQLExceptionInteractionHandler_AutoRegistration; + static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::LegacyInteractionHandler > aLegacyInteractionHandler_AutoRegistration; } //......................................................................... @@ -116,62 +117,70 @@ namespace dbaui using namespace ::dbtools; //========================================================================= - //= OInteractionHandler + //= BasicInteractionHandler //========================================================================= //------------------------------------------------------------------------- - OInteractionHandler::OInteractionHandler(const Reference< XMultiServiceFactory >& _rxORB) - :m_xORB(_rxORB) + BasicInteractionHandler::BasicInteractionHandler( const Reference< XMultiServiceFactory >& _rxORB, const bool i_bFallbackToGeneric ) + :m_xORB( _rxORB ) + ,m_bFallbackToGeneric( i_bFallbackToGeneric ) { + OSL_ENSURE( !m_bFallbackToGeneric, + "BasicInteractionHandler::BasicInteractionHandler: enabling legacy behavior, there should be no clients of this anymore!" ); } //------------------------------------------------------------------------- - IMPLEMENT_SERVICE_INFO1_STATIC(OInteractionHandler, "com.sun.star.comp.dbu.OInteractionHandler", "com.sun.star.sdb.InteractionHandler"); + ::sal_Bool SAL_CALL BasicInteractionHandler::handleInteractionRequest( const Reference< XInteractionRequest >& i_rRequest ) throw (RuntimeException) + { + return impl_handle_throw( i_rRequest ); + } //------------------------------------------------------------------------- - void SAL_CALL OInteractionHandler::handle(const Reference< XInteractionRequest >& _rxRequest) throw(RuntimeException) + void SAL_CALL BasicInteractionHandler::handle( const Reference< XInteractionRequest >& i_rRequest ) throw(RuntimeException) { - Any aRequest; - if (_rxRequest.is()) - { - try { aRequest = _rxRequest->getRequest(); } - catch(RuntimeException&) { } - } - DBG_ASSERT(aRequest.hasValue(), "OInteractionHandler::handle: invalid request!"); - if (!aRequest.hasValue()) + impl_handle_throw( i_rRequest ); + } + + //------------------------------------------------------------------------- + sal_Bool BasicInteractionHandler::impl_handle_throw( const Reference< XInteractionRequest >& i_Request ) + { + Any aRequest( i_Request->getRequest() ); + DBG_ASSERT(aRequest.hasValue(), "BasicInteractionHandler::handle: invalid request!"); + if ( !aRequest.hasValue() ) // no request -> no handling - return; + return sal_False; - Sequence< Reference< XInteractionContinuation > > aContinuations; - try { aContinuations = _rxRequest->getContinuations(); } - catch(RuntimeException&) { } + Sequence< Reference< XInteractionContinuation > > aContinuations( i_Request->getContinuations() ); // try to extract an SQLException (or one of it's derived members - SQLExceptionInfo aInfo(aRequest); - if (aInfo.isValid()) + SQLExceptionInfo aInfo( aRequest ); + if ( aInfo.isValid() ) { - implHandle(aInfo, aContinuations); - return; + implHandle( aInfo, aContinuations ); + return sal_True; } ParametersRequest aParamRequest; - if (aRequest >>= aParamRequest) - { // it's an authentication request - implHandle(aParamRequest, aContinuations); - return; + if ( aRequest >>= aParamRequest ) + { + implHandle( aParamRequest, aContinuations ); + return sal_True; } DocumentSaveRequest aDocuRequest; - if (aRequest >>= aDocuRequest) - { // it's an document request - implHandle(aDocuRequest, aContinuations); - return; + if ( aRequest >>= aDocuRequest ) + { + implHandle( aDocuRequest, aContinuations ); + return sal_True; } - OSL_VERIFY( implHandleUnknown( _rxRequest ) ); + if ( m_bFallbackToGeneric ) + return implHandleUnknown( i_Request ); + + return sal_False; } //------------------------------------------------------------------------- - void OInteractionHandler::implHandle(const ParametersRequest& _rParamRequest, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) + void BasicInteractionHandler::implHandle(const ParametersRequest& _rParamRequest, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) { ::vos::OGuard aGuard(Application::GetSolarMutex()); // want to open a dialog .... @@ -182,7 +191,7 @@ namespace dbaui Reference< XInteractionSupplyParameters > xParamCallback; if (-1 != nParamPos) xParamCallback = Reference< XInteractionSupplyParameters >(_rContinuations[nParamPos], UNO_QUERY); - DBG_ASSERT(xParamCallback.is(), "OInteractionHandler::implHandle(ParametersRequest): can't set the parameters without an appropriate interaction handler!s"); + DBG_ASSERT(xParamCallback.is(), "BasicInteractionHandler::implHandle(ParametersRequest): can't set the parameters without an appropriate interaction handler!s"); // determine the style of the dialog, dependent on the present continuation types WinBits nDialogStyle = WB_OK | WB_DEF_OK; @@ -215,7 +224,7 @@ namespace dbaui } //------------------------------------------------------------------------- - void OInteractionHandler::implHandle(const SQLExceptionInfo& _rSqlInfo, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) + void BasicInteractionHandler::implHandle(const SQLExceptionInfo& _rSqlInfo, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) { ::vos::OGuard aGuard(Application::GetSolarMutex()); // want to open a dialog .... @@ -257,14 +266,14 @@ namespace dbaui if ( nApprovePos != -1 ) _rContinuations[ nApprovePos ]->select(); else - OSL_ENSURE( nResult != RET_YES, "OInteractionHandler::implHandle: no handler for YES!" ); + OSL_ENSURE( nResult != RET_YES, "BasicInteractionHandler::implHandle: no handler for YES!" ); break; case RET_NO: if ( nDisapprovePos != -1 ) _rContinuations[ nDisapprovePos ]->select(); else - OSL_ENSURE( false, "OInteractionHandler::implHandle: no handler for NO!" ); + OSL_ENSURE( false, "BasicInteractionHandler::implHandle: no handler for NO!" ); break; case RET_CANCEL: @@ -273,13 +282,13 @@ namespace dbaui else if ( nDisapprovePos != -1 ) _rContinuations[ nDisapprovePos ]->select(); else - OSL_ENSURE( false, "OInteractionHandler::implHandle: no handler for CANCEL!" ); + OSL_ENSURE( false, "BasicInteractionHandler::implHandle: no handler for CANCEL!" ); break; case RET_RETRY: if ( nRetryPos != -1 ) _rContinuations[ nRetryPos ]->select(); else - OSL_ENSURE( false, "OInteractionHandler::implHandle: where does the RETRY come from?" ); + OSL_ENSURE( false, "BasicInteractionHandler::implHandle: where does the RETRY come from?" ); break; } } @@ -289,7 +298,7 @@ namespace dbaui } } //------------------------------------------------------------------------- - void OInteractionHandler::implHandle(const DocumentSaveRequest& _rDocuRequest, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) + void BasicInteractionHandler::implHandle(const DocumentSaveRequest& _rDocuRequest, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) { ::vos::OGuard aGuard(Application::GetSolarMutex()); // want to open a dialog .... @@ -318,7 +327,7 @@ namespace dbaui if (-1 != nDocuPos) { Reference< XInteractionDocumentSave > xCallback(_rContinuations[nDocuPos], UNO_QUERY); - DBG_ASSERT(xCallback.is(), "OInteractionHandler::implHandle(DocumentSaveRequest): can't save document without an appropriate interaction handler!s"); + DBG_ASSERT(xCallback.is(), "BasicInteractionHandler::implHandle(DocumentSaveRequest): can't save document without an appropriate interaction handler!s"); // determine the style of the dialog, dependent on the present continuation types WinBits nDialogStyle = WB_OK | WB_DEF_OK; @@ -357,7 +366,7 @@ namespace dbaui } //------------------------------------------------------------------------- - bool OInteractionHandler::implHandleUnknown( const Reference< XInteractionRequest >& _rxRequest ) + bool BasicInteractionHandler::implHandleUnknown( const Reference< XInteractionRequest >& _rxRequest ) { Reference< XInteractionHandler > xFallbackHandler; if ( m_xORB.is() ) @@ -371,7 +380,7 @@ namespace dbaui } //------------------------------------------------------------------------- - sal_Int32 OInteractionHandler::getContinuation(Continuation _eCont, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) + sal_Int32 BasicInteractionHandler::getContinuation(Continuation _eCont, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) { const Reference< XInteractionContinuation >* pContinuations = _rContinuations.getConstArray(); for (sal_Int32 i=0; i<_rContinuations.getLength(); ++i, ++pContinuations) @@ -408,6 +417,15 @@ namespace dbaui return -1; } + //========================================================================== + //= SQLExceptionInteractionHandler + //========================================================================== + IMPLEMENT_SERVICE_INFO1_STATIC( SQLExceptionInteractionHandler, "com.sun.star.comp.dbaccess.DatabaseInteractionHandler", "com.sun.star.sdb.DatabaseInteractionHandler" ); + + //========================================================================== + //= LegacyInteractionHandler + //========================================================================== + IMPLEMENT_SERVICE_INFO1_STATIC( LegacyInteractionHandler, "com.sun.star.comp.dbaccess.LegacyInteractionHandler", "com.sun.star.sdb.InteractionHandler" ); //......................................................................... } // namespace dbaui diff --git a/dbaccess/source/ui/uno/dbinteraction.hxx b/dbaccess/source/ui/uno/dbinteraction.hxx index 8c7bba539129..822a55a36a95 100644 --- a/dbaccess/source/ui/uno/dbinteraction.hxx +++ b/dbaccess/source/ui/uno/dbinteraction.hxx @@ -35,30 +35,17 @@ #include <cppuhelper/implbase2.hxx> #endif -#ifndef _DBAUI_MODULE_DBU_HXX_ #include "moduledbu.hxx" -#endif -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include "apitools.hxx" + +/** === begin UNO includes === **/ #include <com/sun/star/lang/XServiceInfo.hpp> -#endif -#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_ -#include <com/sun/star/task/XInteractionHandler.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/task/XInteractionHandler2.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_UCB_AUTHENTICATIONREQUEST_HPP_ #include <com/sun/star/ucb/AuthenticationRequest.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_PARAMETERSREQUEST_HPP_ #include <com/sun/star/sdb/ParametersRequest.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_DOCUMENTSAVEREQUEST_HPP_ #include <com/sun/star/sdb/DocumentSaveRequest.hpp> -#endif -#ifndef _DBASHARED_APITOOLS_HXX_ -#include "apitools.hxx" -#endif +/** === end UNO includes === **/ namespace dbtools { @@ -71,11 +58,11 @@ namespace dbaui //......................................................................... //========================================================================= - //= OInteractionHandler + //= BasicInteractionHandler //========================================================================= typedef ::cppu::WeakImplHelper2 < ::com::sun::star::lang::XServiceInfo - , ::com::sun::star::task::XInteractionHandler - > OInteractionHandler_Base; + , ::com::sun::star::task::XInteractionHandler2 + > BasicInteractionHandler_Base; /** implements an <type scope="com.sun.star.task">XInteractionHandler</type> for database related interaction requests. <p/> @@ -87,22 +74,30 @@ namespace dbaui standard error dialog for the (maybe chained) exception given</li> </ul> */ - class OInteractionHandler - :public OInteractionHandler_Base + class BasicInteractionHandler + :public BasicInteractionHandler_Base { - OModuleClient m_aModuleClient; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; + const OModuleClient m_aModuleClient; + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + m_xORB; + const bool m_bFallbackToGeneric; + public: - OInteractionHandler(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); + BasicInteractionHandler( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_rORB, + const bool i_bFallbackToGeneric + ); - // XServiceInfo - DECLARE_SERVICE_INFO_STATIC(); + // XInteractionHandler2 + virtual ::sal_Bool SAL_CALL handleInteractionRequest( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& Request ) throw (::com::sun::star::uno::RuntimeException); - // XInteractionHandler + // XInteractionHandler virtual void SAL_CALL handle( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& Request ) throw(::com::sun::star::uno::RuntimeException); protected: + sal_Bool + impl_handle_throw( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& i_Request ); + /// handle SQLExceptions (and derived classes) void implHandle( const ::dbtools::SQLExceptionInfo& _rSqlInfo, @@ -141,6 +136,53 @@ namespace dbaui const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >& _rContinuations); }; + //========================================================================= + //= SQLExceptionInteractionHandler + //========================================================================= + class SQLExceptionInteractionHandler : public BasicInteractionHandler + { + public: + SQLExceptionInteractionHandler( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_rORB + ) + :BasicInteractionHandler( i_rORB, false ) + { + } + + // XServiceInfo + DECLARE_SERVICE_INFO_STATIC(); + }; + + //========================================================================= + //= SQLExceptionInteractionHandler + //========================================================================= + /** an implementation for the legacy css.sdb.InteractionHandler + + css.sdb.InteractionHandler is deprecated, as it does not only handle database related interactions, + but also delegates all kind of unknown requests to a css.task.InteractionHandler. + + In today's architecture, there's only one central css.task.InteractionHandler, which is to be used + for all requests. Depending on configuration information, it decides which handler implementation + to delegate a request to. + + SQLExceptionInteractionHandler is the delegatee which handles only database related interactions. + LegacyInteractionHandler is the version which first checks for a database related interaction, and + forwards everything else to the css.task.InteractionHandler. + */ + class LegacyInteractionHandler : public BasicInteractionHandler + { + public: + LegacyInteractionHandler( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_rORB + ) + :BasicInteractionHandler( i_rORB, true ) + { + } + + // XServiceInfo + DECLARE_SERVICE_INFO_STATIC(); + }; + //......................................................................... } // namespace dbaui //......................................................................... |