From 0d4720d1e1ffcefc43ae2af59c7487ab0bfab2ce Mon Sep 17 00:00:00 2001 From: Norbert Thiebaud Date: Sun, 21 Aug 2011 18:12:16 -0500 Subject: undo anything not wizard related in the previous merge-commit --- forms/source/component/Columns.cxx | 30 +++++----- forms/source/component/DatabaseForm.cxx | 91 ++++++++++++++++--------------- forms/source/component/Edit.cxx | 62 ++++++++++----------- forms/source/component/Edit.hxx | 1 - forms/source/component/Filter.cxx | 34 +++++++++--- forms/source/component/FormattedField.cxx | 4 +- 6 files changed, 120 insertions(+), 102 deletions(-) (limited to 'forms/source/component') diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx index 9bc330360e56..d75ef8b5df68 100644 --- a/forms/source/component/Columns.cxx +++ b/forms/source/component/Columns.cxx @@ -42,13 +42,15 @@ #include #include #include +#include #include #include #include +#include +#include #include "services.hxx" #include "frm_resource.hrc" #include -#include #include //......................................................................... @@ -63,6 +65,7 @@ using namespace ::com::sun::star::awt; using namespace ::com::sun::star::io; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::util; +using namespace ::com::sun::star::text; using namespace ::com::sun::star::form::binding; const sal_uInt16 WIDTH = 0x0001; @@ -121,21 +124,14 @@ sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName) /*************************************************************************/ -//------------------------------------------------------------------ +namespace +{ + class theOGridColumnImplementationId : public rtl::Static< UnoTunnelIdInit, theOGridColumnImplementationId > {}; +} + const Sequence& OGridColumn::getUnoTunnelImplementationId() { - static Sequence< sal_Int8 > * pSeq = 0; - if( !pSeq ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pSeq ) - { - static Sequence< sal_Int8 > aSeq( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - pSeq = &aSeq; - } - } - return *pSeq; + return theOGridColumnImplementationId::get().getSeq(); } //------------------------------------------------------------------ @@ -173,6 +169,7 @@ Sequence SAL_CALL OGridColumn::getTypes() throw(RuntimeException) aTypes.removeType( XServiceInfo::static_type() ); aTypes.removeType( XBindableValue::static_type() ); aTypes.removeType( XPropertyContainer::static_type() ); + // but re-add their base class(es) aTypes.addType( XChild::static_type() ); @@ -180,6 +177,10 @@ Sequence SAL_CALL OGridColumn::getTypes() throw(RuntimeException) if ( query_aggregation( m_xAggregate, xProv )) aTypes.addTypes( xProv->getTypes() ); + aTypes.removeType( XTextRange::static_type() ); + aTypes.removeType( XSimpleText::static_type() ); + aTypes.removeType( XText::static_type() ); + return aTypes.getTypes(); } @@ -192,6 +193,7 @@ Any SAL_CALL OGridColumn::queryAggregation( const Type& _rType ) throw (RuntimeE || _rType.equals(::getCppuType(static_cast< Reference< XServiceInfo >* >(NULL))) || _rType.equals(::getCppuType(static_cast< Reference< XBindableValue >* >(NULL))) || _rType.equals(::getCppuType(static_cast< Reference< XPropertyContainer >* >(NULL))) + || comphelper::isAssignableFrom(::getCppuType(static_cast< Reference< XTextRange >* >(NULL)),_rType) ) return aReturn; diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 78fa5df14c25..c09e9f6cf3b9 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -163,7 +163,7 @@ private: if ( m_xDocumentModify.is() ) _enable ? m_xDocumentModify->enableSetModified() : m_xDocumentModify->disableSetModified(); } - catch( const Exception& ) + catch(const Exception&) { DBG_UNHANDLED_EXCEPTION(); } @@ -410,7 +410,7 @@ ODatabaseForm::ODatabaseForm( const ODatabaseForm& _cloneSource ) setPropertyValue( pSourceProperty->Name, xSourceProps->getPropertyValue( pSourceProperty->Name ) ); } } - catch( const Exception& ) + catch(const Exception&) { throw WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Could not clone the given database form." ) ), @@ -1173,7 +1173,7 @@ bool ODatabaseForm::hasValidParent() const // the parent form is loaded and on a "virtual" row -> not valid return false; } - catch(Exception&) + catch(const Exception&) { // parent could be forwardonly? return false; @@ -1261,11 +1261,10 @@ sal_Bool ODatabaseForm::executeRowSet(::osl::ResettableMutexGuard& _rClearForNot m_xAggregateAsRowSet->execute(); bSuccess = sal_True; } - catch( const RowSetVetoException& eVeto ) + catch(const RowSetVetoException&) { - (void)eVeto; } - catch(SQLException& eDb) + catch(const SQLException& eDb) { _rClearForNotifies.clear(); if (m_sCurrentErrorContext.getLength()) @@ -1307,7 +1306,7 @@ sal_Bool ODatabaseForm::executeRowSet(::osl::ResettableMutexGuard& _rClearForNot xUpdate->moveToInsertRow(); } } - catch(SQLException& eDB) + catch(const SQLException& eDB) { _rClearForNotifies.clear(); if (m_sCurrentErrorContext.getLength()) @@ -1750,7 +1749,9 @@ void ODatabaseForm::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const A { m_xAggregateSet->setPropertyValue(PROPERTY_DATASOURCE, rValue); } - catch(Exception&) { } + catch(const Exception&) + { + } } break; case PROPERTY_ID_TARGET_URL: @@ -2051,7 +2052,7 @@ void ODatabaseForm::reset_impl(bool _bAproveByListeners) if ( aDefault.hasValue() ) xColUpdate->updateObject( aDefault ); } - catch(Exception&) + catch(const Exception&) { DBG_UNHANDLED_EXCEPTION(); } @@ -2059,7 +2060,7 @@ void ODatabaseForm::reset_impl(bool _bAproveByListeners) } } } - catch(Exception&) + catch(const Exception&) { } @@ -2419,7 +2420,7 @@ void SAL_CALL ODatabaseForm::setParent(const InterfaceRef& Parent) throw ( ::com Reference< XPropertySet > xParentProperties( xParentForm, UNO_QUERY_THROW ); xParentProperties->removePropertyChangeListener( PROPERTY_ISNEW, this ); } - catch( const Exception& ) + catch(const Exception&) { DBG_UNHANDLED_EXCEPTION(); } @@ -2441,7 +2442,7 @@ void SAL_CALL ODatabaseForm::setParent(const InterfaceRef& Parent) throw ( ::com Reference< XPropertySet > xParentProperties( xParentForm, UNO_QUERY_THROW ); xParentProperties->addPropertyChangeListener( PROPERTY_ISNEW, this ); } - catch( const Exception& ) + catch(const Exception&) { DBG_UNHANDLED_EXCEPTION(); } @@ -2871,11 +2872,11 @@ sal_Bool ODatabaseForm::implEnsureConnection() return xConnection.is(); } } - catch(SQLException& eDB) + catch(const SQLException& eDB) { onError(eDB, FRM_RES_STRING(RID_STR_CONNECTERROR)); } - catch( Exception ) + catch(const Exception&) { DBG_UNHANDLED_EXCEPTION(); } @@ -2904,7 +2905,7 @@ void ODatabaseForm::load_impl(sal_Bool bCausedByParentForm, sal_Bool bMoveToFirs // a database form always uses caching // we use starting fetchsize with at least 10 rows if (bConnected) - m_xAggregateSet->setPropertyValue(PROPERTY_FETCHSIZE, makeAny((sal_Int32)10)); + m_xAggregateSet->setPropertyValue(PROPERTY_FETCHSIZE, makeAny((sal_Int32)40)); // if we're loaded as sub form we got a "rowSetChanged" from the parent rowset _before_ we got the "loaded" // so we don't need to execute the statement again, this was already done @@ -2962,9 +2963,8 @@ void SAL_CALL ODatabaseForm::unload() throw( RuntimeException ) if (xCloseable.is()) xCloseable->close(); } - catch( const SQLException& e ) + catch(const SQLException&) { - (void)e; } aGuard.reset(); } @@ -3020,10 +3020,9 @@ void ODatabaseForm::reload_impl(sal_Bool bMoveToFirst, const Reference< XInterac m_sCurrentErrorContext = FRM_RES_STRING(RID_ERR_REFRESHING_FORM); bSuccess = executeRowSet(aGuard, bMoveToFirst, _rxCompletionHandler); } - catch( const SQLException& e ) + catch(const SQLException&) { OSL_FAIL("ODatabaseForm::reload_impl : shouldn't executeRowSet catch this exception?"); - (void)e; } if (bSuccess) @@ -3122,19 +3121,22 @@ bool ODatabaseForm::impl_approveRowChange_throw( const EventObject& _rEvent, con if ( !xListener->approveRowSetChange( _rEvent ) ) return false; } - catch ( const DisposedException& e ) + catch (const DisposedException& e) { if ( e.Context == xListener ) aIter.remove(); } - catch ( const RuntimeException& ) { throw; } - catch ( const SQLException& ) + catch (const RuntimeException&) + { + throw; + } + catch (const SQLException&) { if ( _bAllowSQLException ) throw; DBG_UNHANDLED_EXCEPTION(); } - catch ( const Exception& ) + catch (const Exception&) { DBG_UNHANDLED_EXCEPTION(); } @@ -3163,13 +3165,16 @@ sal_Bool SAL_CALL ODatabaseForm::approveCursorMove(const EventObject& event) thr if ( !xListener->approveCursorMove( event ) ) return sal_False; } - catch ( const DisposedException& e ) + catch (const DisposedException& e) { if ( e.Context == xListener ) aIter.remove(); } - catch ( const RuntimeException& ) { throw; } - catch ( const Exception& ) + catch (const RuntimeException&) + { + throw; + } + catch (const Exception&) { DBG_UNHANDLED_EXCEPTION(); } @@ -3209,13 +3214,16 @@ sal_Bool SAL_CALL ODatabaseForm::approveRowChange(const RowChangeEvent& event) t if ( !xListener->approveRowChange( event ) ) return false; } - catch ( const DisposedException& e ) + catch (const DisposedException& e) { if ( e.Context == xListener ) aIter.remove(); } - catch ( const RuntimeException& ) { throw; } - catch ( const Exception& ) + catch (const RuntimeException&) + { + throw; + } + catch (const Exception&) { DBG_UNHANDLED_EXCEPTION(); } @@ -3499,12 +3507,11 @@ void SAL_CALL ODatabaseForm::insertRow() throw( SQLException, RuntimeException ) if (query_aggregation( m_xAggregate, xUpdate)) xUpdate->insertRow(); } - catch( const RowSetVetoException& eVeto ) + catch(const RowSetVetoException&) { - (void)eVeto; throw; } - catch(SQLException& eDb) + catch(const SQLException& eDb) { onError(eDb, FRM_RES_STRING(RID_STR_ERR_INSERTRECORD)); throw; @@ -3520,12 +3527,11 @@ void SAL_CALL ODatabaseForm::updateRow() throw( SQLException, RuntimeException ) if (query_aggregation( m_xAggregate, xUpdate)) xUpdate->updateRow(); } - catch( const RowSetVetoException& eVeto ) + catch(const RowSetVetoException&) { - (void)eVeto; throw; } - catch(SQLException& eDb) + catch(const SQLException& eDb) { onError(eDb, FRM_RES_STRING(RID_STR_ERR_UPDATERECORD)); throw; @@ -3541,12 +3547,11 @@ void SAL_CALL ODatabaseForm::deleteRow() throw( SQLException, RuntimeException ) if (query_aggregation( m_xAggregate, xUpdate)) xUpdate->deleteRow(); } - catch( const RowSetVetoException& eVeto ) + catch(const RowSetVetoException&) { - (void)eVeto; throw; } - catch(SQLException& eDb) + catch(const SQLException& eDb) { onError(eDb, FRM_RES_STRING(RID_STR_ERR_DELETERECORD)); throw; @@ -3562,12 +3567,11 @@ void SAL_CALL ODatabaseForm::cancelRowUpdates() throw( SQLException, RuntimeExce if (query_aggregation( m_xAggregate, xUpdate)) xUpdate->cancelRowUpdates(); } - catch( const RowSetVetoException& eVeto ) + catch(const RowSetVetoException&) { - (void)eVeto; throw; } - catch(SQLException& eDb) + catch(const SQLException& eDb) { onError(eDb, FRM_RES_STRING(RID_STR_ERR_INSERTRECORD)); throw; @@ -3627,12 +3631,11 @@ Sequence SAL_CALL ODatabaseForm::deleteRows(const Sequence& rows if (query_aggregation( m_xAggregate, xDelete)) return xDelete->deleteRows(rows); } - catch( const RowSetVetoException& eVeto ) + catch(const RowSetVetoException&) { - (void)eVeto; // make compiler happy throw; } - catch(SQLException& eDb) + catch(const SQLException& eDb) { onError(eDb, FRM_RES_STRING(RID_STR_ERR_DELETERECORDS)); throw; diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx index d745a1b3837a..7d2fa43756f5 100644 --- a/forms/source/component/Edit.cxx +++ b/forms/source/component/Edit.cxx @@ -485,7 +485,7 @@ namespace { _rxDest->setPropertyValue( pSourceProps->Name, _rxSource->getPropertyValue( pSourceProps->Name ) ); } - catch( IllegalArgumentException e ) + catch(const IllegalArgumentException& e) { #if OSL_DEBUG_LEVEL > 0 ::rtl::OString sMessage( "could not transfer the property named '" ); @@ -497,6 +497,8 @@ namespace sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US ); } OSL_FAIL( sMessage.getStr() ); +#else + (void)e; #endif } @@ -675,7 +677,6 @@ sal_Bool OEditModel::approveDbColumnType( sal_Int32 _nColumnType ) void OEditModel::resetNoBroadcast() { OEditBaseModel::resetNoBroadcast(); - m_aLastKnownValue.clear(); } //------------------------------------------------------------------------------ @@ -683,38 +684,34 @@ sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) { Any aNewValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) ); - if ( aNewValue != m_aLastKnownValue ) - { - ::rtl::OUString sNewValue; - aNewValue >>= sNewValue; + ::rtl::OUString sNewValue; + aNewValue >>= sNewValue; - if ( !aNewValue.hasValue() - || ( !sNewValue.getLength() // an empty string - && m_bEmptyIsNull // which should be interpreted as NULL - ) + if ( !aNewValue.hasValue() + || ( !sNewValue.getLength() // an empty string + && m_bEmptyIsNull // which should be interpreted as NULL ) + ) + { + m_xColumnUpdate->updateNull(); + } + else + { + OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::commitControlValueToDbColumn: no value formatter!" ); + try { - m_xColumnUpdate->updateNull(); - } - else - { - OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::commitControlValueToDbColumn: no value formatter!" ); - try + if ( m_pValueFormatter.get() ) { - if ( m_pValueFormatter.get() ) - { - if ( !m_pValueFormatter->setFormattedValue( sNewValue ) ) - return sal_False; - } - else - m_xColumnUpdate->updateString( sNewValue ); - } - catch ( const Exception& ) - { - return sal_False; + if ( !m_pValueFormatter->setFormattedValue( sNewValue ) ) + return sal_False; } + else + m_xColumnUpdate->updateString( sNewValue ); + } + catch ( const Exception& ) + { + return sal_False; } - m_aLastKnownValue = aNewValue; } return sal_True; @@ -724,6 +721,7 @@ sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) Any OEditModel::translateDbColumnToControlValue() { OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::translateDbColumnToControlValue: no value formatter!" ); + Any aRet; if ( m_pValueFormatter.get() ) { ::rtl::OUString sValue( m_pValueFormatter->getFormattedValue() ); @@ -732,7 +730,6 @@ Any OEditModel::translateDbColumnToControlValue() && m_pValueFormatter->getColumn()->wasNull() ) { - m_aLastKnownValue.clear(); } else { @@ -744,14 +741,11 @@ Any OEditModel::translateDbColumnToControlValue() sValue = sValue.replaceAt( nMaxTextLen, nDiff, ::rtl::OUString() ); } - m_aLastKnownValue <<= sValue; + aRet <<= sValue; } } - else - m_aLastKnownValue.clear(); - return m_aLastKnownValue.hasValue() ? m_aLastKnownValue : makeAny( ::rtl::OUString() ); - // (m_aLastKnownValue is alllowed to be VOID, the control value isn't) + return aRet.hasValue() ? aRet : makeAny( ::rtl::OUString() ); } //------------------------------------------------------------------------------ diff --git a/forms/source/component/Edit.hxx b/forms/source/component/Edit.hxx index e3c84612443f..bbe7063c66f1 100644 --- a/forms/source/component/Edit.hxx +++ b/forms/source/component/Edit.hxx @@ -45,7 +45,6 @@ namespace frm class OEditModel :public OEditBaseModel { - ::com::sun::star::uno::Any m_aLastKnownValue; ::std::auto_ptr< ::dbtools::FormattedColumnValue > m_pValueFormatter; sal_Bool m_bMaxTextLenModified : 1; // set to when we change the MaxTextLen of the aggregate diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx index 69643053bed8..4decc560fa4b 100644 --- a/forms/source/component/Filter.cxx +++ b/forms/source/component/Filter.cxx @@ -631,19 +631,39 @@ namespace frm if (xListBox.is()) { m_aText = aText; - xListBox->selectItem(m_aText, sal_True); - if ( xListBox->getSelectedItemPos() >= 0 ) + MapString2String::const_iterator itemPos = m_aDisplayItemToValueItem.find( m_aText ); + if ( itemPos == m_aDisplayItemToValueItem.end() ) { - const bool isQuoted = ( aText.getLength() > 0 ) - && ( aText[0] == '\'' ) - && ( aText[aText.getLength() - 1] == '\'' ); + const bool isQuoted = ( m_aText.getLength() > 1 ) + && ( m_aText[0] == '\'' ) + && ( m_aText[ m_aText.getLength() - 1 ] == '\'' ); if ( isQuoted ) { - xListBox->selectItem( aText.copy( 1, aText.getLength() - 2 ), sal_True ); + m_aText = m_aText.copy( 1, m_aText.getLength() - 2 ); + itemPos = m_aDisplayItemToValueItem.find( m_aText ); } } + + OSL_ENSURE( ( itemPos != m_aDisplayItemToValueItem.end() ) || ( m_aText.getLength() == 0 ), + "OFilterControl::setText: this text is not in my display list!" ); + if ( itemPos == m_aDisplayItemToValueItem.end() ) + m_aText = ::rtl::OUString(); + + if ( m_aText.getLength() == 0) + { + while ( xListBox->getSelectedItemPos() >= 0 ) + { + xListBox->selectItemPos( xListBox->getSelectedItemPos(), sal_False ); + } + } + else + { + xListBox->selectItem( m_aText, sal_True ); + } } - } break; + } + break; + default: { Reference< XTextComponent > xText( getPeer(), UNO_QUERY ); diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index 871385c207a6..9d0170078da1 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -1038,10 +1038,10 @@ sal_Bool OFormattedModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) m_xColumnUpdate->updateNull(); else { - // als Value koennen nur double, string oder void auftreten try { - if ( aControlValue.getValueType().getTypeClass() == TypeClass_DOUBLE ) + double f = 0.0; + if ( aControlValue.getValueType().getTypeClass() == TypeClass_DOUBLE || (aControlValue >>= f)) // #i110323 { DBTypeConversion::setValue( m_xColumnUpdate, m_aNullDate, getDouble( aControlValue ), m_nKeyType ); } -- cgit ue='feature/spellig_popup_SID'>feature/spellig_popup_SID LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2017-01-25Fix typo in comments: relativ -> relativeTakeshi Abe
2016-09-20cid#1371306: Add move semanticsStephan Bergmann
2016-09-12loplugin:constantparam in package..stocNoel Grandin
2016-07-13Remove __cplusplus-checks from apparently-C++-only filesStephan Bergmann
2016-07-04remove deprecated Link functions from RegistryNoel Grandin
2016-03-17loplugin:constantparam in registryNoel Grandin
2016-02-23new loplugin: commaoperatorNoel Grandin
2016-02-09Remove excess newlinesChris Sherlock
2016-01-10Fix typosAndrea Gelmini
2015-12-10loplugin:nullptr: More NULL -> nullptr automatic rewriteStephan Bergmann
2015-11-25loplugin:unusedfields in include/package,include/registryNoel Grandin
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann
2015-07-30loplugin:unusedmethodsNoel Grandin
2015-07-02loplugin:unusedmethods registry,storeNoel Grandin
2015-04-15remove unnecessary use of void in function declarationsNoel Grandin
2015-04-09convert RegError to scoped enumNoel Grandin
2015-04-09convert RegValueType to scoped enumNoel Grandin
2015-04-09remove reg keytype constants and related codeNoel Grandin
2015-04-09convert REG_ constants to scoped enumNoel Grandin
2015-03-19loplugin:constantfunction: registryNoel Grandin
2015-02-23remove unnecessary parenthesis in return statementsNoel Grandin
2014-03-01Remove visual noise from includeAlexander Wilms
2014-02-17registry: sal_Bool -> boolStephan Bergmann
2013-12-18URE headers do not have "using rtl::OUString"Stephan Bergmann
2013-10-23fixincludeguards.sh: include - the restThomas Arnhold
2013-04-23execute move of global headersBjoern Michaelsen