diff options
author | Noel Grandin <noel@peralex.com> | 2012-12-06 14:15:55 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2012-12-06 14:16:44 +0200 |
commit | 19854e653be1dc01f5b655fca851a6e3a651a940 (patch) | |
tree | f19e921125d72db2c132742d3d0a2ea0c66cff79 | |
parent | 8909b2c384154baa2174aa53b433b12b02871e75 (diff) |
fdo#46808, Adapt sdb::ErrorMessageDialog UNO service to new style
Change-Id: Iaf12324e6aa64b268555b0f4c82f04f4c0f6f123
54 files changed, 213 insertions, 247 deletions
diff --git a/connectivity/inc/connectivity/dbtools.hxx b/connectivity/inc/connectivity/dbtools.hxx index a3956b967a1e..fb1ff42d34d8 100644 --- a/connectivity/inc/connectivity/dbtools.hxx +++ b/connectivity/inc/connectivity/dbtools.hxx @@ -546,7 +546,7 @@ namespace dbtools OOO_DLLPUBLIC_DBTOOLS void showError( const SQLExceptionInfo& _rInfo, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext); /** implements <method scope="com.sun.star.sdb">XRowUpdate::updateObject</method> <p>The object which is to be set is analyzed, and in case it is a simlpe scalar type for which there diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index a5420fcc6ea1..a33e4a47529f 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/sdb/DatabaseContext.hpp> #include <com/sun/star/sdb/BooleanComparisonMode.hpp> #include <com/sun/star/sdb/CommandType.hpp> +#include <com/sun/star/sdb/ErrorMessageDialog.hpp> #include <com/sun/star/sdb/ParametersRequest.hpp> #include <com/sun/star/sdb/RowSetVetoException.hpp> #include <com/sun/star/sdb/SQLContext.hpp> @@ -1479,27 +1480,16 @@ sal_Int32 getSearchColumnFlag( const Reference< XConnection>& _rxConn,sal_Int32 // ----------------------------------------------------------------------------- void showError(const SQLExceptionInfo& _rInfo, const Reference< XWindow>& _xParent, - const Reference< XMultiServiceFactory >& _xFactory) + const Reference< XComponentContext >& _rxContext) { if (_rInfo.isValid()) { try { - Sequence< Any > aArgs(2); - aArgs[0] <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLException")), 0, _rInfo.get(), PropertyState_DIRECT_VALUE); - aArgs[1] <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow")), 0, makeAny(_xParent), PropertyState_DIRECT_VALUE); - - static ::rtl::OUString s_sDialogServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.ErrorMessageDialog" )); - Reference< XExecutableDialog > xErrorDialog( - _xFactory->createInstanceWithArguments(s_sDialogServiceName, aArgs), UNO_QUERY); - if (xErrorDialog.is()) - xErrorDialog->execute(); - else - { - OSL_FAIL("dbtools::showError: no XExecutableDialog found!"); - } + Reference< XExecutableDialog > xErrorDialog = ErrorMessageDialog::create( _rxContext, "", _xParent, _rInfo.get() ); + xErrorDialog->execute(); } - catch(Exception&) + catch(const Exception&) { OSL_FAIL("showError: could not display the error message!"); } diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index bf46021f7237..e3e51372d225 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/sdb/CommandType.hpp> +#include <com/sun/star/sdb/ErrorMessageDialog.hpp> #include <com/sun/star/sdb/SQLContext.hpp> #include <com/sun/star/sdb/XBookmarksSupplier.hpp> #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp> @@ -77,6 +78,7 @@ #include <comphelper/types.hxx> #include <comphelper/interaction.hxx> #include <comphelper/componentcontext.hxx> +#include <comphelper/processfactory.hxx> #include <vcl/msgbox.hxx> #include <vcl/stdtext.hxx> @@ -2128,7 +2130,7 @@ void OApplicationController::renameEntry() } pNameChecker.reset( new HierarchicalNameCheck( xHNames.get(), String() ) ); aDialog.reset( new OSaveAsDlg( - getView(), getORB(), sName, sLabel, *pNameChecker, SAD_TITLE_RENAME ) ); + getView(), comphelper::getComponentContext(getORB()), sName, sLabel, *pNameChecker, SAD_TITLE_RENAME ) ); } } } @@ -2147,7 +2149,7 @@ void OApplicationController::renameEntry() ensureConnection(); pNameChecker.reset( new DynamicTableOrQueryNameCheck( getConnection(), nCommandType ) ); aDialog.reset( new OSaveAsDlg( - getView(), nCommandType, getORB(), getConnection(), + getView(), nCommandType, comphelper::getComponentContext(getORB()), getConnection(), *aList.begin(), *pNameChecker, SAD_TITLE_RENAME ) ); } break; @@ -2687,12 +2689,7 @@ IMPL_LINK( OApplicationController, OnFirstControllerConnected, void*, /**/ ) aDetail.Message = String( ModuleRes( STR_SUB_DOCS_WITH_SCRIPTS_DETAIL ) ); aWarning.NextException <<= aDetail; - ::comphelper::ComponentContext aContext( getORB() ); - Sequence< Any > aArgs(1); - aArgs[0] <<= NamedValue( PROPERTY_SQLEXCEPTION, makeAny( aWarning ) ); - Reference< XExecutableDialog > xDialog( - aContext.createComponentWithArguments( "com.sun.star.sdb.ErrorMessageDialog", aArgs ), - UNO_QUERY_THROW ); + Reference< XExecutableDialog > xDialog = ErrorMessageDialog::create( ::comphelper::getComponentContext( getORB() ), "", NULL, makeAny( aWarning ) ); xDialog->execute(); } catch( const Exception& ) diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx index 763c9789aafb..588c195f4a92 100644 --- a/dbaccess/source/ui/app/AppControllerDnD.cxx +++ b/dbaccess/source/ui/app/AppControllerDnD.cxx @@ -473,7 +473,7 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH } ::std::auto_ptr< OLinkedDocumentsAccess > pDocuments( new OLinkedDocumentsAccess( - getView(), this, getORB(), xDocContainer, xConnection, getDatabaseName() + getView(), this, comphelper::getComponentContext(getORB()), xDocContainer, xConnection, getDatabaseName() ) ); return pDocuments; } @@ -610,7 +610,7 @@ sal_Bool OApplicationController::paste( ElementType _eType,const ::svx::ODataAcc { // the concrete query Reference< XQueryDefinitionsSupplier > xSourceQuerySup( - getDataSourceByName( sDataSourceName, getView(), getORB(), NULL ), + getDataSourceByName( sDataSourceName, getView(), comphelper::getComponentContext(getORB()), NULL ), UNO_QUERY_THROW ); Reference< XNameAccess > xQueries( xSourceQuerySup->getQueryDefinitions(), UNO_SET_THROW ); if ( xQueries->hasByName( sCommand ) ) @@ -657,7 +657,7 @@ sal_Bool OApplicationController::paste( ElementType _eType,const ::svx::ODataAcc { OSaveAsDlg aAskForName( getView(), CommandType::QUERY, - getORB(), + comphelper::getComponentContext(getORB()), getConnection(), sTargetName, aNameChecker, diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index 44a55dc29ef4..cb846688e707 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -52,6 +52,7 @@ #include <com/sun/star/util/XRefreshable.hpp> #include <cppuhelper/exc_hlp.hxx> +#include <comphelper/processfactory.hxx> #include <connectivity/dbexception.hxx> #include <connectivity/dbtools.hxx> #include <connectivity/sqlerror.hxx> @@ -143,7 +144,7 @@ void OApplicationController::convertToView(const ::rtl::OUString& _sName) String aDefaultName = ::dbaui::createDefaultName(xMeta,xTables,aName); DynamicTableOrQueryNameCheck aNameChecker( xConnection, CommandType::TABLE ); - OSaveAsDlg aDlg( getView(), CommandType::TABLE, getORB(), xConnection, aDefaultName, aNameChecker ); + OSaveAsDlg aDlg( getView(), CommandType::TABLE, comphelper::getComponentContext(getORB()), xConnection, aDefaultName, aNameChecker ); if ( aDlg.Execute() == RET_OK ) { ::rtl::OUString sName = aDlg.getName(); @@ -666,7 +667,7 @@ sal_Bool OApplicationController::insertHierachyElement(ElementType _eType,const { Reference<XHierarchicalNameContainer> xNames(getElements(_eType), UNO_QUERY); return dbaui::insertHierachyElement(getView() - ,getORB() + ,comphelper::getComponentContext(getORB()) ,xNames ,_sParentFolder ,_eType == E_FORM diff --git a/dbaccess/source/ui/browser/dbloader.cxx b/dbaccess/source/ui/browser/dbloader.cxx index 019e9ec22b5d..60b4b0a13479 100644 --- a/dbaccess/source/ui/browser/dbloader.cxx +++ b/dbaccess/source/ui/browser/dbloader.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/sdbc/XDataSource.hpp> #include <comphelper/namedvaluecollection.hxx> #include <comphelper/componentcontext.hxx> +#include <comphelper/processfactory.hxx> #include <cppuhelper/implbase2.hxx> #include <toolkit/awt/vclxwindow.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -274,7 +275,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const :: else if ( !sDataSourceName.isEmpty() ) { ::dbtools::SQLExceptionInfo aError; - xDataSource.set( getDataSourceByName( sDataSourceName, NULL, m_xServiceFactory, &aError ) ); + xDataSource.set( getDataSourceByName( sDataSourceName, NULL, comphelper::getComponentContext(m_xServiceFactory), &aError ) ); xDatabaseDocument.set( getDataSourceOrModel( xDataSource ), UNO_QUERY ); } else if ( xConnection.is() ) diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index 76df18a7c9cf..9f24613fc297 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -1047,7 +1047,7 @@ Reference< XConnection > OGenericUnoController::connect( const Reference< XDataS { WaitObject aWaitCursor( getView() ); - ODatasourceConnector aConnector( getORB(), getView(), ::rtl::OUString() ); + ODatasourceConnector aConnector( comphelper::getComponentContext(getORB()), getView(), ::rtl::OUString() ); Reference< XConnection > xConnection = aConnector.connect( _xDataSource, _pErrorInfo ); startConnectionListening( xConnection ); @@ -1059,7 +1059,7 @@ Reference< XConnection > OGenericUnoController::connect( const ::rtl::OUString& { WaitObject aWaitCursor( getView() ); - ODatasourceConnector aConnector( getORB(), getView(), _rContextInformation ); + ODatasourceConnector aConnector( comphelper::getComponentContext(getORB()), getView(), _rContextInformation ); Reference<XConnection> xConnection = aConnector.connect( _rDataSourceName, _pErrorInfo ); startConnectionListening( xConnection ); @@ -1069,7 +1069,7 @@ Reference< XConnection > OGenericUnoController::connect( const ::rtl::OUString& // ----------------------------------------------------------------------------- void OGenericUnoController::showError(const SQLExceptionInfo& _rInfo) { - ::dbaui::showError(_rInfo,getView(),getORB()); + ::dbaui::showError(_rInfo,getView(),comphelper::getComponentContext(getORB())); } // ----------------------------------------------------------------------------- Reference< XLayoutManager > OGenericUnoController::getLayoutManager(const Reference< XFrame >& _xFrame) const diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index d98a67147926..b3179d3ebaa2 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -1574,7 +1574,7 @@ IMPL_LINK(SbaGridControl, AsynchDropEvent, void*, /*EMPTY_ARG*/) { AfterDrop(); Show(); - ::dbaui::showError(::dbtools::SQLExceptionInfo(e),this,getServiceManager()); + ::dbaui::showError(::dbtools::SQLExceptionInfo(e),this,comphelper::getComponentContext(getServiceManager())); } catch(const Exception& ) { diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 4963888f5174..a3f7a48a23fa 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -3527,7 +3527,7 @@ void SbaTableQueryBrowser::implAdministrate( SvTreeListEntry* _pApplyTo ) if (pTopLevelSelected) sInitialSelection = getDataSourceAcessor( pTopLevelSelected ); - Reference< XDataSource > xDataSource( getDataSourceByName( sInitialSelection, getView(), getORB(), NULL ) ); + Reference< XDataSource > xDataSource( getDataSourceByName( sInitialSelection, getView(), comphelper::getComponentContext(getORB()), NULL ) ); Reference< XModel > xDocumentModel( getDataSourceOrModel( xDataSource ), UNO_QUERY ); if ( xDocumentModel.is() ) diff --git a/dbaccess/source/ui/control/TableGrantCtrl.cxx b/dbaccess/source/ui/control/TableGrantCtrl.cxx index fb1eacb5e145..4ec87d096606 100644 --- a/dbaccess/source/ui/control/TableGrantCtrl.cxx +++ b/dbaccess/source/ui/control/TableGrantCtrl.cxx @@ -108,9 +108,9 @@ void OTableGrantControl::setTablesSupplier(const Reference< XTablesSupplier >& _ OSL_ENSURE(m_xTables.is(),"No tables supported!"); } // ----------------------------------------------------------------------------- -void OTableGrantControl::setORB(const Reference< ::com::sun::star::lang::XMultiServiceFactory>& _xORB) +void OTableGrantControl::setComponentContext(const Reference< ::com::sun::star::uno::XComponentContext>& _rxContext) { - m_xORB = _xORB; + m_xContext = _rxContext; } //------------------------------------------------------------------------ void OTableGrantControl::UpdateTables() @@ -263,7 +263,7 @@ sal_Bool OTableGrantControl::SaveModified() catch(SQLException& e) { bErg = sal_False; - ::dbaui::showError(::dbtools::SQLExceptionInfo(e),GetParent(),m_xORB); + ::dbaui::showError(::dbtools::SQLExceptionInfo(e),GetParent(),m_xContext); } if(bErg && Controller().Is()) Controller()->ClearModified(); @@ -327,7 +327,7 @@ void OTableGrantControl::fillPrivilege(sal_Int32 _nRow) const } catch(SQLException& e) { - ::dbaui::showError(::dbtools::SQLExceptionInfo(e),GetParent(),m_xORB); + ::dbaui::showError(::dbtools::SQLExceptionInfo(e),GetParent(),m_xContext); } catch(Exception& ) { diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx index 7123db850014..8974ebf83d7d 100644 --- a/dbaccess/source/ui/dlg/CollectionView.cxx +++ b/dbaccess/source/ui/dlg/CollectionView.cxx @@ -65,7 +65,7 @@ DBG_NAME(OCollectionView) OCollectionView::OCollectionView( Window * pParent ,const Reference< XContent>& _xContent ,const ::rtl::OUString& _sDefaultName - ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB) + ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext) : ModalDialog( pParent, ModuleRes(DLG_COLLECTION_VIEW)) , m_aFTCurrentPath( this, ModuleRes( FT_EXPLORERFILE_CURRENTPATH ) ) , m_aNewFolder( this, ModuleRes( BTN_EXPLORERFILE_NEWFOLDER ) ) @@ -79,7 +79,7 @@ OCollectionView::OCollectionView( Window * pParent , m_aPB_HELP( this, ModuleRes( PB_HELP ) ) , m_sPath( ModuleRes( STR_PATHNAME ) ) , m_xContent(_xContent) - , m_xORB(_xORB) + , m_xContext(_rxContext) , m_bCreateForm(sal_True) { DBG_CTOR(OCollectionView,NULL); @@ -170,7 +170,7 @@ IMPL_LINK_NOARG(OCollectionView, Save_Click) Reference<XInteractionHandler2> xHandler( - InteractionHandler::createWithParent(comphelper::getComponentContext(m_xORB), VCLUnoHelper::GetInterface( this ))); + InteractionHandler::createWithParent(m_xContext, VCLUnoHelper::GetInterface( this ))); OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aException)); Reference< XInteractionRequest > xRequest(pRequest); @@ -208,12 +208,12 @@ IMPL_LINK_NOARG(OCollectionView, NewFolder_Click) try { Reference<XHierarchicalNameContainer> xNameContainer(m_xContent,UNO_QUERY); - if ( dbaui::insertHierachyElement(this,m_xORB,xNameContainer,String(),m_bCreateForm) ) + if ( dbaui::insertHierachyElement(this,m_xContext,xNameContainer,String(),m_bCreateForm) ) m_aView.Initialize(m_xContent,String()); } catch( const SQLException& ) { - showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), this, m_xORB ); + showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), this, m_xContext ); } catch( const Exception& ) { diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index 2b5cbfe36d2b..80f6051b010e 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -372,7 +372,7 @@ void ODbDataSourceAdministrationHelper::clearPassword() catch (const SQLWarning& e) { aErrorInfo = SQLExceptionInfo(e); } catch (const SQLException& e) { aErrorInfo = SQLExceptionInfo(e); } - showError(aErrorInfo,m_pParent,getORB()); + showError(aErrorInfo,m_pParent,comphelper::getComponentContext(getORB())); } if ( aRet.first.is() ) successfullyConnected();// notify the admindlg to save the password diff --git a/dbaccess/source/ui/dlg/RelationDlg.cxx b/dbaccess/source/ui/dlg/RelationDlg.cxx index d8ef4517784e..ae94376ad0fa 100644 --- a/dbaccess/source/ui/dlg/RelationDlg.cxx +++ b/dbaccess/source/ui/dlg/RelationDlg.cxx @@ -36,6 +36,7 @@ #include "RTableConnectionData.hxx" #include "RelationControl.hxx" #include <cppuhelper/exc_hlp.hxx> +#include <comphelper/processfactory.hxx> #include <algorithm> @@ -209,7 +210,7 @@ IMPL_LINK( ORelationDialog, OKClickHdl, Button*, /*pButton*/ ) { ::dbaui::showError( SQLExceptionInfo( ::cppu::getCaughtException() ), this, - static_cast<OJoinTableView*>(GetParent())->getDesignView()->getController().getORB()); + comphelper::getComponentContext(static_cast<OJoinTableView*>(GetParent())->getDesignView()->getController().getORB())); } catch( const Exception& ) { diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx index 8cf9fa62319b..54d63191dc76 100644 --- a/dbaccess/source/ui/dlg/UserAdmin.cxx +++ b/dbaccess/source/ui/dlg/UserAdmin.cxx @@ -23,6 +23,7 @@ #include "UITools.hxx" #include "dbu_dlg.hrc" #include <comphelper/types.hxx> +#include <comphelper/processfactory.hxx> #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> #include <com/sun/star/sdbcx/XUsersSupplier.hpp> @@ -270,7 +271,7 @@ IMPL_LINK( OUserAdmin, UserHdl, PushButton *, pButton ) } catch(const SQLException& e) { - ::dbaui::showError(::dbtools::SQLExceptionInfo(e),this,m_xORB); + ::dbaui::showError(::dbtools::SQLExceptionInfo(e),this, comphelper::getComponentContext(m_xORB)); return 0; } catch(Exception& ) @@ -306,7 +307,7 @@ void OUserAdmin::fillWindows(::std::vector< ISaveValueWrapper* >& /*_rControlLis // ----------------------------------------------------------------------------- void OUserAdmin::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue) { - m_TableCtrl.setORB(m_xORB); + m_TableCtrl.setComponentContext(comphelper::getComponentContext(m_xORB)); try { if ( !m_xConnection.is() && m_pAdminDialog ) @@ -333,7 +334,7 @@ void OUserAdmin::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue) } catch(const SQLException& e) { - ::dbaui::showError(::dbtools::SQLExceptionInfo(e),this,m_xORB); + ::dbaui::showError(::dbtools::SQLExceptionInfo(e),this,comphelper::getComponentContext(m_xORB)); } OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue); diff --git a/dbaccess/source/ui/dlg/UserAdminDlg.cxx b/dbaccess/source/ui/dlg/UserAdminDlg.cxx index 10de733105c2..f57256bf3f15 100644 --- a/dbaccess/source/ui/dlg/UserAdminDlg.cxx +++ b/dbaccess/source/ui/dlg/UserAdminDlg.cxx @@ -30,6 +30,7 @@ #include "UserAdminDlg.hxx" #include <comphelper/componentcontext.hxx> +#include <comphelper/processfactory.hxx> #include <connectivity/dbmetadata.hxx> #include <cppuhelper/exc_hlp.hxx> #include <svl/eitem.hxx> @@ -114,7 +115,7 @@ DBG_NAME(OUserAdminDlg) } catch(const SQLException&) { - ::dbaui::showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), GetParent(), getORB() ); + ::dbaui::showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), GetParent(), ::comphelper::getComponentContext( getORB() ) ); return RET_CANCEL; } catch(const Exception&) diff --git a/dbaccess/source/ui/dlg/dlgsave.cxx b/dbaccess/source/ui/dlg/dlgsave.cxx index debae8e7c907..b3258add6b31 100644 --- a/dbaccess/source/ui/dlg/dlgsave.cxx +++ b/dbaccess/source/ui/dlg/dlgsave.cxx @@ -188,13 +188,13 @@ namespace //================================================================== OSaveAsDlg::OSaveAsDlg( Window * pParent, const sal_Int32& _rType, - const Reference< XMultiServiceFactory >& _rxORB, + const Reference< XComponentContext >& _rxContext, const Reference< XConnection>& _xConnection, const String& rDefault, const IObjectNameCheck& _rObjectNameCheck, sal_Int32 _nFlags) :ModalDialog( pParent, ModuleRes(DLG_SAVE_AS)) - ,m_xORB( _rxORB ) + ,m_xContext( _rxContext ) { m_pImpl = new OSaveAsDlgImpl(this,_rType,_xConnection,rDefault,_rObjectNameCheck,_nFlags); @@ -303,13 +303,13 @@ OSaveAsDlg::OSaveAsDlg( Window * pParent, } // ----------------------------------------------------------------------------- OSaveAsDlg::OSaveAsDlg( Window * pParent, - const Reference< XMultiServiceFactory >& _rxORB, + const Reference< XComponentContext >& _rxContext, const String& rDefault, const String& _sLabel, const IObjectNameCheck& _rObjectNameCheck, sal_Int32 _nFlags) :ModalDialog( pParent, ModuleRes(DLG_SAVE_AS)) - ,m_xORB( _rxORB ) + ,m_xContext( _rxContext ) { m_pImpl = new OSaveAsDlgImpl(this,rDefault,_rObjectNameCheck,_nFlags); implInitOnlyTitle(_sLabel); @@ -345,7 +345,7 @@ IMPL_LINK(OSaveAsDlg, ButtonClickHdl, Button *, pButton) if ( m_pImpl->m_rObjectNameCheck.isNameValid( sNameToCheck, aNameError ) ) EndDialog( RET_OK ); - showError( aNameError, this, m_xORB ); + showError( aNameError, this, m_xContext ); m_pImpl->m_aTitle.GrabFocus(); } return 0; diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx index 4c7f2e06513c..d9b26902d984 100644 --- a/dbaccess/source/ui/dlg/indexdialog.cxx +++ b/dbaccess/source/ui/dlg/indexdialog.cxx @@ -173,7 +173,7 @@ DBG_NAME(DbaIndexDialog) DbaIndexDialog::DbaIndexDialog( Window* _pParent, const Sequence< ::rtl::OUString >& _rFieldNames, const Reference< XNameAccess >& _rxIndexes, const Reference< XConnection >& _rxConnection, - const Reference< XMultiServiceFactory >& _rxORB,sal_Int32 _nMaxColumnsInIndex) + const Reference< XComponentContext >& _rxContext,sal_Int32 _nMaxColumnsInIndex) :ModalDialog( _pParent, ModuleRes(DLG_INDEXDESIGN)) ,m_xConnection(_rxConnection) ,m_aGeometrySettings(E_DIALOG, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("dbaccess.tabledesign.indexdialog"))) @@ -190,7 +190,7 @@ DBG_NAME(DbaIndexDialog) ,m_pIndexes(NULL) ,m_pPreviousSelection(NULL) ,m_bEditAgain(sal_False) - ,m_xORB(_rxORB) + ,m_xContext(_rxContext) { DBG_CTOR(DbaIndexDialog,NULL); @@ -215,7 +215,7 @@ DBG_NAME(DbaIndexDialog) } catch(SQLException& e) { - ::dbaui::showError(SQLExceptionInfo(e),_pParent,_rxORB); + ::dbaui::showError(SQLExceptionInfo(e),_pParent,_rxContext); } catch(Exception&) { @@ -354,7 +354,7 @@ DBG_NAME(DbaIndexDialog) updateToolbox(); if (aExceptionInfo.isValid()) - showError(aExceptionInfo, this, m_xORB); + showError(aExceptionInfo, this, m_xContext); else { m_aUnique.SaveValue(); @@ -456,7 +456,7 @@ DBG_NAME(DbaIndexDialog) catch(SQLException& e) { aExceptionInfo = SQLExceptionInfo(e); } if (aExceptionInfo.isValid()) - showError(aExceptionInfo, this, m_xORB); + showError(aExceptionInfo, this, m_xContext); else if (bSuccess && _bRemoveFromCollection) { SvTreeList* pModel = m_aIndexes.GetModel(); @@ -540,7 +540,7 @@ DBG_NAME(DbaIndexDialog) catch(SQLException& e) { aExceptionInfo = SQLExceptionInfo(e); } if (aExceptionInfo.isValid()) - showError(aExceptionInfo, this, m_xORB); + showError(aExceptionInfo, this, m_xContext); else m_aIndexes.SetEntryText(pSelected, aResetPos->sName); diff --git a/dbaccess/source/ui/inc/CollectionView.hxx b/dbaccess/source/ui/inc/CollectionView.hxx index 28f9bc1c5676..cb16f12149c4 100644 --- a/dbaccess/source/ui/inc/CollectionView.hxx +++ b/dbaccess/source/ui/inc/CollectionView.hxx @@ -47,7 +47,7 @@ namespace dbaui HelpButton m_aPB_HELP; String m_sPath; ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent> m_xContent; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; Size m_aDlgSize; Size m_a6Size; sal_Bool m_bCreateForm; @@ -63,7 +63,7 @@ namespace dbaui OCollectionView( Window * pParent ,const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>& _xContent ,const ::rtl::OUString& _sDefaultName - ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB); + ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext); virtual ~OCollectionView(); ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent> getSelectedFolder() const; diff --git a/dbaccess/source/ui/inc/DExport.hxx b/dbaccess/source/ui/inc/DExport.hxx index e1c4068b8b05..60553194015e 100644 --- a/dbaccess/source/ui/inc/DExport.hxx +++ b/dbaccess/source/ui/inc/DExport.hxx @@ -76,7 +76,7 @@ namespace dbaui ::boost::shared_ptr<IUpdateHelper> m_pUpdateHelper; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > m_xResultSet; ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter; ///< a number formatter working with the connection's NumberFormatsSupplier - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xFactory; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext; ::com::sun::star::util::Date m_aNullDate; SvNumberFormatter* m_pFormatter; @@ -135,7 +135,7 @@ namespace dbaui ODatabaseExport( const SharedConnection& _rxConnection, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const TColumnVector* rList, const OTypeInfoMap* _pInfoMap, SvStream& _rInputStream @@ -146,7 +146,7 @@ namespace dbaui sal_Int32 nRows, const TPositions& _rColumnPositions, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const TColumnVector* rList, const OTypeInfoMap* _pInfoMap, sal_Bool _bAutoIncrementEnabled, diff --git a/dbaccess/source/ui/inc/HtmlReader.hxx b/dbaccess/source/ui/inc/HtmlReader.hxx index f00d25c0b76a..941d15961452 100644 --- a/dbaccess/source/ui/inc/HtmlReader.hxx +++ b/dbaccess/source/ui/inc/HtmlReader.hxx @@ -53,7 +53,7 @@ namespace dbaui OHTMLReader(SvStream& rIn, const SharedConnection& _rxConnection, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const TColumnVector* rList = 0, const OTypeInfoMap* _pInfoMap = 0); // required for automatic type recognition @@ -61,7 +61,7 @@ namespace dbaui sal_Int32 nRows, const TPositions &_rColumnPositions, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const TColumnVector* rList, const OTypeInfoMap* _pInfoMap, sal_Bool _bAutoIncrementEnabled); diff --git a/dbaccess/source/ui/inc/RtfReader.hxx b/dbaccess/source/ui/inc/RtfReader.hxx index af33779bdc56..61f2a5e27139 100644 --- a/dbaccess/source/ui/inc/RtfReader.hxx +++ b/dbaccess/source/ui/inc/RtfReader.hxx @@ -44,7 +44,7 @@ namespace dbaui ORTFReader( SvStream& rIn, const SharedConnection& _rxConnection, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const TColumnVector* rList = 0, const OTypeInfoMap* _pInfoMap = 0); // required for automatic type recognition @@ -52,7 +52,7 @@ namespace dbaui sal_Int32 nRows, const TPositions &_rColumnPositions, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const TColumnVector* rList, const OTypeInfoMap* _pInfoMap, sal_Bool _bAutoIncrementEnabled); diff --git a/dbaccess/source/ui/inc/TableGrantCtrl.hxx b/dbaccess/source/ui/inc/TableGrantCtrl.hxx index e95bc49dbdf7..8b054a0c07c5 100644 --- a/dbaccess/source/ui/inc/TableGrantCtrl.hxx +++ b/dbaccess/source/ui/inc/TableGrantCtrl.hxx @@ -44,7 +44,7 @@ class OTableGrantControl : public ::svt::EditBrowseBox ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUsers; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xTables; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xORB; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XAuthorizable> m_xGrantUser; ::com::sun::star::uno::Sequence< ::rtl::OUString> m_aTableNames; @@ -63,7 +63,7 @@ public: void setGrantUser(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XAuthorizable>& _xGrantUser); void setTablesSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier >& _xTablesSup); - void setORB(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _xORB); + void setComponentContext(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext); virtual void Init(); diff --git a/dbaccess/source/ui/inc/UITools.hxx b/dbaccess/source/ui/inc/UITools.hxx index 9b30fce17ce5..9539e384ecfe 100644 --- a/dbaccess/source/ui/inc/UITools.hxx +++ b/dbaccess/source/ui/inc/UITools.hxx @@ -40,7 +40,6 @@ namespace com { namespace sun { namespace star { namespace lang { class XEventListener; - class XMultiServiceFactory; } namespace awt { @@ -107,11 +106,11 @@ namespace dbaui /** creates a error dialog which displays the SQLExceptionInfo. Also it supports a "more" button where detailed information are available @param _rInfo the error which should be shown, if the info is not valid no error dialog will appear @param _pParent the parent of the error dialog - @param _xFactory need to create the dialog + @param _rxContext need to create the dialog */ void showError( const ::dbtools::SQLExceptionInfo& _rInfo, Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext); /** fills a map and a vector with localized type names @param _rxConnection the connection to acces the metadata @@ -158,7 +157,7 @@ namespace dbaui the URL of the database document, or the name of a registered data source @param _pErrorMessageParent the window to use as parent for error messages - @param _rxORB + @param _rxContext a service factory to use for components to be created @param _pErrorInfo takes the error info in case of failure. If <NULL/>, the error is displayed to the user. @@ -167,7 +166,7 @@ namespace dbaui getDataSourceByName( const ::rtl::OUString& _rDataSourceName, Window* _pErrorMessageParent, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB, + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > _rxContext, ::dbtools::SQLExceptionInfo* _pErrorInfo ); @@ -210,7 +209,7 @@ namespace dbaui /** append a name to tablefilter of a datasource @param _xConnection the connection is need to get the datasource @param _sName the name which should be appended - @param _xFactory needed to check if datasource is available + @param _rxContext needed to check if datasource is available @param _pParent needed when an error must be shown @return false when datsource is not available otherwise true */ @@ -381,7 +380,7 @@ namespace dbaui /** opens a save dialog to store a form or report folder in the current hierachy. @param _pParent The parent of the dialog. - @param _rxORB + @param _rxContext a multi service factory which can be used to instantiate usual global services @param _xNames Where to insert the new object. @@ -400,7 +399,7 @@ namespace dbaui */ sal_Bool insertHierachyElement( Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameContainer>& _xNames, const String& _sParentFolder, sal_Bool _bForm, @@ -412,7 +411,7 @@ namespace dbaui /** creates a number formatter @param _rxConnection The connection is needed to create the formatter - @param _rMF + @param _rxContext The multi service factory */ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > getNumberFormatter(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); diff --git a/dbaccess/source/ui/inc/datasourceconnector.hxx b/dbaccess/source/ui/inc/datasourceconnector.hxx index e96df0dc9ea1..3a468cd42b0f 100644 --- a/dbaccess/source/ui/inc/datasourceconnector.hxx +++ b/dbaccess/source/ui/inc/datasourceconnector.hxx @@ -21,7 +21,7 @@ #define _DBAUI_DATASOURCECONNECTOR_HXX_ #include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/sdbc/XDataSource.hpp> @@ -43,23 +43,23 @@ namespace dbaui { protected: Window* m_pErrorMessageParent; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; ::rtl::OUString m_sContextInformation; public: ODatasourceConnector( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, Window* _pMessageParent ); ODatasourceConnector( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, Window* _pMessageParent, const ::rtl::OUString& _rContextInformation ); /// returns <TRUE/> if the object is able to create data source connections - sal_Bool isValid() const { return m_xORB.is(); } + sal_Bool isValid() const { return m_xContext.is(); } /** creates a connection to the data source, displays the possible error to the user, or returns it */ diff --git a/dbaccess/source/ui/inc/dlgsave.hxx b/dbaccess/source/ui/inc/dlgsave.hxx index 57f8574ce64e..b705dfdcfb47 100644 --- a/dbaccess/source/ui/inc/dlgsave.hxx +++ b/dbaccess/source/ui/inc/dlgsave.hxx @@ -49,17 +49,17 @@ namespace dbaui { private: OSaveAsDlgImpl* m_pImpl; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; public: OSaveAsDlg( Window * pParent,const sal_Int32& _rType, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection, const String& rDefault, const IObjectNameCheck& _rObjectNameCheck, sal_Int32 _nFlags = SAD_DEFAULT | SAD_TITLE_STORE_AS); OSaveAsDlg( Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const String& _rDefault, const String& _sLabel, const IObjectNameCheck& _rObjectNameCheck, diff --git a/dbaccess/source/ui/inc/indexdialog.hxx b/dbaccess/source/ui/inc/indexdialog.hxx index b8f2bd64be54..7b0247f9a336 100644 --- a/dbaccess/source/ui/inc/indexdialog.hxx +++ b/dbaccess/source/ui/inc/indexdialog.hxx @@ -105,15 +105,15 @@ namespace dbaui SvTreeListEntry* m_pPreviousSelection; sal_Bool m_bEditAgain; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; public: DbaIndexDialog( Window* _pParent, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rFieldNames, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxIndexes, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, sal_Int32 _nMaxColumnsInIndex ); virtual ~DbaIndexDialog(); diff --git a/dbaccess/source/ui/inc/linkeddocuments.hxx b/dbaccess/source/ui/inc/linkeddocuments.hxx index 8d2bc875e415..fc2e6087c0d8 100644 --- a/dbaccess/source/ui/inc/linkeddocuments.hxx +++ b/dbaccess/source/ui/inc/linkeddocuments.hxx @@ -23,7 +23,7 @@ #include "AppElementType.hxx" #include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/sdbc/XConnection.hpp> @@ -46,8 +46,8 @@ namespace dbaui class OLinkedDocumentsAccess { protected: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xDocumentContainer; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> @@ -63,7 +63,7 @@ namespace dbaui OLinkedDocumentsAccess( 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::uno::XComponentContext >& _rxContext, 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 diff --git a/dbaccess/source/ui/inc/unosqlmessage.hxx b/dbaccess/source/ui/inc/unosqlmessage.hxx index 9db28c7ad64e..c738b739b434 100644 --- a/dbaccess/source/ui/inc/unosqlmessage.hxx +++ b/dbaccess/source/ui/inc/unosqlmessage.hxx @@ -64,6 +64,8 @@ public: virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; protected: + virtual void initialize(com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > const & args) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); + // OPropertySetHelper overridables // (overwrittin these three, because we have some special handling for our property) 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); diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index 1599bed21890..48f5d6b9f480 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -88,7 +88,7 @@ DBG_NAME(ODatabaseExport) ODatabaseExport::ODatabaseExport(sal_Int32 nRows, const TPositions &_rColumnPositions, const Reference< XNumberFormatter >& _rxNumberF, - const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const TColumnVector* pList, const OTypeInfoMap* _pInfoMap, sal_Bool _bAutoIncrementEnabled, @@ -96,7 +96,7 @@ ODatabaseExport::ODatabaseExport(sal_Int32 nRows, :m_vColumns(_rColumnPositions) ,m_aDestColumns(sal_True) ,m_xFormatter(_rxNumberF) - ,m_xFactory(_rM) + ,m_xContext(_rxContext) ,m_pFormatter(NULL) ,m_rInputStream( _rInputStream ) ,m_pTypeInfo() @@ -146,14 +146,14 @@ ODatabaseExport::ODatabaseExport(sal_Int32 nRows, //--------------------------------------------------------------------------- ODatabaseExport::ODatabaseExport(const SharedConnection& _rxConnection, const Reference< XNumberFormatter >& _rxNumberF, - const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const TColumnVector* pList, const OTypeInfoMap* _pInfoMap, SvStream& _rInputStream) :m_aDestColumns(_rxConnection->getMetaData().is() && _rxConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers() == sal_True) ,m_xConnection(_rxConnection) ,m_xFormatter(_rxNumberF) - ,m_xFactory(_rM) + ,m_xContext(_rxContext) ,m_pFormatter(NULL) ,m_rInputStream( _rInputStream ) ,m_pTypeInfo() @@ -715,7 +715,7 @@ sal_Bool ODatabaseExport::executeWizard(const ::rtl::OUString& _rTableName,const m_xFormatter, getTypeSelectionPageFactory(), m_rInputStream, - comphelper::getComponentContext(m_xFactory) + m_xContext ); sal_Bool bError = sal_False; @@ -754,7 +754,7 @@ sal_Bool ODatabaseExport::executeWizard(const ::rtl::OUString& _rTableName,const } catch( const SQLException&) { - ::dbaui::showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), &aWizard, m_xFactory ); + ::dbaui::showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), &aWizard, m_xContext ); bError = sal_True; } catch( const Exception& ) diff --git a/dbaccess/source/ui/misc/HtmlReader.cxx b/dbaccess/source/ui/misc/HtmlReader.cxx index 97a3e5bef485..8071cd81a163 100644 --- a/dbaccess/source/ui/misc/HtmlReader.cxx +++ b/dbaccess/source/ui/misc/HtmlReader.cxx @@ -86,11 +86,11 @@ DBG_NAME(OHTMLReader) // ========================================================================== OHTMLReader::OHTMLReader(SvStream& rIn,const SharedConnection& _rxConnection, const Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const TColumnVector* pList, const OTypeInfoMap* _pInfoMap) :HTMLParser(rIn) - ,ODatabaseExport( _rxConnection, _rxNumberF, _rM, pList, _pInfoMap, rIn ) + ,ODatabaseExport( _rxConnection, _rxNumberF, _rxContext, pList, _pInfoMap, rIn ) ,m_nTableCount(0) ,m_nColumnWidth(87) ,m_bMetaOptions(sal_False) @@ -107,12 +107,12 @@ OHTMLReader::OHTMLReader(SvStream& rIn, sal_Int32 nRows, const TPositions &_rColumnPositions, const Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const TColumnVector* pList, const OTypeInfoMap* _pInfoMap, sal_Bool _bAutoIncrementEnabled) :HTMLParser(rIn) - ,ODatabaseExport( nRows, _rColumnPositions, _rxNumberF, _rM, pList, _pInfoMap, _bAutoIncrementEnabled, rIn ) + ,ODatabaseExport( nRows, _rColumnPositions, _rxNumberF, _rxContext, pList, _pInfoMap, _bAutoIncrementEnabled, rIn ) ,m_nTableCount(0) ,m_nColumnWidth(87) ,m_bMetaOptions(sal_False) diff --git a/dbaccess/source/ui/misc/RtfReader.cxx b/dbaccess/source/ui/misc/RtfReader.cxx index 3502b4897698..39ef50f2811a 100644 --- a/dbaccess/source/ui/misc/RtfReader.cxx +++ b/dbaccess/source/ui/misc/RtfReader.cxx @@ -62,11 +62,11 @@ DBG_NAME(ORTFReader) ORTFReader::ORTFReader( SvStream& rIn, const SharedConnection& _rxConnection, const Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const TColumnVector* pList, const OTypeInfoMap* _pInfoMap) :SvRTFParser(rIn) - ,ODatabaseExport( _rxConnection, _rxNumberF, _rM, pList, _pInfoMap, rIn ) + ,ODatabaseExport( _rxConnection, _rxNumberF, _rxContext, pList, _pInfoMap, rIn ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORTFReader::ORTFReader" ); DBG_CTOR(ORTFReader,NULL); @@ -77,12 +77,12 @@ ORTFReader::ORTFReader(SvStream& rIn, sal_Int32 nRows, const TPositions &_rColumnPositions, const Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const TColumnVector* pList, const OTypeInfoMap* _pInfoMap, sal_Bool _bAutoIncrementEnabled) :SvRTFParser(rIn) - ,ODatabaseExport( nRows, _rColumnPositions, _rxNumberF, _rM, pList, _pInfoMap, _bAutoIncrementEnabled, rIn ) + ,ODatabaseExport( nRows, _rColumnPositions, _rxNumberF, _rxContext, pList, _pInfoMap, _bAutoIncrementEnabled, rIn ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ORTFReader::ORTFReader" ); DBG_CTOR(ORTFReader,NULL); diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index d1a1d652bc0d..076368974ee2 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -636,7 +636,7 @@ sal_Bool ORTFImportExport::Read() SvParserState eState = SVPAR_ERROR; if ( m_pStream ) { - m_pReader = new ORTFReader((*m_pStream),m_xConnection,m_xFormatter,m_xFactory); + m_pReader = new ORTFReader((*m_pStream),m_xConnection,m_xFormatter,comphelper::getComponentContext(m_xFactory)); ((ORTFReader*)m_pReader)->AddRef(); if ( isCheckEnabled() ) m_pReader->enableCheckOnly(); @@ -715,7 +715,7 @@ sal_Bool OHTMLImportExport::Read() SvParserState eState = SVPAR_ERROR; if ( m_pStream ) { - m_pReader = new OHTMLReader((*m_pStream),m_xConnection,m_xFormatter,m_xFactory); + m_pReader = new OHTMLReader((*m_pStream),m_xConnection,m_xFormatter,comphelper::getComponentContext(m_xFactory)); ((OHTMLReader*)m_pReader)->AddRef(); if ( isCheckEnabled() ) m_pReader->enableCheckOnly(); diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index b781a71f96ba..61744a7274cb 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -215,10 +215,9 @@ SQLExceptionInfo createConnection( const Reference< ::com::sun::star::beans::XP } // ----------------------------------------------------------------------------- Reference< XDataSource > getDataSourceByName( const ::rtl::OUString& _rDataSourceName, - Window* _pErrorMessageParent, Reference< XMultiServiceFactory > _rxORB, ::dbtools::SQLExceptionInfo* _pErrorInfo ) + Window* _pErrorMessageParent, Reference< XComponentContext > _rxContext, ::dbtools::SQLExceptionInfo* _pErrorInfo ) { - ::comphelper::ComponentContext aContext( _rxORB ); - Reference< XDatabaseContext > xDatabaseContext = DatabaseContext::create(aContext.getUNOContext()); + Reference< XDatabaseContext > xDatabaseContext = DatabaseContext::create(_rxContext); Reference< XDataSource > xDatasource; Any aError; @@ -264,7 +263,7 @@ Reference< XDataSource > getDataSourceByName( const ::rtl::OUString& _rDataSourc } else { - showError( aSQLError, _pErrorMessageParent, _rxORB ); + showError( aSQLError, _pErrorMessageParent, _rxContext ); } } @@ -288,10 +287,10 @@ Reference< XInterface > getDataSourceOrModel(const Reference< XInterface >& _xOb return xRet; } // ----------------------------------------------------------------------------- -void showError(const SQLExceptionInfo& _rInfo,Window* _pParent,const Reference< XMultiServiceFactory >& _xFactory) +void showError(const SQLExceptionInfo& _rInfo,Window* _pParent,const Reference< XComponentContext >& _rxContext) { OSL_ENSURE(_pParent,"showError: Parent window must be NOT NULL!"); - ::dbtools::showError(_rInfo,VCLUnoHelper::GetInterface(_pParent),_xFactory); + ::dbtools::showError(_rInfo,VCLUnoHelper::GetInterface(_pParent), _rxContext); } // ----------------------------------------------------------------------------- @@ -1500,7 +1499,7 @@ Reference<XPropertySet> createView( const ::rtl::OUString& _rName, const Referen } // ----------------------------------------------------------------------------- -sal_Bool insertHierachyElement( Window* _pParent, const Reference< XMultiServiceFactory >& _rxORB, +sal_Bool insertHierachyElement( Window* _pParent, const Reference< XComponentContext >& _rxContext, const Reference<XHierarchicalNameContainer>& _xNames, const String& _sParentFolder, sal_Bool _bForm, @@ -1548,7 +1547,7 @@ sal_Bool insertHierachyElement( Window* _pParent, const Reference< XMultiService HierarchicalNameCheck aNameChecker( _xNames.get(), sName ); // ... ehm, except a new name OSaveAsDlg aAskForName( _pParent, - _rxORB, + _rxContext, sTargetName, sLabel, aNameChecker, diff --git a/dbaccess/source/ui/misc/WExtendPages.cxx b/dbaccess/source/ui/misc/WExtendPages.cxx index e8e84a2a6270..463c8f0c2263 100644 --- a/dbaccess/source/ui/misc/WExtendPages.cxx +++ b/dbaccess/source/ui/misc/WExtendPages.cxx @@ -31,7 +31,7 @@ SvParser* OWizHTMLExtend::createReader(sal_Int32 _nRows) _nRows, m_pParent->GetColumnPositions(), m_pParent->GetFormatter(), - uno::Reference<lang::XMultiServiceFactory>(m_pParent->GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW), + m_pParent->GetComponentContext(), m_pParent->getDestVector(), m_pParent->getTypeInfo(), m_pParent->shouldCreatePrimaryKey()); @@ -43,7 +43,7 @@ SvParser* OWizRTFExtend::createReader(sal_Int32 _nRows) _nRows, m_pParent->GetColumnPositions(), m_pParent->GetFormatter(), - uno::Reference<lang::XMultiServiceFactory>(m_pParent->GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW), + m_pParent->GetComponentContext(), m_pParent->getDestVector(), m_pParent->getTypeInfo(), m_pParent->shouldCreatePrimaryKey()); diff --git a/dbaccess/source/ui/misc/datasourceconnector.cxx b/dbaccess/source/ui/misc/datasourceconnector.cxx index b4b4187038d6..ee1905f727c4 100644 --- a/dbaccess/source/ui/misc/datasourceconnector.cxx +++ b/dbaccess/source/ui/misc/datasourceconnector.cxx @@ -63,17 +63,17 @@ namespace dbaui //= ODatasourceConnector //===================================================================== //--------------------------------------------------------------------- - ODatasourceConnector::ODatasourceConnector(const Reference< XMultiServiceFactory >& _rxORB, Window* _pMessageParent) + ODatasourceConnector::ODatasourceConnector(const Reference< XComponentContext >& _rxContext, Window* _pMessageParent) :m_pErrorMessageParent(_pMessageParent) - ,m_xORB(_rxORB) + ,m_xContext(_rxContext) { } //--------------------------------------------------------------------- - ODatasourceConnector::ODatasourceConnector( const Reference< XMultiServiceFactory >& _rxORB, Window* _pMessageParent, + ODatasourceConnector::ODatasourceConnector( const Reference< XComponentContext >& _rxContext, Window* _pMessageParent, const ::rtl::OUString& _rContextInformation ) :m_pErrorMessageParent(_pMessageParent) - ,m_xORB(_rxORB) + ,m_xContext(_rxContext) ,m_sContextInformation( _rContextInformation ) { } @@ -90,7 +90,7 @@ namespace dbaui // get the data source Reference< XDataSource > xDatasource( - getDataSourceByName( _rDataSourceName, m_pErrorMessageParent, m_xORB, _pErrorInfo ), + getDataSourceByName( _rDataSourceName, m_pErrorMessageParent, m_xContext, _pErrorInfo ), UNO_QUERY ); @@ -139,7 +139,7 @@ namespace dbaui if ( !xHandler.is() ) { // instantiate the default SDB interaction handler - xHandler = Reference< XInteractionHandler >( InteractionHandler::createWithParent(comphelper::getComponentContext(m_xORB), 0), UNO_QUERY ); + xHandler = Reference< XInteractionHandler >( InteractionHandler::createWithParent(m_xContext, 0), UNO_QUERY ); } xConnection = xConnectionCompletion->connectWithCompletion(xHandler); @@ -207,7 +207,7 @@ namespace dbaui } else { - showError( aInfo, m_pErrorMessageParent, m_xORB ); + showError( aInfo, m_pErrorMessageParent, m_xContext ); } } return xConnection; diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx index a6413c4ec022..a89876dae742 100644 --- a/dbaccess/source/ui/misc/linkeddocuments.cxx +++ b/dbaccess/source/ui/misc/linkeddocuments.cxx @@ -113,9 +113,9 @@ namespace dbaui DBG_NAME(OLinkedDocumentsAccess) //------------------------------------------------------------------ OLinkedDocumentsAccess::OLinkedDocumentsAccess( Window* _pDialogParent, const Reference< XDatabaseDocumentUI >& i_rDocumentUI, - const Reference< XMultiServiceFactory >& _rxORB, const Reference< XNameAccess >& _rxContainer, + const Reference< XComponentContext >& _rxContext, const Reference< XNameAccess >& _rxContainer, const Reference< XConnection>& _xConnection, const ::rtl::OUString& _sDataSourceName ) - :m_xORB(_rxORB) + :m_xContext(_rxContext) ,m_xDocumentContainer(_rxContainer) ,m_xConnection(_xConnection) ,m_xDocumentUI( i_rDocumentUI ) @@ -123,7 +123,7 @@ namespace dbaui ,m_sDataSourceName(_sDataSourceName) { DBG_CTOR(OLinkedDocumentsAccess,NULL); - OSL_ENSURE(m_xORB.is(), "OLinkedDocumentsAccess::OLinkedDocumentsAccess: invalid service factory!"); + OSL_ENSURE(m_xContext.is(), "OLinkedDocumentsAccess::OLinkedDocumentsAccess: invalid service factory!"); OSL_ENSURE(m_pDialogParent, "OLinkedDocumentsAccess::OLinkedDocumentsAccess: really need a dialog parent!"); } //------------------------------------------------------------------ @@ -208,9 +208,10 @@ namespace dbaui Reference< XJobExecutor > xWizard; { WaitObject aWaitCursor( m_pDialogParent ); - xWizard.set( m_xORB->createInstanceWithArguments( + xWizard.set( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( ::rtl::OUString::createFromAscii( _pWizardService ), - aArgs.getWrappedPropertyValues() + aArgs.getWrappedPropertyValues(), + m_xContext ), UNO_QUERY_THROW ); } @@ -387,7 +388,7 @@ namespace dbaui } if (aInfo.isValid()) { - showError(aInfo, VCLUnoHelper::GetInterface(m_pDialogParent), m_xORB ); + showError(aInfo, VCLUnoHelper::GetInterface(m_pDialogParent), m_xContext ); } return xRet; } diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx index 6487ff5f12c3..f2e6a85b08eb 100644 --- a/dbaccess/source/ui/querydesign/JoinTableView.cxx +++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include "UITools.hxx" #include <cppuhelper/exc_hlp.hxx> +#include <comphelper/processfactory.hxx> #include <tools/diagnose_ex.h> #include <boost/bind.hpp> #include <algorithm> @@ -302,13 +303,13 @@ TTableWindowData::value_type OJoinTableView::createTableWindowData(const ::rtl:: catch ( const SQLException& ) { ::dbaui::showError( ::dbtools::SQLExceptionInfo( ::cppu::getCaughtException() ), - pParent, pParent->getController().getORB() ); + pParent, comphelper::getComponentContext(pParent->getController().getORB()) ); } catch( const WrappedTargetException& e ) { SQLException aSql; if ( e.TargetException >>= aSql ) - ::dbaui::showError( ::dbtools::SQLExceptionInfo( aSql ), pParent, pParent->getController().getORB() ); + ::dbaui::showError( ::dbtools::SQLExceptionInfo( aSql ), pParent, comphelper::getComponentContext(pParent->getController().getORB()) ); } catch( const Exception& ) { diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 752031dc377e..d0ea41b81516 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -1378,7 +1378,7 @@ sal_Bool OQueryController::askForNewName(const Reference<XNameAccess>& _xElement OSaveAsDlg aDlg( getView(), m_nCommandType, - getORB(), + comphelper::getComponentContext(getORB()), getConnection(), aDefaultName, aNameChecker, diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index ea9b022653f4..869af3d4268e 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -341,7 +341,7 @@ sal_Bool OTableController::doSaveDoc(sal_Bool _bSaveAs) } DynamicTableOrQueryNameCheck aNameChecker( getConnection(), CommandType::TABLE ); - OSaveAsDlg aDlg( getView(), CommandType::TABLE, getORB(), getConnection(), aDefaultName, aNameChecker ); + OSaveAsDlg aDlg( getView(), CommandType::TABLE, comphelper::getComponentContext(getORB()), getConnection(), aDefaultName, aNameChecker ); if ( aDlg.Execute() != RET_OK ) return sal_False; @@ -514,7 +514,7 @@ void OTableController::doEditIndexes() if (!xIndexes.is()) return; - DbaIndexDialog aDialog(getView(), aFieldNames, xIndexes, getConnection(),getORB(),isConnected() ? getConnection()->getMetaData().is() && getConnection()->getMetaData()->getMaxColumnsInIndex() : sal_Int32(0)); + DbaIndexDialog aDialog(getView(), aFieldNames, xIndexes, getConnection(), comphelper::getComponentContext(getORB()), isConnected() ? getConnection()->getMetaData().is() && getConnection()->getMetaData()->getMaxColumnsInIndex() : sal_Int32(0)); if (RET_OK != aDialog.Execute()) return; diff --git a/dbaccess/source/ui/uno/dbinteraction.cxx b/dbaccess/source/ui/uno/dbinteraction.cxx index e992ae06de5d..1b2268ce6fc1 100644 --- a/dbaccess/source/ui/uno/dbinteraction.cxx +++ b/dbaccess/source/ui/uno/dbinteraction.cxx @@ -66,8 +66,8 @@ namespace dbaui //= BasicInteractionHandler //========================================================================= //------------------------------------------------------------------------- - BasicInteractionHandler::BasicInteractionHandler( const Reference< XMultiServiceFactory >& _rxORB, const bool i_bFallbackToGeneric ) - :m_xORB( _rxORB ) + BasicInteractionHandler::BasicInteractionHandler( const Reference< XComponentContext >& rxContext, const bool i_bFallbackToGeneric ) + :m_xContext( rxContext ) ,m_bFallbackToGeneric( i_bFallbackToGeneric ) { OSL_ENSURE( !m_bFallbackToGeneric, @@ -139,7 +139,7 @@ namespace dbaui xParamCallback = Reference< XInteractionSupplyParameters >(_rContinuations[nParamPos], UNO_QUERY); OSL_ENSURE(xParamCallback.is(), "BasicInteractionHandler::implHandle(ParametersRequest): can't set the parameters without an appropriate interaction handler!s"); - OParameterDialog aDlg(NULL, _rParamRequest.Parameters, _rParamRequest.Connection, comphelper::getComponentContext(m_xORB)); + OParameterDialog aDlg(NULL, _rParamRequest.Parameters, _rParamRequest.Connection, m_xContext); sal_Int16 nResult = aDlg.Execute(); try { @@ -270,7 +270,7 @@ namespace dbaui Reference< XInteractionDocumentSave > xCallback(_rContinuations[nDocuPos], UNO_QUERY); OSL_ENSURE(xCallback.is(), "BasicInteractionHandler::implHandle(DocumentSaveRequest): can't save document without an appropriate interaction handler!s"); - OCollectionView aDlg(NULL,_rDocuRequest.Content,_rDocuRequest.Name,m_xORB); + OCollectionView aDlg(NULL, _rDocuRequest.Content, _rDocuRequest.Name, m_xContext); sal_Int16 nResult = aDlg.Execute(); try { @@ -304,10 +304,10 @@ namespace dbaui //------------------------------------------------------------------------- bool BasicInteractionHandler::implHandleUnknown( const Reference< XInteractionRequest >& _rxRequest ) { - if ( m_xORB.is() ) + if ( m_xContext.is() ) { Reference< XInteractionHandler2 > xFallbackHandler( - InteractionHandler::createWithParent(comphelper::getComponentContext(m_xORB), 0) ); + InteractionHandler::createWithParent(m_xContext, 0) ); xFallbackHandler->handle( _rxRequest ); return true; } @@ -355,12 +355,29 @@ namespace dbaui //========================================================================== //= SQLExceptionInteractionHandler //========================================================================== - IMPLEMENT_SERVICE_INFO1_STATIC( SQLExceptionInteractionHandler, "com.sun.star.comp.dbaccess.DatabaseInteractionHandler", "com.sun.star.sdb.DatabaseInteractionHandler" ); + IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(SQLExceptionInteractionHandler, "com.sun.star.comp.dbaccess.DatabaseInteractionHandler") + IMPLEMENT_SERVICE_INFO_SUPPORTS(SQLExceptionInteractionHandler) + IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(SQLExceptionInteractionHandler, "com.sun.star.sdb.DatabaseInteractionHandler") + + Reference< XInterface > + SAL_CALL SQLExceptionInteractionHandler::Create(const Reference< XMultiServiceFactory >& _rxORB) + { + return static_cast< XServiceInfo* >(new SQLExceptionInteractionHandler(comphelper::getComponentContext(_rxORB))); + } //========================================================================== //= LegacyInteractionHandler //========================================================================== - IMPLEMENT_SERVICE_INFO1_STATIC( LegacyInteractionHandler, "com.sun.star.comp.dbaccess.LegacyInteractionHandler", "com.sun.star.sdb.InteractionHandler" ); + IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(LegacyInteractionHandler, "com.sun.star.comp.dbaccess.LegacyInteractionHandler") + IMPLEMENT_SERVICE_INFO_SUPPORTS(LegacyInteractionHandler) + IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(LegacyInteractionHandler, "com.sun.star.sdb.LegacyInteractionHandler") + + + Reference< XInterface > + SAL_CALL LegacyInteractionHandler::Create(const Reference< XMultiServiceFactory >& _rxORB) + { + return static_cast< XServiceInfo* >(new LegacyInteractionHandler(comphelper::getComponentContext(_rxORB))); + } //......................................................................... } // namespace dbaui diff --git a/dbaccess/source/ui/uno/dbinteraction.hxx b/dbaccess/source/ui/uno/dbinteraction.hxx index f5e7496de485..32018f7b8bab 100644 --- a/dbaccess/source/ui/uno/dbinteraction.hxx +++ b/dbaccess/source/ui/uno/dbinteraction.hxx @@ -63,13 +63,13 @@ namespace dbaui :public BasicInteractionHandler_Base { const OModuleClient m_aModuleClient; - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; const bool m_bFallbackToGeneric; public: BasicInteractionHandler( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_rORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const bool i_bFallbackToGeneric ); @@ -131,9 +131,9 @@ namespace dbaui { public: SQLExceptionInteractionHandler( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_rORB + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) - :BasicInteractionHandler( i_rORB, false ) + :BasicInteractionHandler( rxContext, false ) { } @@ -161,9 +161,9 @@ namespace dbaui { public: LegacyInteractionHandler( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_rORB + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) - :BasicInteractionHandler( i_rORB, true ) + :BasicInteractionHandler( rxContext, true ) { } diff --git a/dbaccess/source/ui/uno/unoDirectSql.cxx b/dbaccess/source/ui/uno/unoDirectSql.cxx index af33da0c8221..3bebc92be2d7 100644 --- a/dbaccess/source/ui/uno/unoDirectSql.cxx +++ b/dbaccess/source/ui/uno/unoDirectSql.cxx @@ -86,7 +86,7 @@ DBG_NAME(ODirectSQLDialog) try { // the connection the row set is working with - ODatasourceConnector aDSConnector(m_aContext.getLegacyServiceFactory(),_pParent); + ODatasourceConnector aDSConnector(m_aContext.getUNOContext(), _pParent); xConnection = aDSConnector.connect( m_sInitialSelection, NULL ); } catch( const Exception& ) diff --git a/dbaccess/source/ui/uno/unosqlmessage.cxx b/dbaccess/source/ui/uno/unosqlmessage.cxx index d966ad239ad6..6e52da92afb0 100644 --- a/dbaccess/source/ui/uno/unosqlmessage.cxx +++ b/dbaccess/source/ui/uno/unosqlmessage.cxx @@ -96,6 +96,24 @@ Reference< XInterface > SAL_CALL OSQLMessageDialog::Create(const Reference< XMul } //------------------------------------------------------------------------- +void OSQLMessageDialog::initialize(Sequence<Any> const & args) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException) +{ + OUString title; + Reference< com::sun::star::awt::XWindow > parentWindow; + Reference< com::sun::star::sdbc::SQLException > sqlException; + + if ((args.getLength() == 3) && (args[0] >>= title) && (args[1] >>= parentWindow) && (args[2] >>= sqlException)) { + Sequence<Any> s(3); + s[0] <<= PropertyValue( "Title", -1, makeAny(title), PropertyState_DIRECT_VALUE); + s[1] <<= PropertyValue( "ParentWindow", -1, makeAny(parentWindow), PropertyState_DIRECT_VALUE); + s[2] <<= PropertyValue( "SQLException", -1, makeAny(sqlException), PropertyState_DIRECT_VALUE); + OGenericUnoDialog::initialize(s); + } else { + OGenericUnoDialog::initialize(args); + } +} + +//------------------------------------------------------------------------- sal_Bool SAL_CALL OSQLMessageDialog::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue) throw(IllegalArgumentException) { switch (_nHandle) diff --git a/extensions/source/propctrlr/MasterDetailLinkDialog.cxx b/extensions/source/propctrlr/MasterDetailLinkDialog.cxx index a8ae66f4bfd1..a675117b6f5a 100644 --- a/extensions/source/propctrlr/MasterDetailLinkDialog.cxx +++ b/extensions/source/propctrlr/MasterDetailLinkDialog.cxx @@ -105,7 +105,7 @@ namespace pcr //-------------------------------------------------------------------------- Dialog* MasterDetailLinkDialog::createDialog(Window* _pParent) { - return new FormLinkDialog(_pParent,m_xDetail,m_xMaster,m_aContext.getLegacyServiceFactory() + return new FormLinkDialog(_pParent,m_xDetail,m_xMaster,m_aContext.getUNOContext() ,m_sExplanation,m_sDetailLabel,m_sMasterLabel); } //--------------------------------------------------------------------- diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 350483c974b6..badf4077248b 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -2386,7 +2386,7 @@ namespace pcr //------------------------------------------------------------------------ void FormComponentPropertyHandler::impl_displaySQLError_nothrow( const ::dbtools::SQLExceptionInfo& _rErrorDescriptor ) const { - ::dbtools::showError( _rErrorDescriptor, VCLUnoHelper::GetInterface( impl_getDefaultDialogParent_nothrow() ), m_aContext.getLegacyServiceFactory() ); + ::dbtools::showError( _rErrorDescriptor, VCLUnoHelper::GetInterface( impl_getDefaultDialogParent_nothrow() ), m_aContext.getUNOContext() ); } //------------------------------------------------------------------------ @@ -2682,7 +2682,7 @@ namespace pcr return false; - FormLinkDialog aDialog( impl_getDefaultDialogParent_nothrow(), m_xComponent, xMasterProp, m_aContext.getLegacyServiceFactory() ); + FormLinkDialog aDialog( impl_getDefaultDialogParent_nothrow(), m_xComponent, xMasterProp, m_aContext.getUNOContext() ); _rClearBeforeDialog.clear(); return ( RET_OK == aDialog.Execute() ); } diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx index fadcc0afd107..d38b2475e50f 100644 --- a/extensions/source/propctrlr/formlinkdialog.cxx +++ b/extensions/source/propctrlr/formlinkdialog.cxx @@ -148,7 +148,7 @@ namespace pcr //======================================================================== //------------------------------------------------------------------------ FormLinkDialog::FormLinkDialog( Window* _pParent, const Reference< XPropertySet >& _rxDetailForm, - const Reference< XPropertySet >& _rxMasterForm, const Reference< XMultiServiceFactory >& _rxORB, + const Reference< XPropertySet >& _rxMasterForm, const Reference< XComponentContext >& _rxContext, const ::rtl::OUString& _sExplanation, const ::rtl::OUString& _sDetailLabel, const ::rtl::OUString& _sMasterLabel) @@ -164,7 +164,7 @@ namespace pcr ,m_aCancel ( this, PcrRes( PB_CANCEL ) ) ,m_aHelp ( this, PcrRes( PB_HELP ) ) ,m_aSuggest ( this, PcrRes( PB_SUGGEST ) ) - ,m_xORB ( _rxORB ) + ,m_xContext ( _rxContext ) ,m_xDetailForm( _rxDetailForm ) ,m_xMasterForm( _rxMasterForm ) ,m_sDetailLabel(_sDetailLabel) @@ -436,7 +436,7 @@ namespace pcr SQLContext aContext; aContext.Message = sErrorMessage; aContext.NextException = aErrorInfo.get(); - ::dbtools::showError( aContext, VCLUnoHelper::GetInterface( const_cast< FormLinkDialog* >( this ) ), m_xORB ); + ::dbtools::showError( aContext, VCLUnoHelper::GetInterface( const_cast< FormLinkDialog* >( this ) ), m_xContext ); } } @@ -450,7 +450,7 @@ namespace pcr _rxConnection.set(_rxFormProps->getPropertyValue(PROPERTY_ACTIVE_CONNECTION),UNO_QUERY); if ( !_rxConnection.is() ) - _rxConnection = ::dbtools::connectRowset( Reference< XRowSet >( _rxFormProps, UNO_QUERY ), comphelper::getComponentContext(m_xORB), sal_True ); + _rxConnection = ::dbtools::connectRowset( Reference< XRowSet >( _rxFormProps, UNO_QUERY ), m_xContext, sal_True ); } //------------------------------------------------------------------------ @@ -472,7 +472,7 @@ namespace pcr Reference< XPropertySet > xTable; try { - Reference< XTablesSupplier > xTablesInForm( ::dbtools::getCurrentSettingsComposer( _rxFormProps, comphelper::getComponentContext(m_xORB) ), UNO_QUERY ); + Reference< XTablesSupplier > xTablesInForm( ::dbtools::getCurrentSettingsComposer( _rxFormProps, m_xContext ), UNO_QUERY ); Reference< XNameAccess > xTables; if ( xTablesInForm.is() ) xTables = xTablesInForm->getTables(); diff --git a/extensions/source/propctrlr/formlinkdialog.hxx b/extensions/source/propctrlr/formlinkdialog.hxx index 08093ad60a11..7c859fc01cdf 100644 --- a/extensions/source/propctrlr/formlinkdialog.hxx +++ b/extensions/source/propctrlr/formlinkdialog.hxx @@ -57,8 +57,8 @@ namespace pcr HelpButton m_aHelp; PushButton m_aSuggest; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xDetailForm; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > @@ -77,7 +77,7 @@ namespace pcr Window* _pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDetailForm, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxMasterForm, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const ::rtl::OUString& _sExplanation = ::rtl::OUString(), const ::rtl::OUString& _sDetailLabel = ::rtl::OUString(), const ::rtl::OUString& _sMasterLabel = ::rtl::OUString() diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx index 6d92e77df421..b8a1d1f14f9e 100644 --- a/forms/source/component/Filter.cxx +++ b/forms/source/component/Filter.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/form/FormComponentType.hpp> #include <com/sun/star/sdb/BooleanComparisonMode.hpp> +#include <com/sun/star/sdb/ErrorMessageDialog.hpp> #include <com/sun/star/sdb/XColumn.hpp> #include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp> #include <com/sun/star/sdbc/DataType.hpp> @@ -742,20 +743,8 @@ namespace frm { try { - Sequence< Any > aArgs(2); - aArgs[0] <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLException") ), 0, makeAny( _rExcept ), PropertyState_DIRECT_VALUE); - aArgs[1] <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow") ), 0, makeAny( m_xMessageParent ), PropertyState_DIRECT_VALUE); - - static ::rtl::OUString s_sDialogServiceName (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.ErrorMessageDialog") ); - - Reference< XExecutableDialog > xErrorDialog( maContext.createComponentWithArguments( s_sDialogServiceName, aArgs ), UNO_QUERY ); - if ( xErrorDialog.is() ) - xErrorDialog->execute(); - else - { - Window* pMessageParent = VCLUnoHelper::GetWindow( m_xMessageParent ); - ShowServiceNotAvailableError( pMessageParent, s_sDialogServiceName, sal_True ); - } + Reference< XExecutableDialog > xErrorDialog = ErrorMessageDialog::create( maContext.getUNOContext(), "", m_xMessageParent, makeAny(_rExcept)); + xErrorDialog->execute(); } catch( const Exception& ) { diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 5692dc9e8c51..c4b467dd8761 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -242,6 +242,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/sdb,\ DataAccessDescriptorFactory \ DatabaseContext \ DatabaseInteractionHandler \ + ErrorMessageDialog \ InteractionHandler \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/sdb/application,\ @@ -982,7 +983,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/sdb,\ DocumentContainer \ DocumentDataSource \ DocumentDefinition \ - ErrorMessageDialog \ Forms \ OfficeDatabaseDocument \ OrderColumn \ diff --git a/offapi/com/sun/star/sdb/ErrorMessageDialog.idl b/offapi/com/sun/star/sdb/ErrorMessageDialog.idl index c7e925ffcda6..bd36735b988d 100644 --- a/offapi/com/sun/star/sdb/ErrorMessageDialog.idl +++ b/offapi/com/sun/star/sdb/ErrorMessageDialog.idl @@ -20,15 +20,12 @@ #ifndef __com_sun_star_sdb_ErrorMessageDialog_idl__ #define __com_sun_star_sdb_ErrorMessageDialog_idl__ -#include <com/sun/star/ui/dialogs/XExecutableDialog.idl> #include <com/sun/star/awt/XWindow.idl> -#include <com/sun/star/lang/XInitialization.idl> #include <com/sun/star/beans/XPropertySet.idl> - +#include <com/sun/star/ui/dialogs/XExecutableDialog.idl> module com { module sun { module star { module sdb { - /** provides a dialog for displaying database related exceptions. <p> If applications use any of the functionality provided in the modules @@ -60,47 +57,8 @@ module com { module sun { module star { module sdb { @see com.sun.star.sdb.InteractionHandler </p> */ -published service ErrorMessageDialog +published service ErrorMessageDialog : com::sun::star::ui::dialogs::XExecutableDialog { - /** the title of the (dialog) window - */ - [property] string Title; - - /** parent window to use for the dialog - <p> - This property can't be set while the dialog is being displayed. - </p> - */ - [property] com::sun::star::awt::XWindow ParentWindow; - - /** is the exception displayed by the dialog - <p> - This should contain a - <type scope="com::sun::star::sdbc">SQLException</type> - instance, or an instance - of any class derived from this exception. - </p> - <p> - This property can't be set while the dialog is being displayed. - </p> - */ - [property] any SQLException; - - /** specifies the URL to the help topic to associate with the dialog. - - <p>If This URL is not empty, then the dialog will get a "Help" button, which - directs the user to the given help topic.</p> - */ - [optional, property] string HelpURL; - - /** allows access to the properties of the object - */ - interface com::sun::star::beans::XPropertySet; - - /** allows starting execution of the dialog - */ - interface com::sun::star::ui::dialogs::XExecutableDialog; - /** allows initializing the dialog <p> You do not need to call the initialize method directly, instead you may use the createInstanceWithArguments @@ -123,14 +81,14 @@ published service ErrorMessageDialog <br/> allowed parameters are <ul> - <li><b>Title</b><br/> + <li><b>title</b><br/> String describing the initial title of the dialog. If not specified, a default title is used. </li> - <li><b>ParentWindow</b><br/> + <li><b>parentWindow</b><br/> <type scope="com::sun::star::awt">XWindow</type> describing the parent window to use for the dialog. </li> - <li><b>SQLException</b><br/> + <li><b>sqlException</b><br/> <type scope="com::sun::star::sdbc">SQLException</type> describing the error which is being displayed.<br/> When initializing this value, you may use any derivative of @@ -140,7 +98,7 @@ published service ErrorMessageDialog </ul> </p> */ - interface com::sun::star::lang::XInitialization; + create([in] string initialTitle, [in] com::sun::star::awt::XWindow parentWindow, [in] any sqlException); }; diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb Binary files differindex c178bb1f0daf..1797e21ef754 100644 --- a/offapi/type_reference/types.rdb +++ b/offapi/type_reference/types.rdb diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx index cfb5cbae01e2..fa74b0922b0c 100644 --- a/reportdesign/source/ui/inspection/GeometryHandler.cxx +++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx @@ -1570,11 +1570,9 @@ bool GeometryHandler::impl_dialogFilter_nothrow( ::rtl::OUString& _out_rSelected ::dbtools::SQLExceptionInfo aErrorInfo; uno::Reference< awt::XWindow > xInspectorWindow; uno::Reference< lang::XMultiComponentFactory > xFactory; - uno::Reference<lang::XMultiServiceFactory> xServiceFactory; try { xFactory = m_xContext->getServiceManager(); - xServiceFactory.set(xFactory,uno::UNO_QUERY); xInspectorWindow.set(m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DialogParentWindow"))) ,uno::UNO_QUERY); uno::Reference<sdbc::XConnection> xCon(m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ActiveConnection"))) ,uno::UNO_QUERY); if ( !xCon.is() ) @@ -1627,7 +1625,7 @@ bool GeometryHandler::impl_dialogFilter_nothrow( ::rtl::OUString& _out_rSelected } if ( aErrorInfo.isValid() ) - ::dbtools::showError( aErrorInfo, xInspectorWindow, xServiceFactory ); + ::dbtools::showError( aErrorInfo, xInspectorWindow, m_xContext ); return bSuccess; } diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index 6fdf61706183..336894df2913 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -1049,7 +1049,7 @@ bool openDialogFormula_nothrow( ::rtl::OUString& _in_out_rFormula } if ( aErrorInfo.isValid() ) - ::dbtools::showError( aErrorInfo, xInspectorWindow, xServiceFactory ); + ::dbtools::showError( aErrorInfo, xInspectorWindow, _xContext ); return bSuccess; } diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx index 8a671fbf49ce..3e4553f29c2f 100644 --- a/svx/source/form/fmtools.cxx +++ b/svx/source/form/fmtools.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/sdb/CommandType.hpp> #include <com/sun/star/sdb/ErrorCondition.hpp> +#include <com/sun/star/sdb/ErrorMessageDialog.hpp> #include <com/sun/star/sdb/SQLContext.hpp> #include <com/sun/star/sdb/XCompletedConnection.hpp> #include <com/sun/star/sdb/XQueriesSupplier.hpp> @@ -136,19 +137,10 @@ void displayException(const Any& _rExcept, Window* _pParent) Window* pParentWindow = _pParent ? _pParent : GetpApp()->GetDefDialogParent(); Reference< XWindow > xParentWindow = VCLUnoHelper::GetInterface(pParentWindow); - Sequence< Any > aArgs(2); - aArgs[0] <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLException")), 0, _rExcept, PropertyState_DIRECT_VALUE); - aArgs[1] <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow")), 0, makeAny(xParentWindow), PropertyState_DIRECT_VALUE); - - static ::rtl::OUString s_sDialogServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.ErrorMessageDialog") ); - Reference< XExecutableDialog > xErrorDialog( - ::comphelper::getProcessServiceFactory()->createInstanceWithArguments(s_sDialogServiceName, aArgs), UNO_QUERY); - if (xErrorDialog.is()) - xErrorDialog->execute(); - else - ShowServiceNotAvailableError(pParentWindow, s_sDialogServiceName, sal_True); + Reference< XExecutableDialog > xErrorDialog = ErrorMessageDialog::create(::comphelper::getProcessComponentContext(), "", xParentWindow, _rExcept); + xErrorDialog->execute(); } - catch(Exception&) + catch(const Exception&) { OSL_FAIL("displayException: could not display the error message!"); } |