diff options
author | Ocke Janssen <oj@openoffice.org> | 2000-11-07 12:16:50 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2000-11-07 12:16:50 +0000 |
commit | f7af35046d81d906655fe341a748fca0410f79b1 (patch) | |
tree | b5bc1d953a0e7d9e2f81afbe6874df2568c2e770 | |
parent | 5fcb7ac37c23b018ece6225dc99499bd0b4b2794 (diff) |
correct getValue in >>=
-rw-r--r-- | svx/source/form/filtnav.cxx | 7 | ||||
-rw-r--r-- | svx/source/form/fmPropBrw.cxx | 5 | ||||
-rw-r--r-- | svx/source/form/fmctrler.cxx | 148 | ||||
-rw-r--r-- | svx/source/form/fmexpl.cxx | 29 | ||||
-rw-r--r-- | svx/source/form/fmobj.cxx | 20 | ||||
-rw-r--r-- | svx/source/form/fmpgeimp.cxx | 27 | ||||
-rw-r--r-- | svx/source/form/fmshell.cxx | 6 | ||||
-rw-r--r-- | svx/source/form/fmshimp.cxx | 260 | ||||
-rw-r--r-- | svx/source/form/fmtools.cxx | 204 | ||||
-rw-r--r-- | svx/source/form/fmundo.cxx | 42 | ||||
-rw-r--r-- | svx/source/form/fmview.cxx | 18 |
11 files changed, 500 insertions, 266 deletions
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx index 43be534352c1..8579cf337946 100644 --- a/svx/source/form/filtnav.cxx +++ b/svx/source/form/filtnav.cxx @@ -2,9 +2,9 @@ * * $RCSfile: filtnav.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2000-11-06 07:07:42 $ + * last change: $Author: oj $ $Date: 2000-11-07 13:16:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -700,7 +700,8 @@ void FmFilterModel::Update(const Reference< ::com::sun::star::container::XIndexA sal_Int32 nCount = xControllers->getCount(); for (sal_Int32 i = 0; i < nCount; i++) { - Reference< ::com::sun::star::form::XFormController > xController(*(Reference< ::com::sun::star::form::XFormController > *)xControllers->getByIndex(i).getValue()); + Reference< ::com::sun::star::form::XFormController > xController; + xControllers->getByIndex(i) >>= xController; Reference< ::com::sun::star::beans::XPropertySet > xModelAsSet(xController->getModel(), UNO_QUERY); ::rtl::OUString aName = ::comphelper::getString(xModelAsSet->getPropertyValue(FM_PROP_NAME)); diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx index 380335a37953..14d17300dd27 100644 --- a/svx/source/form/fmPropBrw.cxx +++ b/svx/source/form/fmPropBrw.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fmPropBrw.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2000-11-06 07:10:57 $ + * last change: $Author: oj $ $Date: 2000-11-07 13:16:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -224,6 +224,7 @@ try catch(...) { + DBG_ERROR("FmPropBrw::StateChanged: Exception occured!"); } } diff --git a/svx/source/form/fmctrler.cxx b/svx/source/form/fmctrler.cxx index ffb052639832..07d68a4e8eca 100644 --- a/svx/source/form/fmctrler.cxx +++ b/svx/source/form/fmctrler.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fmctrler.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2000-11-06 07:13:04 $ + * last change: $Author: oj $ $Date: 2000-11-07 13:16:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -720,10 +720,11 @@ void FmXFormController::addChild(FmXFormController* pChild) // search the position of the model within the form sal_uInt32 nPos = m_xModelAsIndex->getCount(); + Reference< ::com::sun::star::form::XFormComponent > xTemp; for( ; nPos; ) { - if ((::com::sun::star::form::XFormComponent*)xForm.get() == - (::com::sun::star::form::XFormComponent*)(*(Reference< ::com::sun::star::form::XFormComponent > *)m_xModelAsIndex->getByIndex(--nPos).getValue()).get()) + m_xModelAsIndex->getByIndex(--nPos) >>= xTemp; + if ((::com::sun::star::form::XFormComponent*)xForm.get() == (::com::sun::star::form::XFormComponent*)xTemp.get()) { Reference< XInterface > xIfc(xController, UNO_QUERY); m_xModelAsManager->attach( nPos, xIfc, makeAny( xController) ); @@ -784,11 +785,12 @@ void FmXFormController::disposing(void) // search the position of the model within the form Reference< ::com::sun::star::form::XFormComponent > xForm((*i)->getModel(), UNO_QUERY); sal_uInt32 nPos = m_xModelAsIndex->getCount(); + Reference< ::com::sun::star::form::XFormComponent > xTemp; for( ; nPos; ) { - if ((::com::sun::star::form::XFormComponent*)xForm.get() == - (::com::sun::star::form::XFormComponent*)(*(Reference< ::com::sun::star::form::XFormComponent > *)m_xModelAsIndex->getByIndex(--nPos).getValue()).get()) + m_xModelAsIndex->getByIndex(--nPos) >>= xTemp; + if ((::com::sun::star::form::XFormComponent*)xForm.get() == (::com::sun::star::form::XFormComponent*)xTemp.get()) { Reference< XInterface > xIfc(*i, UNO_QUERY); m_xModelAsManager->detach( nPos, xIfc); @@ -826,6 +828,7 @@ void FmXFormController::disposing(void) //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::propertyChange(const PropertyChangeEvent& evt) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); sal_Bool bModifiedChanged = (evt.PropertyName == FM_PROP_ISMODIFIED); sal_Bool bNewChanged = (evt.PropertyName == FM_PROP_ISNEW); if (bModifiedChanged || bNewChanged) @@ -863,6 +866,7 @@ void SAL_CALL FmXFormController::propertyChange(const PropertyChangeEvent& evt) //------------------------------------------------------------------------------ void FmXFormController::toggleAutoFields(sal_Bool bAutoFields) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); if (!m_pView) { DBG_ERROR("FmXFormController::toggleAutoFields : you can't call toggleAutoFields when no view exists !"); @@ -895,8 +899,8 @@ void FmXFormController::toggleAutoFields(sal_Bool bAutoFields) if (xSet.is() && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xSet)) { // does the model use a bound field ? - Any aVal = xSet->getPropertyValue(FM_PROP_BOUNDFIELD); - Reference< XPropertySet > xField = *(Reference< XPropertySet > *)aVal.getValue(); + Reference< XPropertySet > xField; + xSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField; // is it a autofield? if (xField.is() && ::comphelper::hasProperty(FM_PROP_AUTOINCREMENT, xField) && @@ -942,8 +946,8 @@ void FmXFormController::toggleAutoFields(sal_Bool bAutoFields) if (xSet.is() && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xSet)) { // does the model use a bound field ? - Any aVal = xSet->getPropertyValue(FM_PROP_BOUNDFIELD); - Reference< XPropertySet > xField = *(Reference< XPropertySet > *)aVal.getValue(); + Reference< XPropertySet > xField; + xSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField; // is it a autofield? if (xField.is() && ::comphelper::hasProperty(FM_PROP_AUTOINCREMENT, xField) && @@ -988,6 +992,7 @@ void FmXFormController::toggleAutoFields(sal_Bool bAutoFields) //------------------------------------------------------------------------------ IMPL_LINK(FmXFormController, OnToggleAutoFields, void*, EMPTYARG) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_nToggleEvent = 0; toggleAutoFields(m_bCurrentRecordNew); return 1L; @@ -997,6 +1002,7 @@ IMPL_LINK(FmXFormController, OnToggleAutoFields, void*, EMPTYARG) //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::textChanged(const ::com::sun::star::awt::TextEvent& e) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); if (m_bFiltering) { Reference< ::com::sun::star::awt::XTextComponent > xText(e.Source,UNO_QUERY); @@ -1025,6 +1031,7 @@ void SAL_CALL FmXFormController::textChanged(const ::com::sun::star::awt::TextEv //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::itemStateChanged(const ::com::sun::star::awt::ItemEvent& rEvent) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); if (!m_bModified) onModify(); } @@ -1033,12 +1040,14 @@ void SAL_CALL FmXFormController::itemStateChanged(const ::com::sun::star::awt::I //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::addModifyListener(const Reference< ::com::sun::star::util::XModifyListener > & l) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_aModifyListeners.addInterface( l ); } //------------------------------------------------------------------------------ void FmXFormController::removeModifyListener(const Reference< ::com::sun::star::util::XModifyListener > & l) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_aModifyListeners.removeInterface( l ); } @@ -1046,6 +1055,7 @@ void FmXFormController::removeModifyListener(const Reference< ::com::sun::star:: //------------------------------------------------------------------------------ void FmXFormController::modified(const ::com::sun::star::lang::EventObject& rEvent) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); if (!m_bModified) onModify(); } @@ -1053,6 +1063,7 @@ void FmXFormController::modified(const ::com::sun::star::lang::EventObject& rEve //------------------------------------------------------------------------------ void FmXFormController::onModify() { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); if (!m_bModified) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -1068,6 +1079,7 @@ void FmXFormController::onModify() //------------------------------------------------------------------------------ sal_Bool FmXFormController::determineLockState() const { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); // a.) in filter mode we are always locked // b.) if we have no valid model or our model (a result set) is not alive -> we're locked // c.) if we are inserting everything is OK and we are not locked @@ -1084,6 +1096,7 @@ sal_Bool FmXFormController::determineLockState() const //------------------------------------------------------------------------------ void FmXFormController::focusGained(const ::com::sun::star::awt::FocusEvent& e) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); ::osl::MutexGuard aGuard( m_aMutex ); Reference< ::com::sun::star::awt::XControl > xControl(e.Source, UNO_QUERY); @@ -1189,6 +1202,7 @@ void FmXFormController::focusGained(const ::com::sun::star::awt::FocusEvent& e) //------------------------------------------------------------------------------ void FmXFormController::onActivate() { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); // benachrichtigen, dass form activiert ::com::sun::star::lang::EventObject aEvt; aEvt.Source = *this; @@ -1204,6 +1218,7 @@ void FmXFormController::onActivate() //------------------------------------------------------------------------------ void FmXFormController::focusLost(const ::com::sun::star::awt::FocusEvent& e) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); Reference< ::com::sun::star::awt::XControl > xControl(e.Source, UNO_QUERY); Reference< ::com::sun::star::awt::XWindowPeer > xNext(e.NextFocus, UNO_QUERY); Reference< ::com::sun::star::awt::XControl > xNextControl = isInList(xNext); @@ -1219,6 +1234,7 @@ void FmXFormController::focusLost(const ::com::sun::star::awt::FocusEvent& e) //------------------------------------------------------------------------------ void FmXFormController::setModel(const Reference< ::com::sun::star::awt::XTabControllerModel > & Model) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); ::osl::MutexGuard aGuard( m_aMutex ); DBG_ASSERT(m_xTabController.is(), "FmXFormController::setModel : invalid aggregate !"); @@ -1287,6 +1303,7 @@ void FmXFormController::setModel(const Reference< ::com::sun::star::awt::XTabCon //------------------------------------------------------------------------------ Reference< ::com::sun::star::awt::XTabControllerModel > FmXFormController::getModel() { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); DBG_ASSERT(m_xTabController.is(), "FmXFormController::getModel : invalid aggregate !"); if (!m_xTabController.is()) return Reference< ::com::sun::star::awt::XTabControllerModel > (); @@ -1296,16 +1313,18 @@ Reference< ::com::sun::star::awt::XTabControllerModel > FmXFormController::getM //------------------------------------------------------------------------------ void FmXFormController::addToEventAttacher(const Reference< ::com::sun::star::awt::XControl > & xControl) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); // anmelden beim Eventattacher Reference< ::com::sun::star::form::XFormComponent > xComp(xControl->getModel(), UNO_QUERY); if (xComp.is() && m_xModelAsIndex.is()) { // Und die Position des ControlModel darin suchen sal_uInt32 nPos = m_xModelAsIndex->getCount(); + Reference< ::com::sun::star::form::XFormComponent > xTemp; for( ; nPos; ) { - if ((::com::sun::star::form::XFormComponent*)xComp.get() == - (::com::sun::star::form::XFormComponent*)(*(Reference< ::com::sun::star::form::XFormComponent > *)m_xModelAsIndex->getByIndex(--nPos).getValue()).get()) + m_xModelAsIndex->getByIndex(--nPos) >>= xTemp; + if ((::com::sun::star::form::XFormComponent*)xComp.get() == (::com::sun::star::form::XFormComponent*)xTemp.get()) { Reference< XInterface > xIfc(xControl, UNO_QUERY); m_xModelAsManager->attach( nPos, xIfc, makeAny(xControl) ); @@ -1318,16 +1337,18 @@ void FmXFormController::addToEventAttacher(const Reference< ::com::sun::star::aw //------------------------------------------------------------------------------ void FmXFormController::removeFromEventAttacher(const Reference< ::com::sun::star::awt::XControl > & xControl) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); // abmelden beim Eventattacher Reference< ::com::sun::star::form::XFormComponent > xComp(xControl->getModel(), UNO_QUERY); if (xComp.is() && xComp->getParent().is() && m_xModelAsIndex.is()) { // Und die Position des ControlModel darin suchen sal_uInt32 nPos = m_xModelAsIndex->getCount(); + Reference< ::com::sun::star::form::XFormComponent > xTemp; for( ; nPos; ) { - if ((::com::sun::star::form::XFormComponent*)xComp.get() == - (::com::sun::star::form::XFormComponent*)(*(Reference< ::com::sun::star::form::XFormComponent > *)m_xModelAsIndex->getByIndex(--nPos).getValue()).get()) + m_xModelAsIndex->getByIndex(--nPos) >>= xTemp; + if ((::com::sun::star::form::XFormComponent*)xComp.get() == (::com::sun::star::form::XFormComponent*)xTemp.get()) { Reference< XInterface > xIfc(xControl, UNO_QUERY); m_xModelAsManager->detach( nPos, xIfc ); @@ -1340,6 +1361,7 @@ void FmXFormController::removeFromEventAttacher(const Reference< ::com::sun::sta //------------------------------------------------------------------------------ void FmXFormController::setContainer(const Reference< ::com::sun::star::awt::XControlContainer > & xContainer) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); Reference< ::com::sun::star::awt::XTabControllerModel > xTabModel(getModel()); DBG_ASSERT(xTabModel.is() || !xContainer.is(), "No Model defined"); // if we have a new container we need a model @@ -1471,6 +1493,7 @@ void FmXFormController::setContainer(const Reference< ::com::sun::star::awt::XCo //------------------------------------------------------------------------------ Reference< ::com::sun::star::awt::XControlContainer > FmXFormController::getContainer() { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); DBG_ASSERT(m_xTabController.is(), "FmXFormController::getContainer : invalid aggregate !"); if (!m_xTabController.is()) return Reference< ::com::sun::star::awt::XControlContainer > (); @@ -1480,6 +1503,7 @@ Reference< ::com::sun::star::awt::XControlContainer > FmXFormController::getCon //------------------------------------------------------------------------------ Sequence< Reference< ::com::sun::star::awt::XControl > > FmXFormController::getControls(void) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); ::osl::MutexGuard aGuard( m_aMutex ); if (!m_bControlsSorted) { @@ -1516,6 +1540,7 @@ Sequence< Reference< ::com::sun::star::awt::XControl > > FmXFormController::getC //------------------------------------------------------------------------------ void FmXFormController::autoTabOrder() { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); ::osl::MutexGuard aGuard( m_aMutex ); DBG_ASSERT(m_xTabController.is(), "FmXFormController::autoTabOrder : invalid aggregate !"); if (m_xTabController.is()) @@ -1525,6 +1550,7 @@ void FmXFormController::autoTabOrder() //------------------------------------------------------------------------------ void FmXFormController::activateTabOrder() { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); ::osl::MutexGuard aGuard( m_aMutex ); DBG_ASSERT(m_xTabController.is(), "FmXFormController::activateTabOrder : invalid aggregate !"); if (m_xTabController.is()) @@ -1534,6 +1560,7 @@ void FmXFormController::activateTabOrder() //------------------------------------------------------------------------------ void FmXFormController::setControlLock(const Reference< ::com::sun::star::awt::XControl > & xControl) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); sal_Bool bLocked = isLocked(); // es wird gelockt @@ -1556,8 +1583,8 @@ void FmXFormController::setControlLock(const Reference< ::com::sun::star::awt::X if (bTouch) { - Any aVal = xSet->getPropertyValue(FM_PROP_BOUNDFIELD); - Reference< XPropertySet > xField = *(Reference< XPropertySet > *)aVal.getValue(); + Reference< XPropertySet > xField; + xSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField; if (xField.is()) { if (bLocked) @@ -1586,6 +1613,7 @@ void FmXFormController::setControlLock(const Reference< ::com::sun::star::awt::X //------------------------------------------------------------------------------ void FmXFormController::setLocks() { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); // alle Controls, die mit einer Datenquelle verbunden sind locken/unlocken sal_Int32 nLength = m_aControls.getLength(); const Reference< ::com::sun::star::awt::XControl > * pControls = m_aControls.getConstArray(); @@ -1596,6 +1624,7 @@ void FmXFormController::setLocks() //------------------------------------------------------------------------------ void FmXFormController::startControlListening(const Reference< ::com::sun::star::awt::XControl > & xControl) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); // jetzt anmelden bei gebundenen feldern sal_Bool bModifyListening = sal_False; Reference< ::com::sun::star::form::XBoundComponent > xBound(xControl, UNO_QUERY); @@ -1609,8 +1638,8 @@ void FmXFormController::startControlListening(const Reference< ::com::sun::star: Reference< XPropertySet > xSet(xBound, UNO_QUERY); if (xSet.is() && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xSet)) { - Any aVal = xSet->getPropertyValue(FM_PROP_BOUNDFIELD); - Reference< XPropertySet > xField = *(Reference< XPropertySet > *)aVal.getValue(); + Reference< XPropertySet > xField; + xSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField; bModifyListening = (xField.is()); } } @@ -1660,6 +1689,7 @@ void FmXFormController::startControlListening(const Reference< ::com::sun::star: //------------------------------------------------------------------------------ void FmXFormController::stopControlListening(const Reference< ::com::sun::star::awt::XControl > & xControl) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); // Reference< ::com::sun::star::data::XDatabaseCursor > xCursor(getModel(), UNO_QUERY); sal_Bool bModifyListening = sal_False; @@ -1673,8 +1703,8 @@ void FmXFormController::stopControlListening(const Reference< ::com::sun::star:: Reference< XPropertySet > xSet(xBound, UNO_QUERY); if (xSet.is() && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xSet)) { - Any aVal = xSet->getPropertyValue(FM_PROP_BOUNDFIELD); - Reference< XPropertySet > xField = *(Reference< XPropertySet > *)aVal.getValue(); + Reference< XPropertySet > xField; + xSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField; bModifyListening = (xField.is()); } } @@ -1723,6 +1753,7 @@ void FmXFormController::stopControlListening(const Reference< ::com::sun::star:: //------------------------------------------------------------------------------ void FmXFormController::startListening() { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_bModified = sal_False; // jetzt anmelden bei gebundenen feldern @@ -1735,6 +1766,7 @@ void FmXFormController::startListening() //------------------------------------------------------------------------------ void FmXFormController::stopListening() { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_bModified = sal_False; // jetzt anmelden bei gebundenen feldern @@ -1747,6 +1779,7 @@ void FmXFormController::stopListening() //------------------------------------------------------------------------------ Reference< ::com::sun::star::awt::XControl > FmXFormController::findControl(Sequence< Reference< ::com::sun::star::awt::XControl > >& rCtrls, const Reference< ::com::sun::star::awt::XControlModel > & xCtrlModel ) const { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); DBG_ASSERT( xCtrlModel.is(), "findControl - welches ?!" ); const Reference< ::com::sun::star::awt::XControl > * pCtrls = rCtrls.getConstArray(); @@ -1772,6 +1805,7 @@ Reference< ::com::sun::star::awt::XControl > FmXFormController::findControl(Seq //------------------------------------------------------------------------------ void FmXFormController::insertControl(const Reference< ::com::sun::star::awt::XControl > & xControl) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_bControlsSorted = sal_False; m_aControls.realloc(m_aControls.getLength() + 1); m_aControls.getArray()[m_aControls.getLength() - 1] = xControl; @@ -1808,6 +1842,7 @@ void FmXFormController::insertControl(const Reference< ::com::sun::star::awt::XC //------------------------------------------------------------------------------ void FmXFormController::removeControl(const Reference< ::com::sun::star::awt::XControl > & xControl) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); const Reference< ::com::sun::star::awt::XControl > * pCtrls = m_aControls.getArray(); sal_Int32 nCount = m_aControls.getLength(); for ( sal_uInt32 i = 0; i < nCount; i++ ) @@ -1853,6 +1888,7 @@ void FmXFormController::removeControl(const Reference< ::com::sun::star::awt::XC //------------------------------------------------------------------------------ IMPL_LINK(FmXFormController, OnUpdateDispatchers, void*, EMPTYARG) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_nUpdateDispatcherEvent = 0; DBG_ASSERT(m_aControlDispatchInterceptors.size(), "FmXFormController::OnUpdateDispatchers : not intercepting any control dispatches !"); @@ -1889,6 +1925,7 @@ IMPL_LINK(FmXFormController, OnUpdateDispatchers, void*, EMPTYARG) //------------------------------------------------------------------------------ void FmXFormController::loaded(const ::com::sun::star::lang::EventObject& rEvent) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); ::osl::MutexGuard aGuard( m_aMutex ); Reference< ::com::sun::star::sdbc::XRowSet > xForm(rEvent.Source, UNO_QUERY); // do we have a connected data source @@ -1947,6 +1984,7 @@ void FmXFormController::loaded(const ::com::sun::star::lang::EventObject& rEvent //------------------------------------------------------------------------------ IMPL_LINK(FmXFormController, OnLoad, void*, EMPTYARG) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_nLoadEvent = 0; m_bLocked = determineLockState(); @@ -1965,12 +2003,14 @@ IMPL_LINK(FmXFormController, OnLoad, void*, EMPTYARG) //------------------------------------------------------------------------------ void FmXFormController::unloaded(const ::com::sun::star::lang::EventObject& rEvent) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); // not interested in ... } //------------------------------------------------------------------------------ void FmXFormController::reloading(const ::com::sun::star::lang::EventObject& aEvent) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); // do the same like in unloading // just one exception toggle the auto values if (m_nToggleEvent) @@ -1984,18 +2024,21 @@ void FmXFormController::reloading(const ::com::sun::star::lang::EventObject& aEv //------------------------------------------------------------------------------ void FmXFormController::reloaded(const ::com::sun::star::lang::EventObject& aEvent) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); loaded(aEvent); } //------------------------------------------------------------------------------ void FmXFormController::unloading(const ::com::sun::star::lang::EventObject& aEvent) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); unload(); } //------------------------------------------------------------------------------ void FmXFormController::unload() throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); ::osl::MutexGuard aGuard( m_aMutex ); if (m_nLoadEvent) { @@ -2033,6 +2076,7 @@ void FmXFormController::unload() throw( RuntimeException ) //------------------------------------------------------------------------------ void FmXFormController::cursorMoved(const ::com::sun::star::lang::EventObject& event) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); // toggle the locking ? if (m_bLocked != determineLockState()) { @@ -2062,7 +2106,9 @@ void FmXFormController::rowSetChanged(const ::com::sun::star::lang::EventObject& //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::elementInserted(const ::com::sun::star::container::ContainerEvent& evt) { - Reference< ::com::sun::star::awt::XControl > xControl(*(Reference< ::com::sun::star::awt::XControl > *)evt.Element.getValue()); + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); + Reference< ::com::sun::star::awt::XControl > xControl; + evt.Element >>= xControl; if (!xControl.is()) return; @@ -2087,8 +2133,8 @@ void SAL_CALL FmXFormController::elementInserted(const ::com::sun::star::contain if (xSet.is() && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xSet)) { // does the model use a bound field ? - Any aVal = xSet->getPropertyValue(FM_PROP_BOUNDFIELD); - Reference< XPropertySet > xField = *(Reference< XPropertySet > *)aVal.getValue(); + Reference< XPropertySet > xField; + xSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField; Reference< ::com::sun::star::awt::XTextComponent > xText(xControl, UNO_QUERY); // may we filter the field? @@ -2106,10 +2152,12 @@ void SAL_CALL FmXFormController::elementInserted(const ::com::sun::star::contain //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::elementReplaced(const ::com::sun::star::container::ContainerEvent& evt) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); ::osl::MutexGuard aGuard( m_aMutex ); // Remove the control - Reference< ::com::sun::star::awt::XControl > xReplControl(*(Reference< ::com::sun::star::awt::XControl > *)evt.ReplacedElement.getValue(), UNO_QUERY); + Reference< ::com::sun::star::awt::XControl > xReplControl; + evt.ReplacedElement >>= xReplControl; Reference< ::com::sun::star::form::XFormComponent > xModel(xReplControl->getModel(), UNO_QUERY); if (xModel.is() && m_xModelAsIndex == xModel->getParent()) removeControl(xReplControl); @@ -2128,9 +2176,11 @@ void SAL_CALL FmXFormController::elementReplaced(const ::com::sun::star::contain //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::elementRemoved(const ::com::sun::star::container::ContainerEvent& evt) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); ::osl::MutexGuard aGuard( m_aMutex ); - Reference< ::com::sun::star::awt::XControl > xControl(*(Reference< ::com::sun::star::awt::XControl > *)evt.Element.getValue()); + Reference< ::com::sun::star::awt::XControl > xControl; + evt.Element >>= xControl; if (!xControl.is()) return; @@ -2152,6 +2202,7 @@ void SAL_CALL FmXFormController::elementRemoved(const ::com::sun::star::containe //------------------------------------------------------------------------------ Reference< ::com::sun::star::awt::XControl > FmXFormController::isInList(const Reference< ::com::sun::star::awt::XWindowPeer > & xPeer) const { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); const Reference< ::com::sun::star::awt::XControl > * pCtrls = m_aControls.getConstArray(); sal_uInt32 nCtrls = m_aControls.getLength(); @@ -2170,6 +2221,7 @@ Reference< ::com::sun::star::awt::XControl > FmXFormController::isInList(const //------------------------------------------------------------------------------ void FmXFormController::activateFirst() { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); ::osl::MutexGuard aGuard( m_aMutex ); DBG_ASSERT(m_xTabController.is(), "FmXFormController::activateFirst : invalid aggregate !"); if (m_xTabController.is()) @@ -2179,6 +2231,7 @@ void FmXFormController::activateFirst() //------------------------------------------------------------------------------ void FmXFormController::activateLast() { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); ::osl::MutexGuard aGuard( m_aMutex ); DBG_ASSERT(m_xTabController.is(), "FmXFormController::activateLast : invalid aggregate !"); if (m_xTabController.is()) @@ -2189,17 +2242,20 @@ void FmXFormController::activateLast() //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::addActivateListener(const Reference< ::com::sun::star::form::XFormControllerListener > & l) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_aActivateListeners.addInterface(l); } //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::removeActivateListener(const Reference< ::com::sun::star::form::XFormControllerListener > & l) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_aActivateListeners.removeInterface(l); } //------------------------------------------------------------------------------ void FmXFormController::setFilter(vector<FmFieldInfo>& rFieldInfos) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); // create the composer Reference< ::com::sun::star::sdbc::XRowSet > xForm(m_xModelAsIndex, UNO_QUERY); Reference< ::com::sun::star::sdbc::XConnection > xConnection(::dbtools::getConnection(xForm)); @@ -2219,6 +2275,7 @@ void FmXFormController::setFilter(vector<FmFieldInfo>& rFieldInfos) } catch(...) { + DBG_ERROR("Exception occured!"); } } } @@ -2351,6 +2408,7 @@ void FmXFormController::setFilter(vector<FmFieldInfo>& rFieldInfos) //------------------------------------------------------------------------------ void FmXFormController::startFiltering() { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); if (!m_pView) { DBG_ERROR("FmXFormController::startFiltering : you can't filter if you created me as service !"); @@ -2410,17 +2468,18 @@ void FmXFormController::startFiltering() if (xElementAccess.is()) { Reference< ::com::sun::star::container::XEnumeration > xEnumeration(xElementAccess->createEnumeration()); + Reference< ::com::sun::star::awt::XControl > xControl; while (xEnumeration->hasMoreElements()) { - Reference< ::com::sun::star::awt::XControl > xControl(*(Reference< XInterface > *)xEnumeration->nextElement().getValue(),UNO_QUERY); + xEnumeration->nextElement() >>= xControl; if (xControl.is()) { Reference< XPropertySet > xSet(xControl->getModel(), UNO_QUERY); if (xSet.is() && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xSet)) { // does the model use a bound field ? - Any aVal = xSet->getPropertyValue(FM_PROP_BOUNDFIELD); - Reference< XPropertySet > xField = *(Reference< XPropertySet > *)aVal.getValue(); + Reference< XPropertySet > xField; + xSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField; Reference< ::com::sun::star::awt::XTextComponent > xText(xControl, UNO_QUERY); // may we filter the field? @@ -2442,7 +2501,8 @@ void FmXFormController::startFiltering() { // does the model use a bound field ? Any aVal = xSet->getPropertyValue(FM_PROP_BOUNDFIELD); - Reference< XPropertySet > xField = *(Reference< XPropertySet > *)aVal.getValue(); + Reference< XPropertySet > xField; + aVal >>= xField; // may we filter the field? @@ -2519,6 +2579,7 @@ void FmXFormController::startFiltering() //------------------------------------------------------------------------------ void FmXFormController::stopFiltering() { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); if (!m_pView) { DBG_ERROR("FmXFormController::startFiltering : you can't filter if you created me as service !"); @@ -2572,8 +2633,8 @@ void FmXFormController::stopFiltering() if (xSet.is() && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xSet)) { // does the model use a bound field ? - Any aVal = xSet->getPropertyValue(FM_PROP_BOUNDFIELD); - Reference< XPropertySet > xField = *(Reference< XPropertySet > *)aVal.getValue(); + Reference< XPropertySet > xField; + xSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField; // may we filter the field? if (xField.is() && ::comphelper::hasProperty(FM_PROP_SEARCHABLE, xField) && @@ -2638,6 +2699,7 @@ void FmXFormController::stopFiltering() //------------------------------------------------------------------------------ void FmXFormController::setMode(const ::rtl::OUString& Mode) throw( ::com::sun::star::lang::NoSupportException, RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); if (!supportsMode(Mode)) throw ::com::sun::star::lang::NoSupportException(); @@ -2661,12 +2723,14 @@ void FmXFormController::setMode(const ::rtl::OUString& Mode) throw( ::com::sun:: //------------------------------------------------------------------------------ ::rtl::OUString SAL_CALL FmXFormController::getMode(void) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); return m_aMode; } //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > SAL_CALL FmXFormController::getSupportedModes(void) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); static Sequence< ::rtl::OUString > aModes; if (!aModes.getLength()) { @@ -2681,6 +2745,7 @@ Sequence< ::rtl::OUString > SAL_CALL FmXFormController::getSupportedModes(void) //------------------------------------------------------------------------------ sal_Bool SAL_CALL FmXFormController::supportsMode(const ::rtl::OUString& Mode) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); Sequence< ::rtl::OUString > aModes(getSupportedModes()); const ::rtl::OUString* pModes = aModes.getConstArray(); for (sal_Int32 i = aModes.getLength(); i > 0; ) @@ -2694,6 +2759,7 @@ sal_Bool SAL_CALL FmXFormController::supportsMode(const ::rtl::OUString& Mode) t //------------------------------------------------------------------------------ Window* FmXFormController::getDialogParentWindow() { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); Window* pParent = m_pWindow; if (!pParent) { @@ -2713,6 +2779,7 @@ Window* FmXFormController::getDialogParentWindow() //------------------------------------------------------------------------------ sal_Bool SAL_CALL FmXFormController::approveRowChange(const ::com::sun::star::sdb::RowChangeEvent& aEvent) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); ::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners); sal_Bool bValid = sal_True; if (aIter.hasMoreElements()) @@ -2748,9 +2815,10 @@ sal_Bool SAL_CALL FmXFormController::approveRowChange(const ::com::sun::star::sd } Reference< ::com::sun::star::container::XEnumeration > xEnumeration = xEnumAccess->createEnumeration(); + Reference< XPropertySet > xFieldSet; while (xEnumeration->hasMoreElements()) { - Reference< XPropertySet > xFieldSet(*(Reference< XPropertySet > *)xEnumeration->nextElement().getValue()); + xEnumeration->nextElement() >>= xFieldSet; Reference< ::com::sun::star::sdb::XColumn > xColumn(xFieldSet, UNO_QUERY); if (!xFieldSet.is() || !xColumn.is()) { @@ -2815,6 +2883,7 @@ sal_Bool SAL_CALL FmXFormController::approveRowChange(const ::com::sun::star::sd //------------------------------------------------------------------------------ sal_Bool SAL_CALL FmXFormController::approveCursorMove(const ::com::sun::star::lang::EventObject& event) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); ::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners); if (aIter.hasMoreElements()) { @@ -2829,6 +2898,7 @@ sal_Bool SAL_CALL FmXFormController::approveCursorMove(const ::com::sun::star::l //------------------------------------------------------------------------------ sal_Bool SAL_CALL FmXFormController::approveRowSetChange(const ::com::sun::star::lang::EventObject& event) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); ::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners); if (aIter.hasMoreElements()) { @@ -2844,12 +2914,14 @@ sal_Bool SAL_CALL FmXFormController::approveRowSetChange(const ::com::sun::star: //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::addRowSetApproveListener(const Reference< ::com::sun::star::sdb::XRowSetApproveListener > & _rxListener) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_aRowSetApproveListeners.addInterface(_rxListener); } //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::removeRowSetApproveListener(const Reference< ::com::sun::star::sdb::XRowSetApproveListener > & _rxListener) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_aRowSetApproveListeners.removeInterface(_rxListener); } @@ -2857,6 +2929,7 @@ void SAL_CALL FmXFormController::removeRowSetApproveListener(const Reference< :: //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::errorOccured(const ::com::sun::star::sdb::SQLErrorEvent& aEvent) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); if (m_pView) { // we're working for a FormView if (!(m_pWindow || (m_pView->GetActualOutDev() == (const OutputDevice*)m_pWindow || @@ -2882,12 +2955,14 @@ void SAL_CALL FmXFormController::errorOccured(const ::com::sun::star::sdb::SQLEr //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::addSQLErrorListener(const Reference< ::com::sun::star::sdb::XSQLErrorListener > & aListener) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_aErrorListeners.addInterface(aListener); } //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::removeSQLErrorListener(const Reference< ::com::sun::star::sdb::XSQLErrorListener > & aListener) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_aErrorListeners.removeInterface(aListener); } @@ -2895,12 +2970,14 @@ void SAL_CALL FmXFormController::removeSQLErrorListener(const Reference< ::com:: //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::addParameterListener(const Reference< ::com::sun::star::form::XDatabaseParameterListener > & aListener) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_aParameterListeners.addInterface(aListener); } //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::removeParameterListener(const Reference< ::com::sun::star::form::XDatabaseParameterListener > & aListener) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_aParameterListeners.removeInterface(aListener); } @@ -2908,6 +2985,7 @@ void SAL_CALL FmXFormController::removeParameterListener(const Reference< ::com: //------------------------------------------------------------------------------ sal_Bool SAL_CALL FmXFormController::approveParameter(const ::com::sun::star::form::DatabaseParameterEvent& aEvent) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); if (m_pView) { // we're working for a FormView if (!(m_pWindow || (m_pView->GetActualOutDev() == (const OutputDevice*)m_pWindow || @@ -2992,12 +3070,14 @@ sal_Bool SAL_CALL FmXFormController::approveParameter(const ::com::sun::star::fo //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::addConfirmDeleteListener(const Reference< ::com::sun::star::form::XConfirmDeleteListener > & aListener) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_aDeleteListeners.addInterface(aListener); } //------------------------------------------------------------------------------ void SAL_CALL FmXFormController::removeConfirmDeleteListener(const Reference< ::com::sun::star::form::XConfirmDeleteListener > & aListener) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); m_aDeleteListeners.removeInterface(aListener); } @@ -3005,6 +3085,7 @@ void SAL_CALL FmXFormController::removeConfirmDeleteListener(const Reference< :: //------------------------------------------------------------------------------ sal_Bool SAL_CALL FmXFormController::confirmDelete(const ::com::sun::star::sdb::RowChangeEvent& aEvent) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); if (m_pView) { // we're working for a FormView if (!(m_pWindow || (m_pView->GetActualOutDev() == (const OutputDevice*)m_pWindow || @@ -3044,6 +3125,7 @@ FmXFormController::interceptedQueryDispatch(sal_uInt16 _nId, const ::com::sun::s const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw( RuntimeException ) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); Reference< ::com::sun::star::frame::XDispatch > xReturn; // dispatches handled by ourself if (aURL.Complete == FMURL_CONFIRM_DELETION) @@ -3137,6 +3219,7 @@ FmXFormController::interceptedQueryDispatch(sal_uInt16 _nId, const ::com::sun::s //------------------------------------------------------------------------------ Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > FmXFormController::createInterceptor(const Reference< ::com::sun::star::frame::XDispatchProviderInterception > & _xInterception) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); #if DBG_UTIL // check if we already have a interceptor for the given object for ( ConstInterceptorsIterator aIter = m_aControlDispatchInterceptors.begin(); @@ -3159,6 +3242,7 @@ Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > FmXFormContr //------------------------------------------------------------------------------ void FmXFormController::deleteInterceptor(const Reference< ::com::sun::star::frame::XDispatchProviderInterception > & _xInterception) { + OSL_ENSHURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!"); // search the interceptor responsible for the given object InterceptorsIterator aIter; for ( aIter = m_aControlDispatchInterceptors.begin(); diff --git a/svx/source/form/fmexpl.cxx b/svx/source/form/fmexpl.cxx index 75b7fb31a230..17fd08597753 100644 --- a/svx/source/form/fmexpl.cxx +++ b/svx/source/form/fmexpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fmexpl.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2000-11-06 07:07:42 $ + * last change: $Author: oj $ $Date: 2000-11-07 13:16:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -750,7 +750,9 @@ void SAL_CALL FmXExplPropertyChangeList::elementInserted(const ::com::sun::star: // keine Undoaction einfuegen m_bCanUndo = sal_False; - Insert(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)evt.Element.getValue(), ::comphelper::getINT32(evt.Accessor)); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xTemp; + evt.Element >>= xTemp; + Insert(xTemp, ::comphelper::getINT32(evt.Accessor)); m_bCanUndo = sal_True; } @@ -763,8 +765,12 @@ void FmXExplPropertyChangeList::Insert(const ::com::sun::star::uno::Reference< : { m_pExplModel->InsertForm(xForm, sal_uInt32(nIndex)); ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > xContainer(xForm, ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xTemp; for (sal_Int32 i = 0; i < xContainer->getCount(); i++) - Insert(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)xContainer->getByIndex(i).getValue(), i); + { + xContainer->getByIndex(i) >>= xTemp; + Insert(xTemp, i); + } } else { @@ -783,13 +789,15 @@ void SAL_CALL FmXExplPropertyChangeList::elementReplaced(const ::com::sun::star: m_bCanUndo = sal_False; // EntryData loeschen - ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > xReplaced(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)evt.ReplacedElement.getValue(), ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > xReplaced; + evt.ReplacedElement >>= xReplaced; FmEntryData* pEntryData = m_pExplModel->FindData(xReplaced, m_pExplModel->GetRootList(), sal_True); if (pEntryData) { if (pEntryData->ISA(FmControlData)) { - ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > xComp(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)evt.Element.getValue(), ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > xComp; + evt.Element >>= xComp; DBG_ASSERT(xComp.is(), "FmXExplPropertyChangeList::elementReplaced : invalid argument !"); // an einer FmControlData sollte eine ::com::sun::star::form::XFormComponent haengen m_pExplModel->ReplaceFormComponent(xReplaced, xComp); @@ -813,7 +821,9 @@ void SAL_CALL FmXExplPropertyChangeList::elementRemoved(const ::com::sun::star:: ////////////////////////////////////////////////////////// // EntryData loeschen - FmEntryData* pEntryData = m_pExplModel->FindData(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)evt.Element.getValue(), m_pExplModel->GetRootList(), sal_True); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xTemp; + evt.Element >>= xTemp; + FmEntryData* pEntryData = m_pExplModel->FindData(xTemp, m_pExplModel->GetRootList(), sal_True); if (pEntryData) m_pExplModel->Remove(pEntryData); @@ -1153,7 +1163,7 @@ void FmExplorerModel::FillBranch( FmFormData* pFormData ) ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>*)0), "FmExplorerModel::FillBranch : the root container should supply only elements of type XForm"); - xSubForm = *(::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > *)xForms->getByIndex(i).getValue(); + xForms->getByIndex(i) >>= xSubForm; pSubFormData = new FmFormData( xSubForm, m_ilNavigatorImages, pFormData ); Insert( pSubFormData, LIST_APPEND ); @@ -1176,9 +1186,10 @@ void FmExplorerModel::FillBranch( FmFormData* pFormData ) FmControlData* pNewControlData; FmFormData* pSubFormData; + ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > xCurrentComponent; for (sal_Int32 j=0; j<xComponents->getCount(); ++j) { - ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > xCurrentComponent(*(::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > *)xComponents->getByIndex(j).getValue()); + xComponents->getByIndex(j) >>= xCurrentComponent; ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xSubForm(xCurrentComponent, ::com::sun::star::uno::UNO_QUERY); if (xSubForm.is()) diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index d03959bcce05..876d3a6f5351 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fmobj.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: fs $ $Date: 2000-10-20 14:18:56 $ + * last change: $Author: oj $ $Date: 2000-11-07 13:16:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -207,7 +207,8 @@ void FmFormObj::SetPage(SdrPage* _pNewPage) { if (xLoop->getCount() == 0) break; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > xRightMostChild(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)xLoop->getByIndex(xLoop->getCount() - 1).getValue(), ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > xRightMostChild; + xLoop->getByIndex(xLoop->getCount() - 1) >>= xRightMostChild; if (!xRightMostChild.is()) { DBG_ERROR("FmFormObj::SetPage : invalid elements in environment history !"); @@ -493,7 +494,8 @@ void FmFormObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) // get the DSS of the source form (we have to find an aquivalent for) DBG_ASSERT(nIndex<xSourceContainer->getCount(), "FmFormObj::ensureModelEnv : invalid access path !"); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSourceForm = ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > (*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)xSourceContainer->getByIndex(nIndex).getValue(), ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSourceForm; + xSourceContainer->getByIndex(nIndex) >>= xSourceForm; DBG_ASSERT(xSourceForm.is(), "FmFormObj::ensureModelEnv : invalid source form !"); ::com::sun::star::uno::Any aSrcCursorSource, aSrcCursorSourceType, aSrcDataSource; @@ -502,9 +504,9 @@ void FmFormObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) // the parent access path should refer to a row set try { - aSrcCursorSource = xSourceForm->getPropertyValue(FM_PROP_COMMAND); - aSrcCursorSourceType = xSourceForm->getPropertyValue(FM_PROP_COMMANDTYPE); - aSrcDataSource = xSourceForm->getPropertyValue(FM_PROP_DATASOURCE); + aSrcCursorSource = xSourceForm->getPropertyValue(FM_PROP_COMMAND); + aSrcCursorSourceType = xSourceForm->getPropertyValue(FM_PROP_COMMANDTYPE); + aSrcDataSource = xSourceForm->getPropertyValue(FM_PROP_DATASOURCE); } catch(...) { @@ -520,7 +522,7 @@ void FmFormObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) sal_Bool bEqualDSS = sal_False; while (!bEqualDSS) // (we don't have to check nCurrentSourceIndex here : it's bounded by nIndex) { - xCurrentSourceForm = ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > (*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)xSourceContainer->getByIndex(nCurrentSourceIndex).getValue(), ::com::sun::star::uno::UNO_QUERY); + xSourceContainer->getByIndex(nCurrentSourceIndex) >>= xCurrentSourceForm; DBG_ASSERT(xCurrentSourceForm.is(), "FmFormObj::ensureModelEnv : invalid form ancestor (2) !"); bEqualDSS = sal_False; if (::comphelper::hasProperty(FM_PROP_DATASOURCE, xCurrentSourceForm)) @@ -551,7 +553,7 @@ void FmFormObj::ReadData(const SdrObjIOHeader& rHead, SvStream& rIn) bEqualDSS = sal_False; while (!bEqualDSS && (nCurrentDestIndex < xDestContainer->getCount())) { - xCurrentDestForm = ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > (*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)xDestContainer->getByIndex(nCurrentDestIndex).getValue(), ::com::sun::star::uno::UNO_QUERY); + xDestContainer->getByIndex(nCurrentDestIndex) >>= xCurrentDestForm; DBG_ASSERT(xCurrentDestForm.is(), "FmFormObj::ensureModelEnv : invalid destination form !"); bEqualDSS = sal_False; if (::comphelper::hasProperty(FM_PROP_DATASOURCE, xCurrentDestForm)) diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx index f8a6f3e05004..6b43a5a3448b 100644 --- a/svx/source/form/fmpgeimp.cxx +++ b/svx/source/form/fmpgeimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fmpgeimp.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: fs $ $Date: 2000-10-20 14:18:56 $ + * last change: $Author: oj $ $Date: 2000-11-07 13:16:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -162,12 +162,12 @@ #include <connectivity/dbtools.hxx> #endif -#define ANY_TO_IFACE(any) (*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)any.getValue()) - +DBG_NAME(FmFormPageImpl); //------------------------------------------------------------------------------ FmFormPageImpl::FmFormPageImpl(FmFormPage* _pPage) :pPage(_pPage) { + DBG_CTOR(FmFormPageImpl,NULL); Init(); } @@ -175,6 +175,7 @@ FmFormPageImpl::FmFormPageImpl(FmFormPage* _pPage) FmFormPageImpl::FmFormPageImpl(FmFormPage* _pPage, const FmFormPageImpl& rImpl) :pPage(_pPage) { + DBG_CTOR(FmFormPageImpl,NULL); Init(); // copy it by streaming @@ -246,6 +247,7 @@ FmFormPageImpl::~FmFormPageImpl() xCurrentForm = NULL; ::comphelper::disposeComponent(xForms); + DBG_DTOR(FmFormPageImpl,NULL); } //------------------------------------------------------------------------------ @@ -271,10 +273,15 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st { try { - xForm = *(::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > *)xForms->getByName(ustrStdFormName).getValue(); + xForms->getByName(ustrStdFormName) >>= xForm; + } + catch(::com::sun::star::container::NoSuchElementException &) + { + DBG_ERROR("NoSuchElementException occured!"); } - catch(...) + catch(::com::sun::star::lang::WrappedTargetException &) { + DBG_ERROR("WrappedTargetException occured!"); } } @@ -286,7 +293,7 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st DBG_ASSERT(xGetFirst.is(), "FmFormPageImpl::getDefaultForm : no IndexAccess on my form container !"); // wenn das anspringt, muesste man sich die Namen des NameContainers geben lassen und dann das Objekt fuer den // ersten Namen erfragen ... aber normalerweise sollte die FOrms-Sammlung auch einen IndexAccess haben - xForm = *(::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > *)xGetFirst->getByIndex(0).getValue(); + xGetFirst->getByIndex(0) >>= xForm; } } } @@ -358,7 +365,8 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st sal_Int32 nCount = xFormsByIndex->getCount(); for (sal_Int32 i = 0; !xForm.is() && i < nCount; i++) { - ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xToSearch(*(::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > *)xFormsByIndex->getByIndex(i).getValue()); + ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xToSearch; + xFormsByIndex->getByIndex(i) >>= xToSearch; xForm = FindForm(xToSearch, rDatabase, rCursorSource, nCommandType); } @@ -467,7 +475,8 @@ void FmFormPageImpl::setCurForm(::com::sun::star::uno::Reference< ::com::sun::st sal_Int32 nCount = xComponents->getCount(); for (sal_Int32 i = 0; !xResultForm.is() && i < nCount; ++i) { - ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xSearchForm(ANY_TO_IFACE(xComponents->getByIndex(i)), ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xSearchForm; + xComponents->getByIndex(i) >>= xSearchForm; // jetzt innerhalb der ::com::sun::star::form weitersuchen if (xSearchForm.is()) xResultForm = FindForm(xSearchForm, rDatabase, rCursorSource, nCommandType); diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index 62cba29de98b..b23ed48fd852 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fmshell.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: fs $ $Date: 2000-11-06 11:25:47 $ + * last change: $Author: oj $ $Date: 2000-11-07 13:16:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1841,7 +1841,7 @@ void FmFormShell::GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich) if (bIsNew) nCount++; - aValue = String(sal_uInt32(nCount)); + aValue = String::CreateFromInt32(sal_uInt32(nCount)); } rSet.Put(SfxStringItem(nWhich, aValue)); } break; diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index cb8e88b67ae4..ac8253b23837 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fmshimp.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2000-11-06 14:09:32 $ + * last change: $Author: oj $ $Date: 2000-11-07 13:16:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -464,11 +464,7 @@ sal_Bool FmXBoundFormFieldIterator::ShouldHandleElement(const ::com::sun::star:: // void or invalid property value return sal_False; - if (!((::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)aVal.getValue())->is()) - // empty ref - return sal_False; - - return sal_True; + return aVal.hasValue(); } //============================================================================== @@ -563,6 +559,7 @@ sal_Bool isControlList(const SdrMarkList& rMarkList) //------------------------------------------------------------------------ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> FmXFormShell::DetermineCurForm(const SdrMarkList& rMarkList, sal_Bool& bMixedWithFormControls) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); // gibt es eine aktuelle Form, wird ermittelt aus den selektierten Objekten ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xReferenceForm; bMixedWithFormControls = sal_False; @@ -632,6 +629,7 @@ sal_Bool isControlList(const SdrMarkList& rMarkList) //======================================================================== // class FmXFormShell //======================================================================== +DBG_NAME(FmXFormShell); //------------------------------------------------------------------------ FmXFormShell::FmXFormShell( FmFormShell* _pShell, SfxViewFrame* _pViewFrame ) :FmXFormShell_BASE(m_aMutex) @@ -651,6 +649,7 @@ FmXFormShell::FmXFormShell( FmFormShell* _pShell, SfxViewFrame* _pViewFrame ) ,m_pExternalViewInterceptor(NULL) ,m_bChangingDesignMode(sal_False) { + DBG_CTOR(FmXFormShell,NULL); m_aMarkTimer.SetTimeout(100); m_aMarkTimer.SetTimeoutHdl(LINK(this,FmXFormShell,OnTimeOut)); @@ -663,11 +662,7 @@ FmXFormShell::FmXFormShell( FmFormShell* _pShell, SfxViewFrame* _pViewFrame ) SfxFrame* pFrame = _pViewFrame ? _pViewFrame->GetFrame() : NULL; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame> xUnoFrame; if( pFrame) -#if SUPD > 582 xUnoFrame = pFrame->GetFrameInterface(); -#else - convertIFace((XFrame*)pFrame->GetFrameInterface(),xUnoFrame); -#endif else xUnoFrame = ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>(NULL); @@ -688,24 +683,7 @@ FmXFormShell::FmXFormShell( FmFormShell* _pShell, SfxViewFrame* _pViewFrame ) //------------------------------------------------------------------------ FmXFormShell::~FmXFormShell() { - if (!rBHelper.bDisposed) - dispose(); - - ::osl::ClearableMutexGuard aGuard(m_aAsyncSafety); - if (HasAnyPendingCursorAction()) - CancelAnyPendingCursorAction(); - aGuard.clear(); - - if (m_pCheckForRemoval) - { - delete m_pCheckForRemoval; - m_pCheckForRemoval = NULL; - } - - DBG_ASSERT(!m_nInvalidationEvent, "FmXFormShell::~FmXFormShell : still have an invalidation event !"); - // should habe been deleted while beeing disposed - - m_aMarkTimer.Stop(); + DBG_DTOR(FmXFormShell,NULL); } //------------------------------------------------------------------ @@ -759,6 +737,7 @@ void SAL_CALL FmXFormShell::disposing(const ::com::sun::star::lang::EventObject& //------------------------------------------------------------------------------ void SAL_CALL FmXFormShell::propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); if (evt.PropertyName == FM_PROP_ISMODIFIED) { if (!::comphelper::getBOOL(evt.NewValue)) @@ -811,6 +790,7 @@ void SAL_CALL FmXFormShell::propertyChange(const ::com::sun::star::beans::Proper } catch(...) { + DBG_ERROR("FmXFormShell::propertyChange: Exception occured!"); } } @@ -825,6 +805,7 @@ void SAL_CALL FmXFormShell::propertyChange(const ::com::sun::star::beans::Proper //------------------------------------------------------------------------------ void SAL_CALL FmXFormShell::modified(const ::com::sun::star::lang::EventObject& rEvent) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); if (!m_bActiveModified) { m_bActiveModified = sal_True; @@ -836,6 +817,7 @@ void SAL_CALL FmXFormShell::modified(const ::com::sun::star::lang::EventObject& //------------------------------------------------------------------------------ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch> FmXFormShell::interceptedQueryDispatch(sal_uInt16 _nId, const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw( ::com::sun::star::uno::RuntimeException ) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::osl::MutexGuard aGuard(m_aAsyncSafety); if (!m_pShell) @@ -913,7 +895,8 @@ void SAL_CALL FmXFormShell::modified(const ::com::sun::star::lang::EventObject& ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xFormProps(xAffectedForm, ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::form::NavigationBarMode eMode = *(::com::sun::star::form::NavigationBarMode*)xFormProps->getPropertyValue(FM_PROP_NAVIGATION).getValue(); + ::com::sun::star::form::NavigationBarMode eMode; + xFormProps->getPropertyValue(FM_PROP_NAVIGATION) >>= eMode; if (eMode != ::com::sun::star::form::NavigationBarMode_CURRENT) { // we can't supply a dispatcher for that : else we would have to listen to all operations on the parent // form and to all ops on the affected form itself, just to keep the state up-to-date. This would be too much to do ... @@ -969,6 +952,7 @@ void SAL_CALL FmXFormShell::modified(const ::com::sun::star::lang::EventObject& //------------------------------------------------------------------------------ void SAL_CALL FmXFormShell::formActivated(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException ) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); DBG_ASSERT(rEvent.Source == m_xExternalViewController, "FmXFormShell::formActivated : where did this come from ?"); setActiveController(::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>(rEvent.Source, ::com::sun::star::uno::UNO_QUERY)); } @@ -976,6 +960,7 @@ void SAL_CALL FmXFormShell::formActivated(const ::com::sun::star::lang::EventObj //------------------------------------------------------------------------------ void SAL_CALL FmXFormShell::formDeactivated(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException ) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); DBG_ASSERT(rEvent.Source == m_xExternalViewController, "FmXFormShell::formDeactivated : where did this come from ?"); } @@ -1033,6 +1018,24 @@ void FmXFormShell::disposing() } } + { + ::osl::ClearableMutexGuard aGuard(m_aAsyncSafety); + if (HasAnyPendingCursorAction()) + CancelAnyPendingCursorAction(); + aGuard.clear(); + + if (m_pCheckForRemoval) + { + delete m_pCheckForRemoval; + m_pCheckForRemoval = NULL; + } + + DBG_ASSERT(!m_nInvalidationEvent, "FmXFormShell::~FmXFormShell : still have an invalidation event !"); + // should habe been deleted while beeing disposed + + m_aMarkTimer.Stop(); + } + // we are disposed from within the destructor of our shell, so now the shell pointer is invalid .... m_pShell = NULL; m_xActiveController = NULL; @@ -1054,6 +1057,7 @@ void FmXFormShell::disposing() //------------------------------------------------------------------------------ void FmXFormShell::InvalidateSlot(sal_Int16 nId, sal_Bool bWithItem, sal_Bool bWithId) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::osl::MutexGuard aGuard(m_aInvalidationSafety); if (m_nLockSlotInvalidation) { @@ -1071,6 +1075,7 @@ void FmXFormShell::InvalidateSlot(sal_Int16 nId, sal_Bool bWithItem, sal_Bool bW //------------------------------------------------------------------------------ void FmXFormShell::LockSlotInvalidation(sal_Bool bLock) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::osl::MutexGuard aGuard(m_aInvalidationSafety); DBG_ASSERT(bLock || m_nLockSlotInvalidation>0, "FmXFormShell::LockSlotInvalidation : invalid call !"); @@ -1087,6 +1092,7 @@ void FmXFormShell::LockSlotInvalidation(sal_Bool bLock) //------------------------------------------------------------------------------ IMPL_LINK(FmXFormShell, OnInvalidateSlots, void*, EMPTYARG) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::osl::MutexGuard aGuard(m_aInvalidationSafety); m_nInvalidationEvent = 0; @@ -1111,6 +1117,7 @@ IMPL_LINK(FmXFormShell, OnInvalidateSlots, void*, EMPTYARG) //------------------------------------------------------------------------------ void FmXFormShell::ForceUpdateSelection(sal_Bool bAllowInvalidation) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); if (IsSelectionUpdatePending()) { m_aMarkTimer.Stop(); @@ -1153,6 +1160,7 @@ sal_Bool FmXFormShell::IsControlConversionSlot(sal_uInt16 nSlotId) //------------------------------------------------------------------------------ sal_Bool FmXFormShell::ExecuteControlConversionSlot(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent>& xContext, sal_uInt16 nSlotId) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); for (int i=0; i<sizeof(nConvertSlots)/sizeof(nConvertSlots[0]); ++i) { if (nConvertSlots[i] == nSlotId) @@ -1194,6 +1202,7 @@ void FmXFormShell::CheckControlConversionSlots(const ::com::sun::star::uno::Refe //------------------------------------------------------------------------------ sal_Bool FmXFormShell::ConvertControlTo(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent>& xModel, sal_uInt16 nTargetObjectId) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); if (!xModel.is()) // das wuerde ausser einem Performance-Verlust nix machen, aber trotzdem ... return sal_False; @@ -1354,11 +1363,13 @@ sal_Bool FmXFormShell::ConvertControlTo(const ::com::sun::star::uno::Reference< //------------------------------------------------------------------------------ void FmXFormShell::LoopGrids(sal_Int16 nWhat) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer> xControlModels(m_xActiveForm, ::com::sun::star::uno::UNO_QUERY); if (xControlModels.is()) for (sal_Int16 i=0; i<xControlModels->getCount(); ++i) { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xModelSet(*(::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>*)xControlModels->getByIndex(i).getValue(), ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xModelSet; + xControlModels->getByIndex(i) >>= xModelSet; if (!xModelSet.is()) continue; @@ -1457,6 +1468,7 @@ void FmXFormShell::LoopGrids(sal_Int16 nWhat) //------------------------------------------------------------------------------ void FmXFormShell::ExecuteSearch() { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); UniString sTestContexts; // m_arrSearchContexts.Remove(0, m_arrSearchContexts.Count()); m_arrSearchContexts.clear(); @@ -1531,7 +1543,8 @@ void FmXFormShell::ExecuteSearch() ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xProperties(xActiveControl->getModel(), ::com::sun::star::uno::UNO_QUERY); if (::comphelper::hasProperty(FM_PROP_CONTROLSOURCE, xProperties) && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xProperties)) { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xField( *(::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>*)(xProperties->getPropertyValue(FM_PROP_BOUNDFIELD).getValue())); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xField; + xProperties->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField; if (xField.is()) // (nur wenn das Ding wirklich gebunden ist) { // und das Control selber nach einem TextComponent-Interface (damit ich mir dort den Text abholen kann) @@ -1558,13 +1571,16 @@ void FmXFormShell::ExecuteSearch() sal_Int16 nViewCol = xGrid->getCurrentColumnPosition(); sal_Int16 nModelCol = GridView2ModelPos(xColumns, nViewCol); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xCurrentCol( xColumns.is() ? *(::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>*)xColumns->getByIndex(nModelCol).getValue() : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>(NULL)); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xCurrentCol; + if(xColumns.is()) + xColumns->getByIndex(nModelCol) >>= xCurrentCol; if (xCurrentCol.is()) strActiveField = ::comphelper::getString(xCurrentCol->getPropertyValue(FM_PROP_LABEL)).getStr(); // the text fo the current column ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> xColControls(xGridPeer, ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xCurControl(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)xColControls->getByIndex(nViewCol).getValue(), ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xCurControl; + xColControls->getByIndex(nViewCol) >>= xCurControl; ::rtl::OUString sInitialText; if (IsSearchableControl(xCurControl, &sInitialText)) strInitialText = sInitialText.getStr(); @@ -1598,6 +1614,7 @@ void FmXFormShell::ExecuteSearch() //------------------------------------------------------------------------------ sal_Bool FmXFormShell::GetY2KState(sal_uInt16& n) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); if (m_pShell->IsDesignMode()) // im Design-Modus (ohne aktive Controls) soll sich das Haupt-Dokument darum kuemmern return sal_False; @@ -1634,6 +1651,7 @@ sal_Bool FmXFormShell::GetY2KState(sal_uInt16& n) //------------------------------------------------------------------------------ void FmXFormShell::SetY2KState(sal_uInt16 n) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xActiveForm( getActiveForm()); ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet> xDB(xActiveForm, ::com::sun::star::uno::UNO_QUERY); if (xDB.is()) @@ -1652,6 +1670,7 @@ void FmXFormShell::SetY2KState(sal_uInt16 n) } catch(...) { + DBG_ERROR("FmXFormShell::SetY2KState: Exception occured!"); } } @@ -1692,6 +1711,7 @@ void FmXFormShell::SetY2KState(sal_uInt16 n) } catch(...) { + DBG_ERROR("FmXFormShell::SetY2KState: Exception occured!"); } } @@ -1791,14 +1811,16 @@ void FmXFormShell::ResetCurrent(const ::com::sun::star::uno::Reference< ::com::s //------------------------------------------------------------------------ void FmXFormShell::ResetAll(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& _xForm) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> xContainer(_xForm, ::com::sun::star::uno::UNO_QUERY); for (sal_Int16 nBothViews=0; nBothViews<2; ++nBothViews) { if (xContainer.is()) { + ::com::sun::star::uno::Reference< ::com::sun::star::form::XReset> xReset; for (sal_Int32 i=0; i<xContainer->getCount(); ++i) { - ::com::sun::star::uno::Reference< ::com::sun::star::form::XReset> xReset(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)xContainer->getByIndex(i).getValue(), ::com::sun::star::uno::UNO_QUERY); + xContainer->getByIndex(i) >>= xReset; if (xReset.is()) { ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xAsForm(xReset, ::com::sun::star::uno::UNO_QUERY); @@ -1845,6 +1867,7 @@ sal_Bool FmXFormShell::SaveModified(const ::com::sun::star::uno::Reference< ::co } catch(...) { + DBG_ERROR("FmXFormShell::SaveModified: Exception occured!"); } _rRecordInserted = bIsNew && bResult; @@ -1933,6 +1956,7 @@ sal_Bool FmXFormShell::MoveRight(const ::com::sun::star::uno::Reference< ::com:: } catch(...) { + DBG_ERROR("FmXFormShell::MoveRight: Exception occured!"); } } @@ -1982,6 +2006,7 @@ sal_Bool FmXFormShell::MoveLeft(const ::com::sun::star::uno::Reference< ::com::s } catch(...) { + DBG_ERROR("FmXFormShell::MoveLeft: Exception occured!"); } } @@ -2001,6 +2026,7 @@ sal_Bool FmXFormShell::MoveLeft(const ::com::sun::star::uno::Reference< ::com::s //------------------------------------------------------------------------------ void SAL_CALL FmXFormShell::cursorMoved(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException ) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); m_bActiveModified = sal_False; m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(DatabaseSlotMap); } @@ -2008,6 +2034,7 @@ void SAL_CALL FmXFormShell::cursorMoved(const ::com::sun::star::lang::EventObjec //------------------------------------------------------------------------------ void FmXFormShell::CloseExternalFormViewer() { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); if (!m_xExternalViewController.is()) return; @@ -2032,6 +2059,7 @@ void FmXFormShell::CloseExternalFormViewer() //------------------------------------------------------------------------------ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> FmXFormShell::getInternalForm(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm) const { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController> xExternalCtrlr(m_xExternalViewController, ::com::sun::star::uno::UNO_QUERY); if (xExternalCtrlr.is() && (_xForm == xExternalCtrlr->getModel())) { @@ -2044,6 +2072,7 @@ void FmXFormShell::CloseExternalFormViewer() //------------------------------------------------------------------------------ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> FmXFormShell::getInternalForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& _xForm) const { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController> xExternalCtrlr(m_xExternalViewController, ::com::sun::star::uno::UNO_QUERY); if (xExternalCtrlr.is() && (_xForm == xExternalCtrlr->getModel())) { @@ -2056,6 +2085,7 @@ void FmXFormShell::CloseExternalFormViewer() //------------------------------------------------------------------------------ void FmXFormShell::ActivateDispatchers(const UniString& _sNavFormAccess, sal_Bool _bActivate) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); for ( ConstFormsDispatchersIterator aFormIter = m_aNavigationDispatcher.begin(); aFormIter != m_aNavigationDispatcher.end(); ++aFormIter @@ -2081,6 +2111,7 @@ void FmXFormShell::ActivateDispatchers(const UniString& _sNavFormAccess, sal_Boo //------------------------------------------------------------------------------ UniString FmXFormShell::GetAccessPathFromForm(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm, const UniString& rAssumedPagePrefix) const { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); UniString sReturn; if (!_xForm.is()) return sReturn; @@ -2112,6 +2143,7 @@ UniString FmXFormShell::GetAccessPathFromForm(const ::com::sun::star::uno::Refer //------------------------------------------------------------------------------ UniString FmXFormShell::GetPageId(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm) const { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); UniString sEmptyReturn; FmFormModel* pModel = m_pShell->GetFormModel(); if (!pModel) @@ -2146,6 +2178,7 @@ UniString FmXFormShell::GetPageId(const ::com::sun::star::uno::Reference< ::com: //------------------------------------------------------------------------------ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer> FmXFormShell::GetPageForms(const UniString sPageId) const { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer> aEmptyReturn; FmFormModel* pModel = m_pShell->GetFormModel(); if (!pModel) @@ -2169,6 +2202,7 @@ UniString FmXFormShell::GetPageId(const ::com::sun::star::uno::Reference< ::com: //------------------------------------------------------------------------------ void FmXFormShell::UpdateAllFormDispatchers(const UniString& _rPath) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); for ( FormsDispatchersIterator aDispIter = m_aNavigationDispatcher.begin(); aDispIter != m_aNavigationDispatcher.end(); ++aDispIter @@ -2195,6 +2229,7 @@ void FmXFormShell::UpdateAllFormDispatchers(const UniString& _rPath) //------------------------------------------------------------------------------ void FmXFormShell::UpdateFormDispatcher(FmFormNavigationDispatcher* _pDisp) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); sal_Bool bEnable = sal_False; if (!_pDisp) return; @@ -2237,6 +2272,7 @@ void FmXFormShell::UpdateFormDispatcher(FmFormNavigationDispatcher* _pDisp) //------------------------------------------------------------------------------ IMPL_LINK(FmXFormShell, OnExecuteNavSlot, FmFormNavigationDispatcher*, pDispatcher) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); DBG_ASSERT(pDispatcher, "FmXFormShell::OnExecuteNavSlot : invalid argument !"); ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> xCursor(pDispatcher->getForm()); @@ -2308,6 +2344,7 @@ IMPL_LINK(FmXFormShell, OnExecuteNavSlot, FmFormNavigationDispatcher*, pDispatch //------------------------------------------------------------------------------ void FmXFormShell::setActiveController(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& xController) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); if (m_bChangingDesignMode) return; DBG_ASSERT(!m_pShell->IsDesignMode(), "nur im alive mode verwenden"); @@ -2372,6 +2409,7 @@ void FmXFormShell::setActiveController(const ::com::sun::star::uno::Reference< : } catch(...) { + DBG_ERROR("FmXFormShell::setActiveController: Exception occured!"); } @@ -2432,6 +2470,7 @@ void FmXFormShell::setActiveController(const ::com::sun::star::uno::Reference< : //------------------------------------------------------------------------------ void FmXFormShell::setCurControl( const SdrMarkList& rMarkList ) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); if (isControlList(rMarkList)) { // Aktuell selektiertes Objekt setzen @@ -2475,6 +2514,7 @@ void FmXFormShell::setCurControl( const SdrMarkList& rMarkList ) //------------------------------------------------------------------------------ void FmXFormShell::setCurControl(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& xNewControl) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); DBG_ASSERT(m_pShell->IsDesignMode(), "nur im designmode verwenden"); if (m_xCurControl == xNewControl) @@ -2505,6 +2545,7 @@ void FmXFormShell::setCurControl(const ::com::sun::star::uno::Reference< ::com:: //------------------------------------------------------------------------------ void FmXFormShell::setSelObject(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& xNewObj) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); DBG_ASSERT(m_pShell->IsDesignMode(), "nur im designmode verwenden"); if (m_xSelObject != xNewObj) @@ -2518,6 +2559,7 @@ void FmXFormShell::setSelObject(const ::com::sun::star::uno::Reference< ::com::s //------------------------------------------------------------------------------ void FmXFormShell::setCurForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& xF) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); DBG_ASSERT(m_pShell->IsDesignMode(), "nur im designmode verwenden"); if (xF != m_xCurForm) { @@ -2533,6 +2575,7 @@ void FmXFormShell::setCurForm(const ::com::sun::star::uno::Reference< ::com::sun //------------------------------------------------------------------------------ void FmXFormShell::startListening() { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet> xDatabaseForm(m_xActiveForm, ::com::sun::star::uno::UNO_QUERY); if (xDatabaseForm.is() && ::dbtools::getConnection(xDatabaseForm).is()) { @@ -2543,7 +2586,7 @@ void FmXFormShell::startListening() ::rtl::OUString aSource = ::comphelper::getString(xActiveFormSet->getPropertyValue(FM_PROP_COMMAND)); if (aSource.len()) { - // datensatzwechsel mitbekommen + // we have to recognize any change roset change xDatabaseForm->addRowSetListener(this); // Modify @@ -2561,8 +2604,7 @@ void FmXFormShell::startListening() m_bDatabaseBar = sal_True; - ::com::sun::star::uno::Any aVal = xActiveFormSet->getPropertyValue(FM_PROP_NAVIGATION); - m_eNavigate = *(::com::sun::star::form::NavigationBarMode*) aVal.getValue(); + xActiveFormSet->getPropertyValue(FM_PROP_NAVIGATION) >>= m_eNavigate; xActiveFormSet->addPropertyChangeListener(FM_PROP_ISMODIFIED,this); xActiveFormSet->addPropertyChangeListener(FM_PROP_ISNEW, this); @@ -2583,9 +2625,7 @@ void FmXFormShell::startListening() xParentSet = ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>(xParent->getModel(), ::com::sun::star::uno::UNO_QUERY); if (xParentSet.is()) { - ::com::sun::star::uno::Any aVal( xParentSet->getPropertyValue(FM_PROP_NAVIGATION) ); - m_eNavigate = *(::com::sun::star::form::NavigationBarMode*) aVal.getValue(); - + xParentSet->getPropertyValue(FM_PROP_NAVIGATION) >>= m_eNavigate; if (m_eNavigate == ::com::sun::star::form::NavigationBarMode_CURRENT) break; } @@ -2624,6 +2664,7 @@ void FmXFormShell::startListening() } catch(...) { + DBG_ERROR("FmXFormShell::startListening: Exception occured!"); } @@ -2647,6 +2688,7 @@ void FmXFormShell::startListening() //------------------------------------------------------------------------------ void FmXFormShell::stopListening() { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet> xDatabaseForm(m_xActiveForm, ::com::sun::star::uno::UNO_QUERY); if (xDatabaseForm.is() && m_bDatabaseBar) { @@ -2696,6 +2738,7 @@ void FmXFormShell::stopListening() //------------------------------------------------------------------------------ void FmXFormShell::ShowProperties(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& rxObject, sal_Bool bShow) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); // Evtl. noch aktuelles Objekt umsetzen if (rxObject != m_xSelObject) setSelObject( rxObject ); @@ -2716,6 +2759,7 @@ void FmXFormShell::ShowProperties(const ::com::sun::star::uno::Reference< ::com: //------------------------------------------------------------------------------ IMPL_LINK(FmXFormShell, OnFoundData, FmFoundRecordInformation*, pfriWhere) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); DBG_ASSERT((pfriWhere->nContext >= 0) && (pfriWhere->nContext < m_arrSearchContexts.size()), "FmXFormShell::OnFoundData : ungueltiger Kontext !"); ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xForm( m_arrSearchContexts.at(pfriWhere->nContext)); @@ -2788,6 +2832,7 @@ IMPL_LINK(FmXFormShell, OnFoundData, FmFoundRecordInformation*, pfriWhere) //------------------------------------------------------------------------------ IMPL_LINK(FmXFormShell, OnCanceledNotFound, FmFoundRecordInformation*, pfriWhere) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); DBG_ASSERT((pfriWhere->nContext >= 0) && (pfriWhere->nContext < m_arrSearchContexts.size()), "FmXFormShell::OnCanceledNotFound : ungueltiger Kontext !"); ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xForm( m_arrSearchContexts.at(pfriWhere->nContext)); @@ -2807,6 +2852,7 @@ IMPL_LINK(FmXFormShell, OnCanceledNotFound, FmFoundRecordInformation*, pfriWhere //------------------------------------------------------------------------------ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextInfo) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); DBG_ASSERT(pfmscContextInfo->nContext < m_arrSearchContexts.size(), "FmXFormShell::OnSearchContextRequest : invalid parameter !"); ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xForm( m_arrSearchContexts.at(pfmscContextInfo->nContext)); DBG_ASSERT(xForm.is(), "FmXFormShell::OnSearchContextRequest : unexpected : invalid context !"); @@ -2915,9 +2961,10 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn // the case 'no columns' should be indicated with an empty container, I think ... DBG_ASSERT(xModelColumns->getCount() >= xPeerContainer->getCount(), "FmXFormShell::OnSearchContextRequest : impossible : have more view than model columns !"); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xCurrentColumn; for (sal_Int16 nViewPos=0; nViewPos<xPeerContainer->getCount(); ++nViewPos) { - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xCurrentColumn(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)xPeerContainer->getByIndex(nViewPos).getValue(), ::com::sun::star::uno::UNO_QUERY); + xPeerContainer->getByIndex(nViewPos) >>= xCurrentColumn; if (!xCurrentColumn.is()) continue; @@ -2926,7 +2973,8 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn continue; sal_Int16 nModelPos = GridView2ModelPos(xModelColumns, nViewPos); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xCurrentColModel( *(::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>*)xModelColumns->getByIndex(nModelPos).getValue()); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xCurrentColModel; + xModelColumns->getByIndex(nModelPos) >>= xCurrentColModel; aName = ::comphelper::getString(xCurrentColModel->getPropertyValue(FM_PROP_CONTROLSOURCE)); // the cursor has a field matching the control source ? if (xValidFormFields->hasByName(aName)) @@ -3023,28 +3071,39 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn //------------------------------------------------------------------------------ void FmXFormShell::elementInserted(const ::com::sun::star::container::ContainerEvent& evt) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); // neues Object zum lauschen - AddElement(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)evt.Element.getValue()); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xTemp; + evt.Element >>= xTemp; + AddElement(xTemp); m_pShell->DetermineForms(sal_True); } //------------------------------------------------------------------------------ void FmXFormShell::elementReplaced(const ::com::sun::star::container::ContainerEvent& evt) { - RemoveElement(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)evt.ReplacedElement.getValue()); - AddElement(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)evt.Element.getValue()); + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xTemp; + evt.ReplacedElement >>= xTemp; + RemoveElement(xTemp); + evt.Element >>= xTemp; + AddElement(xTemp); } //------------------------------------------------------------------------------ void FmXFormShell::elementRemoved(const ::com::sun::star::container::ContainerEvent& evt) { - RemoveElement(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)evt.Element.getValue()); + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xTemp; + evt.Element >>= xTemp; + RemoveElement(xTemp); m_pShell->DetermineForms(sal_True); } //------------------------------------------------------------------------------ void FmXFormShell::ResetForms(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xForms, sal_Bool bInvalidate) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); if (m_xForms != _xForms) { RemoveElement(m_xForms); @@ -3059,16 +3118,17 @@ void FmXFormShell::ResetForms(const ::com::sun::star::uno::Reference< ::com::sun //------------------------------------------------------------------------------ void FmXFormShell::AddElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); // am Container horchen ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer> xContainer(Element, ::com::sun::star::uno::UNO_QUERY); if (xContainer.is()) { sal_uInt32 nCount = xContainer->getCount(); - ::com::sun::star::uno::Any aElement; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xElement; for (sal_uInt32 i = 0; i < nCount; i++) { - aElement = xContainer->getByIndex(i); - AddElement(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)aElement.getValue()); + xContainer->getByIndex(i) >>= xElement; + AddElement(xElement); } ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer> xCont(Element, ::com::sun::star::uno::UNO_QUERY); @@ -3084,6 +3144,7 @@ void FmXFormShell::AddElement(const ::com::sun::star::uno::Reference< ::com::sun //------------------------------------------------------------------------------ void FmXFormShell::RemoveElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier> xSelSupplier(Element, ::com::sun::star::uno::UNO_QUERY); if (xSelSupplier.is()) xSelSupplier->removeSelectionChangeListener(this); @@ -3097,11 +3158,11 @@ void FmXFormShell::RemoveElement(const ::com::sun::star::uno::Reference< ::com:: xCont->removeContainerListener(this); sal_uInt32 nCount = xContainer->getCount(); - ::com::sun::star::uno::Any aElement; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xElement; for (sal_uInt32 i = 0; i < nCount; i++) { - aElement = xContainer->getByIndex(i); - RemoveElement(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)aElement.getValue()); + xContainer->getByIndex(i) >>= xElement; + RemoveElement(xElement); } } } @@ -3109,11 +3170,13 @@ void FmXFormShell::RemoveElement(const ::com::sun::star::uno::Reference< ::com:: //------------------------------------------------------------------------------ void FmXFormShell::selectionChanged(const ::com::sun::star::lang::EventObject& rEvent) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier> xSupplier(rEvent.Source, ::com::sun::star::uno::UNO_QUERY); ::com::sun::star::uno::Any aSelObj( xSupplier->getSelection() ); if (aSelObj.getValueTypeClass() != ::com::sun::star::uno::TypeClass_INTERFACE) return; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xSelObj( *(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)aSelObj.getValue()); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xSelObj; + aSelObj >>= xSelObj; // es wurde eine Selektion weggenommen, dieses kann nur durch die Shell vorgenommen werden if (!xSelObj.is()) @@ -3145,6 +3208,7 @@ void FmXFormShell::selectionChanged(const ::com::sun::star::lang::EventObject& r //------------------------------------------------------------------------------ IMPL_LINK(FmXFormShell, OnTimeOut, void*, EMPTYTAG) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); if (m_pShell->IsDesignMode() && m_pShell->GetFormView()) SetSelection(m_pShell->GetFormView()->GetMarkList()); @@ -3161,6 +3225,7 @@ void FmXFormShell::SetSelectionDelayed(FmFormView* pView) //------------------------------------------------------------------------ void FmXFormShell::SetSelection(const SdrMarkList& rMarkList) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); DetermineSelection(rMarkList); m_pShell->NotifyMarkListChanged(m_pShell->GetFormView()); } @@ -3168,6 +3233,7 @@ void FmXFormShell::SetSelection(const SdrMarkList& rMarkList) //------------------------------------------------------------------------ void FmXFormShell::DetermineSelection(const SdrMarkList& rMarkList) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); // Aktuelles Objekt setzen ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xPreviousObject( m_xSelObject); sal_Bool bMixedWithFormControls = sal_True; @@ -3199,6 +3265,7 @@ void FmXFormShell::DetermineSelection(const SdrMarkList& rMarkList) //------------------------------------------------------------------------------ void FmXFormShell::SaveMarkList(const FmFormView* pView) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); m_aMark = pView->GetMarkList(); m_aMarkTimer.Stop(); } @@ -3206,6 +3273,7 @@ void FmXFormShell::SaveMarkList(const FmFormView* pView) //------------------------------------------------------------------------------ void FmXFormShell::RestoreMarkList(FmFormView* pView) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); const SdrMarkList& rCurrentList = pView->GetMarkList(); FmFormPage* pPage = m_pShell->GetCurPage(); if (pPage) @@ -3330,6 +3398,7 @@ void FmXFormShell::RestoreMarkList(FmFormView* pView) //------------------------------------------------------------------------------ sal_Bool FmXFormShell::IsPropBrwOpen() const { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); return( ( m_pShell->GetViewShell() && m_pShell->GetViewShell()->GetViewFrame() ) ? m_pShell->GetViewShell()->GetViewFrame()->HasChildWindow(SID_FM_SHOW_PROPERTIES) : sal_False ); } @@ -3337,6 +3406,7 @@ sal_Bool FmXFormShell::IsPropBrwOpen() const //------------------------------------------------------------------------------ void FmXFormShell::SetDesignMode(sal_Bool bDesign) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); DBG_ASSERT(m_pShell && m_pShell->GetFormView(), "FmXFormShell::SetDesignMode : invalid call (have no shell or no view) !"); m_bChangingDesignMode = sal_True; @@ -3448,6 +3518,7 @@ void FmXFormShell::ObjectRemovedInAliveMode(const SdrObject* pObject) //------------------------------------------------------------------------------ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> FmXFormShell::GetControlFromModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& xModel) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); // die View ... SdrPageView* pCurPageView = m_pShell->GetFormView()->GetPageViewPvNum(0); // deren ViewWinRec-Liste, daraus das erste Element @@ -3470,25 +3541,28 @@ void FmXFormShell::ObjectRemovedInAliveMode(const SdrObject* pObject) //------------------------------------------------------------------------------ void FmXFormShell::CollectFormContexts(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& xStartingPoint, const UniString& sCurrentLevelPrefix, UniString& sNames) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> xAllComponentIndizies(xStartingPoint, ::com::sun::star::uno::UNO_QUERY); if (xAllComponentIndizies.is() && xAllComponentIndizies->getCount()) { - // das Ding hat Kinder, also gehen wir die alle durch - ::com::sun::star::uno::Any aElement; + // work through all children UniString sCurrentFormName, sNextLevelPrefix; + ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xCurrentAsForm; for (sal_Int32 i=0; i<xAllComponentIndizies->getCount(); ++i) { - aElement = xAllComponentIndizies->getByIndex(i); - // ist das aktuelle Kind eine Form ? - ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xCurrentAsForm(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)aElement.getValue(), ::com::sun::star::uno::UNO_QUERY); + xAllComponentIndizies->getByIndex(i) >>= xCurrentAsForm;; + // is the current child a form? if (xCurrentAsForm.is()) { ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xAskForName(xCurrentAsForm, ::com::sun::star::uno::UNO_QUERY); if (xAskForName.is()) { try { sCurrentFormName = ::comphelper::getString(xAskForName->getPropertyValue(FM_PROP_NAME)).getStr(); } - catch(...) { } + catch(...) + { + DBG_ERROR("FmXFormShell::CollectFormContexts: Exception occured!"); + } } // den Namen an die Aufzaehlung haengen sNames += ';'; @@ -3519,6 +3593,7 @@ void FmXFormShell::CollectFormContexts(const ::com::sun::star::uno::Reference< : //------------------------------------------------------------------------------ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> FmXFormShell::GetBoundField(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& _xControl, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& _xForm) const { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); // sonderbehandlung fuer databaseGrid ::com::sun::star::uno::Reference< ::com::sun::star::form::XGrid> xGrid(_xControl, ::com::sun::star::uno::UNO_QUERY); ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xModel, xField; @@ -3529,7 +3604,7 @@ void FmXFormShell::CollectFormContexts(const ::com::sun::star::uno::Reference< : ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> xCols(_xControl->getModel(), ::com::sun::star::uno::UNO_QUERY); nCurrentPos = GridView2ModelPos(xCols, nCurrentPos); if (nCurrentPos != (sal_Int16)-1) - xModel = *(::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>*)xCols->getByIndex(nCurrentPos).getValue(); + xCols->getByIndex(nCurrentPos) >>= xModel; } else if (_xControl.is()) { @@ -3541,10 +3616,7 @@ void FmXFormShell::CollectFormContexts(const ::com::sun::star::uno::Reference< : // (zum Beispiel ein TextControl an ein Bild-Feld) // (FS - 64265) if (xModel.is() && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xModel)) - { - ::com::sun::star::uno::Any aElement( xModel->getPropertyValue(FM_PROP_BOUNDFIELD) ); - xField = *(::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>*)aElement.getValue(); - } + xModel->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField; return xField; } @@ -3552,6 +3624,7 @@ void FmXFormShell::CollectFormContexts(const ::com::sun::star::uno::Reference< : //------------------------------------------------------------------------------ void FmXFormShell::SetWizardUsing(sal_Bool bUseThem) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); // gleich an die INI weiterreichen SFX_INIMANAGER()->Set( (bUseThem ? '1' : '0'), SFX_GROUP_DATABASE, String::CreateFromAscii("UseWizards")); m_bUseWizards = bUseThem; @@ -3574,6 +3647,7 @@ void FmXFormShell::ObjectRemoveListener::Notify(SfxBroadcaster& rBC, const SfxHi //------------------------------------------------------------------------------ void FmXFormShell::startFiltering() { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); // setting all forms in filter mode FmXFormView* pXView = m_pShell->GetFormView()->GetImpl(); @@ -3607,17 +3681,17 @@ void FmXFormShell::startFiltering() } //------------------------------------------------------------------------------ -void saveFilter(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& xController) +void saveFilter(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& _rxController) { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xFormAsSet(xController->getModel(), ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xControllerAsSet(xController, ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> xControllerAsIndex(xController, ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xFormAsSet(_rxController->getModel(), ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xControllerAsSet(_rxController, ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> xControllerAsIndex(_rxController, ::com::sun::star::uno::UNO_QUERY); // call the subcontroller - for (sal_Int32 i = 0, nCount = xControllerAsIndex->getCount(); - i < nCount; i++) + ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController> xController; + for (sal_Int32 i = 0, nCount = xControllerAsIndex->getCount(); i < nCount; ++i) { - ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController> xController(*(::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>*)xControllerAsIndex->getByIndex(i).getValue()); + xControllerAsIndex->getByIndex(i) >>= xController; saveFilter(xController); } @@ -3631,6 +3705,7 @@ void saveFilter(const ::com::sun::star::uno::Reference< ::com::sun::star::form:: } catch(...) { + DBG_ERROR("saveFilter: Exception occured!"); } } @@ -3638,6 +3713,7 @@ void saveFilter(const ::com::sun::star::uno::Reference< ::com::sun::star::form:: //------------------------------------------------------------------------------ void FmXFormShell::stopFiltering(sal_Bool bSave) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); m_bFilterMode = sal_False; FmXFormView* pXView = m_pShell->GetFormView()->GetImpl(); @@ -3711,6 +3787,7 @@ void FmXFormShell::stopFiltering(sal_Bool bSave) } catch(...) { + DBG_ERROR("FmXFormShell::stopFiltering: Exception occured!"); } if (!isRowSetAlive(xFormSet)) @@ -3725,6 +3802,7 @@ void FmXFormShell::stopFiltering(sal_Bool bSave) } catch(...) { + DBG_ERROR("FmXFormShell::stopFiltering: Exception occured!"); } } } @@ -3736,21 +3814,23 @@ void FmXFormShell::stopFiltering(sal_Bool bSave) } //------------------------------------------------------------------------------ -void clearFilter(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& xController) +void clearFilter(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& _rxController) { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xControllerAsSet(xController, ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> xControllerAsIndex(xController, ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xControllerAsSet(_rxController, ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> xControllerAsIndex(_rxController, ::com::sun::star::uno::UNO_QUERY); // call the subcontroller + ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController> xController; for (sal_Int32 i = 0, nCount = xControllerAsIndex->getCount(); i < nCount; i++) { - ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController> xController(*(::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>*)xControllerAsIndex->getByIndex(i).getValue()); + xControllerAsIndex->getByIndex(i) >>= xController; clearFilter(xController); } // clear the filter - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer> xContainer(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)xControllerAsSet->getPropertyValue(FM_PROP_FILTERSUPPLIER).getValue(), ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer> xContainer; + xControllerAsSet->getPropertyValue(FM_PROP_FILTERSUPPLIER) >>= xContainer; if (xContainer.is()) { // clear the current filter @@ -3769,6 +3849,7 @@ void clearFilter(const ::com::sun::star::uno::Reference< ::com::sun::star::form: //------------------------------------------------------------------------------ void FmXFormShell::clearFilter() { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); FmXFormView* pXView = m_pShell->GetFormView()->GetImpl(); // if the active controller is our external one we have to use the trigger controller @@ -3796,6 +3877,7 @@ void FmXFormShell::clearFilter() //------------------------------------------------------------------------------ void FmXFormShell::setControlLocks() { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController> xCtrler(getActiveController(), ::com::sun::star::uno::UNO_QUERY); if (!xCtrler.is()) return; @@ -3821,7 +3903,7 @@ void FmXFormShell::setControlLocks() { // no recursion. we only know top level control containers (e.g. grid controls) for (sal_Int16 i=0; i<xContainer->getCount(); ++i) { - xCtrl = ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundControl>(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)xContainer->getByIndex(i).getValue(), ::com::sun::star::uno::UNO_QUERY); + xContainer->getByIndex(i) >>= xCtrl; if (!xCtrl.is()) continue; @@ -3840,6 +3922,7 @@ void FmXFormShell::setControlLocks() //------------------------------------------------------------------------------ void FmXFormShell::restoreControlLocks() { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController> xCtrler(getActiveController(), ::com::sun::star::uno::UNO_QUERY); if (!xCtrler.is()) return; @@ -3864,7 +3947,7 @@ void FmXFormShell::restoreControlLocks() { // no recursion. we only know top level control containers (e.g. grid controls) for (sal_Int16 i=0; i<xContainer->getCount(); ++i) { - xCtrl = ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundControl>(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)xContainer->getByIndex(i).getValue(), ::com::sun::star::uno::UNO_QUERY); + xContainer->getByIndex(i) >>= xCtrl; if (!xCtrl.is()) continue; @@ -3887,6 +3970,7 @@ void FmXFormShell::restoreControlLocks() //------------------------------------------------------------------------------ void FmXFormShell::DoAsyncCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& _xController, CURSOR_ACTION _eWhat) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); DBG_ASSERT(_xController.is(), "FmXFormShell::DoAsyncCursorAction : invalid argument !"); DoAsyncCursorAction(::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>(_xController->getModel(), ::com::sun::star::uno::UNO_QUERY), _eWhat); } @@ -3894,6 +3978,7 @@ void FmXFormShell::DoAsyncCursorAction(const ::com::sun::star::uno::Reference< : //------------------------------------------------------------------------------ void FmXFormShell::DoAsyncCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm, CURSOR_ACTION _eWhat) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::osl::MutexGuard aGuard(m_aAsyncSafety); DBG_ASSERT(_xForm.is(), "FmXFormShell::DoAsyncCursorAction : invalid argument !"); @@ -3945,6 +4030,7 @@ void FmXFormShell::DoAsyncCursorAction(const ::com::sun::star::uno::Reference< : //------------------------------------------------------------------------------ sal_Bool FmXFormShell::HasPendingCursorAction(const UniString& _rAccessPath) const { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::osl::MutexGuard aGuard(((FmXFormShell*)this)->m_aAsyncSafety); for ( ConstCursorActionsIterator aIter = m_aCursorActions.begin(); @@ -3969,6 +4055,7 @@ sal_Bool FmXFormShell::HasPendingCursorAction(const UniString& _rAccessPath) con //------------------------------------------------------------------------------ sal_Bool FmXFormShell::HasPendingCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm) const { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); if (!_xForm.is()) return sal_False; @@ -3978,6 +4065,7 @@ sal_Bool FmXFormShell::HasPendingCursorAction(const ::com::sun::star::uno::Refer //------------------------------------------------------------------------------ sal_Bool FmXFormShell::HasPendingCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& xController) const { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); if (!xController.is()) return sal_False; @@ -4000,6 +4088,7 @@ sal_Bool FmXFormShell::HasAnyPendingCursorAction() const //------------------------------------------------------------------------------ void FmXFormShell::CancelAnyPendingCursorAction() { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::comphelper::OReusableGuard< ::osl::Mutex> aGuard(m_aAsyncSafety); CursorActionsIterator aIter; @@ -4030,6 +4119,7 @@ void FmXFormShell::CancelAnyPendingCursorAction() //------------------------------------------------------------------------------ IMPL_LINK(FmXFormShell, OnCursorActionDone, FmCursorActionThread*, pThread) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::osl::MutexGuard aGuard(m_aAsyncSafety); // search the pos of the thread within m_aCursorActions @@ -4053,12 +4143,14 @@ IMPL_LINK(FmXFormShell, OnCursorActionDone, FmCursorActionThread*, pThread) //------------------------------------------------------------------------------ sal_Bool FmXFormShell::PathsInterfere(const UniString& _rPathLeft, const UniString& _rPathRight) const { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); return ((_rPathLeft.Search(_rPathRight) == 0) || (_rPathRight.Search(_rPathLeft) == 0)); } //------------------------------------------------------------------------------ IMPL_LINK(FmXFormShell, OnCursorActionDoneMainThread, FmCursorActionThread*, pThread) { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); ::osl::MutexGuard aGuard(m_aAsyncSafety); // search the pos of the thread within m_aCursorActions @@ -4103,6 +4195,7 @@ IMPL_LINK(FmXFormShell, OnCursorActionDoneMainThread, FmCursorActionThread*, pTh //------------------------------------------------------------------------------ void FmXFormShell::CreateExternalView() { + OSL_ENSHURE(!FmXFormShell_BASE::rBHelper.bDisposed,"FmXFormShell: Object already disposed!"); DBG_ASSERT(m_xAttachedFrame.is(), "FmXFormShell::CreateExternalView : no frame !"); // the frame the external view is displayed in @@ -4249,11 +4342,11 @@ void FmXFormShell::CreateExternalView() ::com::sun::star::uno::Any aCurrentBoundField; ::rtl::OUString sColumnType,aGroupName,sControlSource; ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> aProps; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xCurrentBoundField; while ((xCurrentModelSet = ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>(aModelIterator.Next(), ::com::sun::star::uno::UNO_QUERY)).is()) { - aCurrentBoundField = xCurrentModelSet->getPropertyValue(FM_PROP_BOUNDFIELD); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xCurrentBoundField(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)aCurrentBoundField.getValue(), ::com::sun::star::uno::UNO_QUERY); - + xCurrentModelSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xCurrentBoundField; + OSL_ENSHURE(xCurrentModelSet.is(),"xCurrentModelSet is null!"); // create a description of the column to be created // first : determine it's type @@ -4536,7 +4629,8 @@ sal_Bool SearchableControlIterator::ShouldHandleElement(const ::com::sun::star:: if (::comphelper::hasProperty(FM_PROP_CONTROLSOURCE, xProperties) && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xProperties)) { // und das BoundField gueltig ist - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xField( *(::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>*)(xProperties->getPropertyValue(FM_PROP_BOUNDFIELD).getValue())); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xField; + xProperties->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField; if (xField.is()) { // nehmen wir's diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx index cb8faeea7c63..3bdf40d9b5a6 100644 --- a/svx/source/form/fmtools.cxx +++ b/svx/source/form/fmtools.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fmtools.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2000-11-06 07:07:42 $ + * last change: $Author: oj $ $Date: 2000-11-07 13:16:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -416,9 +416,10 @@ void CloneForms(const Reference< ::com::sun::star::container::XIndexContainer>& DBG_ASSERT(_xSource.is() && _xDest.is(), "CloneForms : invalid argument !"); sal_Int32 nSourceCount = _xSource->getCount(); + Reference< ::com::sun::star::sdbc::XRowSet> xCurrent; for (sal_Int32 i=nSourceCount-1; i>=0; --i) { - Reference< ::com::sun::star::sdbc::XRowSet> xCurrent(*(Reference< XInterface>*)_xSource->getByIndex(i).getValue(), UNO_QUERY); + _xSource->getByIndex(i) >>= xCurrent; if (!xCurrent.is()) continue; @@ -450,17 +451,14 @@ sal_Bool searchElement(const Reference< ::com::sun::star::container::XIndexAcces return sal_False; sal_Int32 nCount = xCont->getCount(); - Any aRet; + Reference< XInterface> xComp; for (sal_Int32 i = 0; i < nCount; i++) { - Reference< XInterface> xComp; try { - aRet = xCont->getByIndex(i); - if (aRet.hasValue()) + xCont->getByIndex(i) >>= xComp; + if (xComp.is()) { - Reference< XInterface> xIface(*(Reference< XInterface>*) aRet.getValue()); - ::comphelper::query_interface(xIface, xComp); if (((XInterface *)xElement.get()) == (XInterface*)xComp.get()) return sal_True; else @@ -692,16 +690,13 @@ Reference< ::com::sun::star::frame::XModel> getXModel(const Reference< XInterfac if (::comphelper::hasProperty(FM_PROP_CONTROLLABEL, xControlModel)) { - Any aLabelModel( xControlModel->getPropertyValue(FM_PROP_CONTROLLABEL) ); - if (aLabelModel.getValueTypeClass() == TypeClass_INTERFACE) + Reference< ::com::sun::star::beans::XPropertySet> xLabelSet; + xControlModel->getPropertyValue(FM_PROP_CONTROLLABEL) >>= xLabelSet; + if (xLabelSet.is() && ::comphelper::hasProperty(FM_PROP_LABEL, xLabelSet)) { - Reference< ::com::sun::star::beans::XPropertySet> xLabelSet(*(Reference< XInterface>*)aLabelModel.getValue(), UNO_QUERY); - if (xLabelSet.is() && ::comphelper::hasProperty(FM_PROP_LABEL, xLabelSet)) - { - Any aLabel( xLabelSet->getPropertyValue(FM_PROP_LABEL) ); - if ((aLabel.getValueTypeClass() == TypeClass_STRING) && ::comphelper::getString(aLabel).getLength()) - return ::comphelper::getString(aLabel); - } + Any aLabel( xLabelSet->getPropertyValue(FM_PROP_LABEL) ); + if ((aLabel.getValueTypeClass() == TypeClass_STRING) && ::comphelper::getString(aLabel).getLength()) + return ::comphelper::getString(aLabel); } } @@ -1507,28 +1502,37 @@ void TransferEventScripts(const Reference< ::com::sun::star::awt::XControlModel> //------------------------------------------------------------------------------ sal_Int16 GridModel2ViewPos(const Reference< ::com::sun::star::container::XIndexAccess>& rColumns, sal_Int16 nModelPos) { - if (rColumns.is()) + try { - // invalid pos ? - if (nModelPos >= rColumns->getCount()) - return (sal_Int16)-1; - - // the column itself shouldn't be hidden - Reference< ::com::sun::star::beans::XPropertySet> xAskedFor( *(Reference< ::com::sun::star::beans::XPropertySet>*)rColumns->getByIndex(nModelPos).getValue()); - if (::comphelper::getBOOL(xAskedFor->getPropertyValue(FM_PROP_HIDDEN))) + if (rColumns.is()) { - DBG_ERROR("GridModel2ViewPos : invalid argument !"); - return (sal_Int16)-1; - } + // invalid pos ? + if (nModelPos >= rColumns->getCount()) + return (sal_Int16)-1; + + // the column itself shouldn't be hidden + Reference< ::com::sun::star::beans::XPropertySet> xAskedFor; + rColumns->getByIndex(nModelPos) >>= xAskedFor; + if (::comphelper::getBOOL(xAskedFor->getPropertyValue(FM_PROP_HIDDEN))) + { + DBG_ERROR("GridModel2ViewPos : invalid argument !"); + return (sal_Int16)-1; + } - sal_Int16 nViewPos = nModelPos; - for (sal_Int16 i=0; i<nModelPos; ++i) - { - Reference< ::com::sun::star::beans::XPropertySet> xCur( *(Reference< ::com::sun::star::beans::XPropertySet>*)rColumns->getByIndex(i).getValue()); - if (::comphelper::getBOOL(xCur->getPropertyValue(FM_PROP_HIDDEN))) - --nViewPos; + sal_Int16 nViewPos = nModelPos; + Reference< ::com::sun::star::beans::XPropertySet> xCur; + for (sal_Int16 i=0; i<nModelPos; ++i) + { + rColumns->getByIndex(i) >>= xCur; + if (::comphelper::getBOOL(xCur->getPropertyValue(FM_PROP_HIDDEN))) + --nViewPos; + } + return nViewPos; } - return nViewPos; + } + catch(...) + { + DBG_ERROR("GridModel2ViewPos Exception occured!"); } return (sal_Int16)-1; } @@ -1536,23 +1540,31 @@ sal_Int16 GridModel2ViewPos(const Reference< ::com::sun::star::container::XInd //------------------------------------------------------------------------------ sal_Int16 GridView2ModelPos(const Reference< ::com::sun::star::container::XIndexAccess>& rColumns, sal_Int16 nViewPos) { - if (rColumns.is()) + try { - // loop through all columns - sal_Int16 i; - for (i=0; i<rColumns->getCount(); ++i) + if (rColumns.is()) { - Reference< ::com::sun::star::beans::XPropertySet> xCur( *(Reference< ::com::sun::star::beans::XPropertySet>*)rColumns->getByIndex(i).getValue()); - if (!::comphelper::getBOOL(xCur->getPropertyValue(FM_PROP_HIDDEN))) - // for every visible col : if nViewPos is greater zero, decrement it, else we - // have found the model position - if (!nViewPos) - break; - else - --nViewPos; + // loop through all columns + sal_Int16 i; + Reference< ::com::sun::star::beans::XPropertySet> xCur; + for (i=0; i<rColumns->getCount(); ++i) + { + rColumns->getByIndex(i) >>= xCur; + if (!::comphelper::getBOOL(xCur->getPropertyValue(FM_PROP_HIDDEN))) + // for every visible col : if nViewPos is greater zero, decrement it, else we + // have found the model position + if (!nViewPos) + break; + else + --nViewPos; + } + if (i<rColumns->getCount()) + return i; } - if (i<rColumns->getCount()) - return i; + } + catch(...) + { + DBG_ERROR("GridView2ModelPos Exception occured!"); } return (sal_Int16)-1; } @@ -1560,17 +1572,25 @@ sal_Int16 GridView2ModelPos(const Reference< ::com::sun::star::container::XInd //------------------------------------------------------------------------------ sal_Int16 GridViewColumnCount(const Reference< ::com::sun::star::container::XIndexAccess>& rColumns) { - if (rColumns.is()) + try { - sal_Int16 nCount = rColumns->getCount(); - // loop through all columns - for (sal_Int16 i=0; i<rColumns->getCount(); ++i) + if (rColumns.is()) { - Reference< ::com::sun::star::beans::XPropertySet> xCur( *(Reference< ::com::sun::star::beans::XPropertySet>*)rColumns->getByIndex(i).getValue()); - if (::comphelper::getBOOL(xCur->getPropertyValue(FM_PROP_HIDDEN))) - --nCount; + sal_Int16 nCount = rColumns->getCount(); + // loop through all columns + Reference< ::com::sun::star::beans::XPropertySet> xCur; + for (sal_Int16 i=0; i<rColumns->getCount(); ++i) + { + rColumns->getByIndex(i) >>= xCur; + if (::comphelper::getBOOL(xCur->getPropertyValue(FM_PROP_HIDDEN))) + --nCount; + } + return nCount; } - return nCount; + } + catch(...) + { + DBG_ERROR("GridView2ModelPos Exception occured!"); } return 0; } @@ -1768,7 +1788,7 @@ Reference< ::com::sun::star::sdbc::XConnection> findConnection(const Reference< DBG_NAME(FmXDispatchInterceptorImpl); //------------------------------------------------------------------------ FmXDispatchInterceptorImpl::FmXDispatchInterceptorImpl(const Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _rToIntercept, FmDispatchInterceptor* _pMaster, sal_Int16 _nId) - : ::cppu::OComponentHelper(_pMaster && _pMaster->getInterceptorMutex() ? *_pMaster->getInterceptorMutex() : m_aFallback) + : FmXDispatchInterceptorImpl_BASE(_pMaster && _pMaster->getInterceptorMutex() ? *_pMaster->getInterceptorMutex() : m_aFallback) ,m_xIntercepted(_rToIntercept) ,m_pMaster(_pMaster) ,m_nId(_nId) @@ -1784,7 +1804,7 @@ FmXDispatchInterceptorImpl::FmXDispatchInterceptorImpl(const Reference< ::com::s // setDispatchProvider we should have got an fallback for requests we (i.e. our master) cannot fullfill Reference< ::com::sun::star::lang::XComponent> xInterceptedComponent(m_xIntercepted, UNO_QUERY); if (xInterceptedComponent.is()) - xInterceptedComponent->addEventListener((::com::sun::star::lang::XEventListener*)this); + xInterceptedComponent->addEventListener(this); } ::comphelper::decrement(m_refCount); } @@ -1799,26 +1819,26 @@ FmXDispatchInterceptorImpl::~FmXDispatchInterceptorImpl() } //------------------------------------------------------------------------ -Any SAL_CALL FmXDispatchInterceptorImpl::queryInterface( const Type& type) throw ( RuntimeException ) -{ - Any aOut = ::cppu::queryInterface(type,static_cast< ::com::sun::star::frame::XDispatchProviderInterceptor*>(this), - static_cast< ::com::sun::star::frame::XDispatchProvider*>(this), - static_cast< ::com::sun::star::lang::XEventListener*>(this)); - if(aOut.hasValue()) - return aOut; - return OComponentHelper::queryInterface(type); -} +//Any SAL_CALL FmXDispatchInterceptorImpl::queryInterface( const Type& type) throw ( RuntimeException ) +//{ +// Any aOut = ::cppu::queryInterface(type,static_cast< ::com::sun::star::frame::XDispatchProviderInterceptor*>(this), +// static_cast< ::com::sun::star::frame::XDispatchProvider*>(this), +// static_cast< ::com::sun::star::lang::XEventListener*>(this)); +// if(aOut.hasValue()) +// return aOut; +// return OComponentHelper::queryInterface(type); +//} //------------------------------------------------------------------------------ -Sequence< Type > SAL_CALL FmXDispatchInterceptorImpl::getTypes( ) throw(RuntimeException) -{ - Sequence< Type > aTypes(OComponentHelper::getTypes()); - aTypes.realloc(2); - Type* pTypes = aTypes.getArray(); - - pTypes[aTypes.getLength()-2] = ::getCppuType((const Reference< ::com::sun::star::frame::XDispatchProviderInterceptor>*)0); - pTypes[aTypes.getLength()-1] = ::getCppuType((const Reference< ::com::sun::star::lang::XEventListener>*)0); - return aTypes; -} +//Sequence< Type > SAL_CALL FmXDispatchInterceptorImpl::getTypes( ) throw(RuntimeException) +//{ +// Sequence< Type > aTypes(OComponentHelper::getTypes()); +// aTypes.realloc(2); +// Type* pTypes = aTypes.getArray(); +// +// pTypes[aTypes.getLength()-2] = ::getCppuType((const Reference< ::com::sun::star::frame::XDispatchProviderInterceptor>*)0); +// pTypes[aTypes.getLength()-1] = ::getCppuType((const Reference< ::com::sun::star::lang::XEventListener>*)0); +// return aTypes; +//} //------------------------------------------------------------------------------ Sequence< sal_Int8 > SAL_CALL FmXDispatchInterceptorImpl::getImplementationId() throw(RuntimeException) { @@ -1945,17 +1965,16 @@ sal_Bool isLoadable(const Reference< XInterface>& xLoad) try { // is there already a active connection - Any aConn( xSet->getPropertyValue(FM_PROP_ACTIVE_CONNECTION) ); - if (aConn.getValueTypeClass() == TypeClass_INTERFACE && - ((Reference< XInterface>*)aConn.getValue())->is()) - return sal_True; - else if (::comphelper::getString(xSet->getPropertyValue(FM_PROP_DATASOURCE)).len() || - ::comphelper::getString(xSet->getPropertyValue(FM_PROP_URL)).len() || - ::findConnection(xLoad).is()) - return sal_True; + Reference< XInterface> xConn; + xSet->getPropertyValue(FM_PROP_ACTIVE_CONNECTION) >>= xConn; + return (xConn.is() || + ::comphelper::getString(xSet->getPropertyValue(FM_PROP_DATASOURCE)).len() || + ::comphelper::getString(xSet->getPropertyValue(FM_PROP_URL)).len() || + ::findConnection(xLoad).is()); } catch(Exception&) { + DBG_ERROR("isLoadable Exception occured!"); } } @@ -1971,7 +1990,8 @@ Reference< ::com::sun::star::container::XNameAccess> getTableFields(const Refere Reference< ::com::sun::star::container::XNameAccess> xTables( xSupplyTables->getTables()); if (xTables.is() && xTables->hasByName(_rsName)) { - Reference< ::com::sun::star::sdbcx::XColumnsSupplier> xTableCols(*(Reference< XInterface>*)xTables->getByName(_rsName).getValue(), UNO_QUERY); + Reference< ::com::sun::star::sdbcx::XColumnsSupplier> xTableCols; + xTables->getByName(_rsName) >>= xTableCols; DBG_ASSERT(xTableCols.is(), "::getTableFields : invalid table !"); // the table is expected to support the service sddb::Table, which requires an ::com::sun::star::sdbcx::XColumnsSupplier interface @@ -2063,8 +2083,9 @@ void setConnection(const Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet, Reference< ::com::sun::star::container::XNameAccess> xQueries(xQueriesAccess->getQueries()); if (xQueries->hasByName(aCommand)) { - Any aElement(xQueries->getByName(aCommand)); - Reference< ::com::sun::star::beans::XPropertySet> xQuery(*(Reference< XInterface>*)aElement.getValue(), UNO_QUERY); + Reference< ::com::sun::star::beans::XPropertySet> xQuery; + xQueries->getByName(aCommand) >>= xQuery; + OSL_ENSHURE(xQuery.is(),"xQuery is null!"); aReturn= ::comphelper::getString(xQuery->getPropertyValue(FM_PROP_COMMAND)); bEscapeProcessing = ::comphelper::getBOOL(xQuery->getPropertyValue(FM_PROP_ESCAPE_PROCESSING)); } @@ -2139,7 +2160,8 @@ Reference< ::com::sun::star::sdb::XSQLQueryComposer> getCurrentSettingsComposer( if (!xQueries.is() || !xQueries->hasByName(sCommand)) break; - Reference< ::com::sun::star::beans::XPropertySet> xQueryProps(*(Reference< XInterface>*)xQueries->getByName(sCommand).getValue(), UNO_QUERY); + Reference< ::com::sun::star::beans::XPropertySet> xQueryProps; + xQueries->getByName(sCommand) >>= xQueryProps; if (!xQueryProps.is()) break; diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index d4819f873923..8d27d39ad2c9 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fmundo.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: fs $ $Date: 2000-10-20 14:18:56 $ + * last change: $Author: oj $ $Date: 2000-11-07 13:16:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -609,7 +609,8 @@ void SAL_CALL FmXUndoEnvironment::vetoableChange(const ::com::sun::star::beans:: void SAL_CALL FmXUndoEnvironment::elementInserted(const ::com::sun::star::container::ContainerEvent& evt) { // neues Object zum lauschen - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *) evt.Element.getValue()); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface; + evt.Element >>= xIface; AddElement(xIface); if (!IsLocked() && rModel.GetObjectShell()) @@ -621,10 +622,11 @@ void SAL_CALL FmXUndoEnvironment::elementInserted(const ::com::sun::star::contai //------------------------------------------------------------------------------ void SAL_CALL FmXUndoEnvironment::elementReplaced(const ::com::sun::star::container::ContainerEvent& evt) { - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *) evt.ReplacedElement.getValue()); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface; + evt.ReplacedElement >>= xIface; RemoveElement(xIface); - xIface = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > (*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *) evt.Element.getValue()); + evt.Element >>= xIface; AddElement(xIface); if (!IsLocked() && rModel.GetObjectShell()) @@ -636,7 +638,8 @@ void SAL_CALL FmXUndoEnvironment::elementReplaced(const ::com::sun::star::contai //------------------------------------------------------------------------------ void SAL_CALL FmXUndoEnvironment::elementRemoved(const ::com::sun::star::container::ContainerEvent& evt) { - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)evt.Element.getValue()); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface; + evt.ReplacedElement >>= xIface; RemoveElement(xIface); if (!IsLocked() && rModel.GetObjectShell()) @@ -671,9 +674,10 @@ void FmXUndoEnvironment::AlterPropertyListening(const ::com::sun::star::uno::Ref if (xContainer.is()) { sal_uInt32 nCount = xContainer->getCount(); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface; for (sal_uInt32 i = 0; i < nCount; i++) { - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)xContainer->getByIndex(i).getValue()); + xContainer->getByIndex(i) >>= xIface; AlterPropertyListening(xIface); } } @@ -706,7 +710,7 @@ void FmXUndoEnvironment::AddElement(const ::com::sun::star::uno::Reference< ::co ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface; for (sal_uInt32 i = 0; i < nCount; i++) { - xIface = *(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)xContainer->getByIndex(i).getValue(); + xContainer->getByIndex(i) >>= xIface; AddElement(xIface); } @@ -764,7 +768,7 @@ void FmXUndoEnvironment::RemoveElement(const ::com::sun::star::uno::Reference< : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface; for (sal_uInt32 i = 0; i < nCount; i++) { - xIface = *(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)xContainer->getByIndex(i).getValue(); + xContainer->getByIndex(i) >>= xIface; RemoveElement(xIface); } } @@ -785,14 +789,16 @@ void FmXUndoEnvironment::firing_Impl( const ::com::sun::star::script::ScriptEven if (evt.Helper.getValueType() == ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>*)0)) { - ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > xController( *(::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > *)evt.Helper.getValue() ); + ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > xController; + evt.Helper >>= xController; xThis = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > (xController, ::com::sun::star::uno::UNO_QUERY); } else if (evt.Helper.getValueType() == ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>*)0)) { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSet(*(::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)evt.Helper.getValue()); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSet; + evt.Helper >>= xSet; ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xForm(xSet, ::com::sun::star::uno::UNO_QUERY); if ( xForm.is()) @@ -816,7 +822,8 @@ void FmXUndoEnvironment::firing_Impl( const ::com::sun::star::script::ScriptEven ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>*)0) ) { - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xControl( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > *)evt.Helper.getValue() ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xControl; + evt.Helper >>= xControl; xThis = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > (xControl, ::com::sun::star::uno::UNO_QUERY); } @@ -973,8 +980,9 @@ void FmUndoContainerAction::Undo() { case Inserted: { - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xObj(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)xContainer->getByIndex(nIndex).getValue()), - xIface; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xObj,xIface;; + xContainer->getByIndex(nIndex) >>= xObj; + ::comphelper::query_interface(xObj, xIface); if ((::com::sun::star::uno::XInterface *)xElement.get() == (::com::sun::star::uno::XInterface *)xIface.get()) @@ -1050,9 +1058,9 @@ void FmUndoContainerAction::Redo() } break; case Removed: { - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xObj(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)xContainer->getByIndex(nIndex).getValue()), - xIface; - if ((::com::sun::star::uno::XInterface *)xElement.get() == (::com::sun::star::uno::XInterface *)xIface.get()) + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xObj; + xContainer->getByIndex(nIndex) >>= xObj; + if ((::com::sun::star::uno::XInterface *)xElement.get() == (::com::sun::star::uno::XInterface *)xObj.get()) { ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacherManager > xManager(xContainer, ::com::sun::star::uno::UNO_QUERY); if (xManager.is()) diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index 2223a78980cf..a6aaf826f740 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -2,9 +2,9 @@ * * $RCSfile: fmview.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2000-11-06 07:07:42 $ + * last change: $Author: oj $ $Date: 2000-11-07 13:16:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -376,11 +376,11 @@ void FmFormView::ChangeDesignMode(sal_Bool bDesign) if (!bDesign) ActivateControls(pCurPageView); + ::com::sun::star::uno::Reference< ::com::sun::star::form::XReset > xReset; for (sal_Int32 i = 0, nCount = xForms->getCount(); i < nCount; i++) { - ::com::sun::star::uno::Any aElement(xForms->getByIndex(i)); - ::com::sun::star::uno::Reference< ::com::sun::star::form::XReset > xReset(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)aElement.getValue(), ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable > xLoad(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)aElement.getValue(), ::com::sun::star::uno::UNO_QUERY); + xForms->getByIndex(i) >>= xReset; + ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable > xLoad(xReset, ::com::sun::star::uno::UNO_QUERY); if (bDesign) { @@ -863,14 +863,16 @@ SdrObject* FmFormView::CreateFieldControl(const UniString& rFieldDesc) const case 0: // old : DataSelectionType_TABLE: { ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > xSupplyTables(xConnection, ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyColumns(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)xSupplyTables->getTables()->getByName(aObjectName).getValue(), ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyColumns; + xSupplyTables->getTables()->getByName(aObjectName) >>= xSupplyColumns; xFields = xSupplyColumns->getColumns(); } break; case 1: // old : DataSelectionType_QUERY: { ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XQueriesSupplier > xSupplyQueries(xConnection, ::com::sun::star::uno::UNO_QUERY); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyColumns(*(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > *)xSupplyQueries->getQueries()->getByName(aObjectName).getValue(), ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyColumns; + xSupplyQueries->getQueries()->getByName(aObjectName) >>= xSupplyColumns; xFields = xSupplyColumns->getColumns(); } break; @@ -886,7 +888,7 @@ SdrObject* FmFormView::CreateFieldControl(const UniString& rFieldDesc) const } if (xFields.is() && xFields->hasByName(aFieldName)) - xField = *(::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)xFields->getByName(aFieldName).getValue(); + xFields->getByName(aFieldName) >>= xField; ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier = ::dbtools::getNumberFormats(xConnection, sal_False); if (!xSupplier.is()) |