diff options
author | Frank Schönheit <fs@openoffice.org> | 2001-04-03 11:42:48 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2001-04-03 11:42:48 +0000 |
commit | b1ace52fb1d3853055af046e020ea4729bb6e50f (patch) | |
tree | da542ae95f85bf9e3f8634bbe4737da32d033d51 /extensions/source | |
parent | 1f6791c11135c140d6321300b2e319c30024cef4 (diff) |
#85223# get-/setFormConnection
Diffstat (limited to 'extensions/source')
-rw-r--r-- | extensions/source/dbpilots/controlwizard.cxx | 59 | ||||
-rw-r--r-- | extensions/source/dbpilots/controlwizard.hxx | 17 |
2 files changed, 72 insertions, 4 deletions
diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx index 18fd2b9973b3..49390a08bbcf 100644 --- a/extensions/source/dbpilots/controlwizard.cxx +++ b/extensions/source/dbpilots/controlwizard.cxx @@ -2,9 +2,9 @@ * * $RCSfile: controlwizard.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: fs $ $Date: 2001-03-05 14:53:13 $ + * last change: $Author: fs $ $Date: 2001-04-03 12:42:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -171,12 +171,30 @@ namespace dbp } //--------------------------------------------------------------------- + const OControlWizard* OControlWizardPage::getDialog() const + { + return static_cast< OControlWizard* >(GetParent()); + } + + //--------------------------------------------------------------------- sal_Bool OControlWizardPage::updateContext() { return getDialog()->updateContext(OAccessRegulator()); } //--------------------------------------------------------------------- + Reference< XConnection > OControlWizardPage::getFormConnection() const + { + return getDialog()->getFormConnection(OAccessRegulator()); + } + + //--------------------------------------------------------------------- + void OControlWizardPage::setFormConnection(const Reference< XConnection >& _rxConn) + { + getDialog()->setFormConnection(OAccessRegulator(), _rxConn); + } + + //--------------------------------------------------------------------- const OControlWizardContext& OControlWizardPage::getContext() { return getDialog()->getContext(); @@ -404,6 +422,40 @@ namespace dbp } //--------------------------------------------------------------------- + Reference< XConnection > OControlWizard::getFormConnection(const OAccessRegulator&) const + { + Reference< XConnection > xConn; + try + { + m_aContext.xForm->getPropertyValue(::rtl::OUString::createFromAscii("ActiveConnection")) >>= xConn; + } + catch(const Exception&) + { + DBG_ERROR("OControlWizard::getFormConnection: caught an exception!"); + } + return xConn; + } + + //--------------------------------------------------------------------- + void OControlWizard::setFormConnection(const OAccessRegulator& _rAccess, const Reference< XConnection >& _rxConn) + { + try + { + Reference< XConnection > xOldConn = getFormConnection(_rAccess); + if (xOldConn.get() == _rxConn.get()) + return; + + disposeComponent(xOldConn); + + m_aContext.xForm->setPropertyValue(::rtl::OUString::createFromAscii("ActiveConnection"), makeAny(_rxConn)); + } + catch(const Exception&) + { + DBG_ERROR("OControlWizard::setFormConnection: caught an exception!"); + } + } + + //--------------------------------------------------------------------- sal_Bool OControlWizard::updateContext(const OAccessRegulator&) { return initContext(); @@ -647,6 +699,9 @@ namespace dbp /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.4 2001/03/05 14:53:13 fs + * finished the grid control wizard + * * Revision 1.3 2001/02/28 09:18:30 fs * finalized the list/combo wizard * diff --git a/extensions/source/dbpilots/controlwizard.hxx b/extensions/source/dbpilots/controlwizard.hxx index d398a22d8798..ee756d7b9241 100644 --- a/extensions/source/dbpilots/controlwizard.hxx +++ b/extensions/source/dbpilots/controlwizard.hxx @@ -2,9 +2,9 @@ * * $RCSfile: controlwizard.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: fs $ $Date: 2001-03-05 14:53:13 $ + * last change: $Author: fs $ $Date: 2001-04-03 12:42:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,6 +71,9 @@ #ifndef _COM_SUN_STAR_FORM_FORMCOMPONENTTYPE_HPP_ #include <com/sun/star/form/FormComponentType.hpp> #endif +#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ +#include <com/sun/star/sdbc/XConnection.hpp> +#endif #ifndef _SV_FIXED_HXX #include <vcl/fixed.hxx> #endif @@ -121,10 +124,14 @@ namespace dbp { protected: OControlWizard* getDialog(); + const OControlWizard* getDialog() const; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceFactory(); const OControlWizardContext& getContext(); sal_Bool updateContext(); + void setFormConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > + getFormConnection() const; public: OControlWizardPage( OControlWizard* _pParent, const ResId& _rResId ); @@ -172,6 +179,9 @@ namespace dbp const OControlWizardContext& getContext() const { return m_aContext; } sal_Bool updateContext(const OAccessRegulator&); + void setFormConnection(const OAccessRegulator&, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > + getFormConnection(const OAccessRegulator&) const; protected: // initialize the derivees settings (which have to be derived from OControlWizardSettings) @@ -208,6 +218,9 @@ namespace dbp /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.4 2001/03/05 14:53:13 fs + * finished the grid control wizard + * * Revision 1.3 2001/02/28 09:18:30 fs * finalized the list/combo wizard * |