[Libreoffice-commits] core.git: dbaccess/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 15 07:39:44 UTC 2020
dbaccess/source/core/api/BookmarkSet.cxx | 136 +--
dbaccess/source/core/api/CacheSet.cxx | 54 -
dbaccess/source/core/api/KeySet.cxx | 24
dbaccess/source/core/api/RowSet.cxx | 238 ++---
dbaccess/source/core/api/RowSetCache.cxx | 60 -
dbaccess/source/core/api/StaticSet.cxx | 22
dbaccess/source/core/api/WrappedResultSet.cxx | 136 +--
dbaccess/source/core/api/definitioncolumn.cxx | 26
dbaccess/source/core/api/tablecontainer.cxx | 24
dbaccess/source/core/api/viewcontainer.cxx | 82 +-
dbaccess/source/core/dataaccess/ContentHelper.cxx | 90 +-
dbaccess/source/core/dataaccess/ModelImpl.cxx | 24
dbaccess/source/core/dataaccess/databasedocument.cxx | 48 -
dbaccess/source/core/dataaccess/datasource.cxx | 214 ++---
dbaccess/source/core/dataaccess/definitioncontainer.cxx | 38
dbaccess/source/core/dataaccess/documentdefinition.cxx | 52 -
dbaccess/source/core/misc/ContainerMediator.cxx | 74 -
dbaccess/source/filter/xml/xmlAutoStyle.cxx | 34
dbaccess/source/filter/xml/xmlComponent.cxx | 36
dbaccess/source/filter/xml/xmlConnectionResource.cxx | 76 -
dbaccess/source/filter/xml/xmlDataSource.cxx | 52 -
dbaccess/source/filter/xml/xmlDataSourceInfo.cxx | 34
dbaccess/source/filter/xml/xmlExport.cxx | 232 ++---
dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx | 22
dbaccess/source/filter/xml/xmlHierarchyCollection.cxx | 36
dbaccess/source/filter/xml/xmlLogin.cxx | 106 +-
dbaccess/source/filter/xml/xmlServerDatabase.cxx | 84 +-
dbaccess/source/filter/xml/xmlTable.cxx | 38
dbaccess/source/ui/app/AppController.cxx | 150 +--
dbaccess/source/ui/app/AppControllerDnD.cxx | 324 ++++----
dbaccess/source/ui/app/AppControllerGen.cxx | 200 ++---
dbaccess/source/ui/app/AppDetailPageHelper.cxx | 482 ++++++------
dbaccess/source/ui/app/AppView.cxx | 48 -
dbaccess/source/ui/browser/brwctrlr.cxx | 124 +--
dbaccess/source/ui/browser/dataview.cxx | 32
dbaccess/source/ui/browser/dsEntriesNoExp.cxx | 84 +-
dbaccess/source/ui/browser/exsrcbrw.cxx | 53 -
dbaccess/source/ui/browser/formadapter.cxx | 46 -
dbaccess/source/ui/browser/sbagrid.cxx | 300 +++----
dbaccess/source/ui/browser/unodatbr.cxx | 92 +-
dbaccess/source/ui/control/FieldDescControl.cxx | 34
dbaccess/source/ui/control/RelationControl.cxx | 20
dbaccess/source/ui/control/TableGrantCtrl.cxx | 44 -
dbaccess/source/ui/control/sqledit.cxx | 22
dbaccess/source/ui/dlg/ConnectionPage.cxx | 50 -
dbaccess/source/ui/dlg/DbAdminImpl.cxx | 28
dbaccess/source/ui/dlg/adminpages.cxx | 88 +-
dbaccess/source/ui/dlg/dbfindex.cxx | 26
dbaccess/source/ui/dlg/generalpage.cxx | 148 +--
dbaccess/source/ui/dlg/indexdialog.cxx | 34
dbaccess/source/ui/dlg/indexfieldscontrol.cxx | 53 -
dbaccess/source/ui/dlg/odbcconfig.cxx | 30
dbaccess/source/ui/dlg/queryfilter.cxx | 36
dbaccess/source/ui/dlg/sqlmessage.cxx | 22
dbaccess/source/ui/misc/DExport.cxx | 334 ++++----
dbaccess/source/ui/misc/UITools.cxx | 516 ++++++-------
dbaccess/source/ui/misc/WCopyTable.cxx | 158 +--
dbaccess/source/ui/misc/WNameMatch.cxx | 80 +-
dbaccess/source/ui/misc/indexcollection.cxx | 86 +-
dbaccess/source/ui/querydesign/JoinController.cxx | 42 -
dbaccess/source/ui/querydesign/JoinTableView.cxx | 118 +-
dbaccess/source/ui/querydesign/QueryDesignView.cxx | 46 -
dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx | 30
dbaccess/source/ui/querydesign/QueryTableView.cxx | 88 +-
dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx | 138 +--
dbaccess/source/ui/querydesign/TableFieldDescription.cxx | 28
dbaccess/source/ui/querydesign/TableWindow.cxx | 46 -
dbaccess/source/ui/querydesign/TableWindowData.cxx | 32
dbaccess/source/ui/querydesign/TableWindowTitle.cxx | 40 -
dbaccess/source/ui/querydesign/limitboxcontroller.cxx | 24
dbaccess/source/ui/querydesign/querycontainerwindow.cxx | 70 -
dbaccess/source/ui/querydesign/querycontroller.cxx | 170 ++--
dbaccess/source/ui/querydesign/querydlg.cxx | 36
dbaccess/source/ui/relationdesign/RTableConnectionData.cxx | 32
dbaccess/source/ui/relationdesign/RelationController.cxx | 108 +-
dbaccess/source/ui/tabledesign/FieldDescriptions.cxx | 298 +++----
dbaccess/source/ui/tabledesign/TableController.cxx | 60 -
dbaccess/source/ui/uno/ColumnControl.cxx | 106 +-
dbaccess/source/ui/uno/ColumnPeer.cxx | 70 -
79 files changed, 3710 insertions(+), 3708 deletions(-)
New commits:
commit 598a65a3c1632c24f2aac38c5a2c9f6a55618cd6
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Apr 15 08:56:07 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Apr 15 09:39:03 2020 +0200
loplugin:flatten in dbaccess
Change-Id: Ifcfd3637fbce6dc3a07a1859f102a6ac85149190
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92237
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/dbaccess/source/core/api/BookmarkSet.cxx b/dbaccess/source/core/api/BookmarkSet.cxx
index 2caf911a67f7..b21d7cbbb666 100644
--- a/dbaccess/source/core/api/BookmarkSet.cxx
+++ b/dbaccess/source/core/api/BookmarkSet.cxx
@@ -126,77 +126,77 @@ void OBookmarkSet::deleteRow(const ORowSetRow& /*_rDeleteRow*/ ,const connectivi
void OBookmarkSet::updateColumn(sal_Int32 nPos, const Reference< XRowUpdate >& _xParameter, const ORowSetValue& _rValue)
{
- if(_rValue.isBound() && _rValue.isModified())
+ if(!(_rValue.isBound() && _rValue.isModified()))
+ return;
+
+ if(_rValue.isNull())
+ _xParameter->updateNull(nPos);
+ else
{
- if(_rValue.isNull())
- _xParameter->updateNull(nPos);
- else
- {
- switch(_rValue.getTypeKind())
- {
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- _xParameter->updateNumericObject(nPos,_rValue.makeAny(),m_xSetMetaData->getScale(nPos));
- break;
- case DataType::CHAR:
- case DataType::VARCHAR:
+ switch(_rValue.getTypeKind())
+ {
+ case DataType::DECIMAL:
+ case DataType::NUMERIC:
+ _xParameter->updateNumericObject(nPos,_rValue.makeAny(),m_xSetMetaData->getScale(nPos));
+ break;
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ _xParameter->updateString(nPos,_rValue);
+ break;
+ case DataType::BIGINT:
+ if ( _rValue.isSigned() )
+ _xParameter->updateLong(nPos,_rValue);
+ else
_xParameter->updateString(nPos,_rValue);
- break;
- case DataType::BIGINT:
- if ( _rValue.isSigned() )
- _xParameter->updateLong(nPos,_rValue);
- else
- _xParameter->updateString(nPos,_rValue);
- break;
- case DataType::BIT:
- case DataType::BOOLEAN:
- _xParameter->updateBoolean(nPos,bool(_rValue));
- break;
- case DataType::TINYINT:
- if ( _rValue.isSigned() )
- _xParameter->updateByte(nPos,_rValue);
- else
- _xParameter->updateShort(nPos,_rValue);
- break;
- case DataType::SMALLINT:
- if ( _rValue.isSigned() )
- _xParameter->updateShort(nPos,_rValue);
- else
- _xParameter->updateInt(nPos,_rValue);
- break;
- case DataType::INTEGER:
- if ( _rValue.isSigned() )
- _xParameter->updateInt(nPos,_rValue);
- else
- _xParameter->updateLong(nPos,_rValue);
- break;
- case DataType::FLOAT:
- _xParameter->updateFloat(nPos,_rValue);
- break;
- case DataType::DOUBLE:
- case DataType::REAL:
- _xParameter->updateDouble(nPos,_rValue);
- break;
- case DataType::DATE:
- _xParameter->updateDate(nPos,_rValue);
- break;
- case DataType::TIME:
- _xParameter->updateTime(nPos,_rValue);
- break;
- case DataType::TIMESTAMP:
- _xParameter->updateTimestamp(nPos,_rValue);
- break;
- case DataType::BINARY:
- case DataType::VARBINARY:
- case DataType::LONGVARBINARY:
- _xParameter->updateBytes(nPos,_rValue);
- break;
- case DataType::BLOB:
- case DataType::CLOB:
- _xParameter->updateObject(nPos,_rValue.getAny());
- break;
- }
+ break;
+ case DataType::BIT:
+ case DataType::BOOLEAN:
+ _xParameter->updateBoolean(nPos,bool(_rValue));
+ break;
+ case DataType::TINYINT:
+ if ( _rValue.isSigned() )
+ _xParameter->updateByte(nPos,_rValue);
+ else
+ _xParameter->updateShort(nPos,_rValue);
+ break;
+ case DataType::SMALLINT:
+ if ( _rValue.isSigned() )
+ _xParameter->updateShort(nPos,_rValue);
+ else
+ _xParameter->updateInt(nPos,_rValue);
+ break;
+ case DataType::INTEGER:
+ if ( _rValue.isSigned() )
+ _xParameter->updateInt(nPos,_rValue);
+ else
+ _xParameter->updateLong(nPos,_rValue);
+ break;
+ case DataType::FLOAT:
+ _xParameter->updateFloat(nPos,_rValue);
+ break;
+ case DataType::DOUBLE:
+ case DataType::REAL:
+ _xParameter->updateDouble(nPos,_rValue);
+ break;
+ case DataType::DATE:
+ _xParameter->updateDate(nPos,_rValue);
+ break;
+ case DataType::TIME:
+ _xParameter->updateTime(nPos,_rValue);
+ break;
+ case DataType::TIMESTAMP:
+ _xParameter->updateTimestamp(nPos,_rValue);
+ break;
+ case DataType::BINARY:
+ case DataType::VARBINARY:
+ case DataType::LONGVARBINARY:
+ _xParameter->updateBytes(nPos,_rValue);
+ break;
+ case DataType::BLOB:
+ case DataType::CLOB:
+ _xParameter->updateObject(nPos,_rValue.getAny());
+ break;
}
}
}
diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx
index b8877358e604..bb50f281d1c3 100644
--- a/dbaccess/source/core/api/CacheSet.cxx
+++ b/dbaccess/source/core/api/CacheSet.cxx
@@ -76,37 +76,37 @@ void OCacheSet::construct( const Reference< XResultSet>& _xDriverSet,const OUSt
m_sRowSetFilter = i_sRowSetFilter;
- if(_xDriverSet.is())
+ if(!_xDriverSet.is())
+ return;
+
+ m_xDriverSet = _xDriverSet;
+ m_xDriverRow.set(_xDriverSet,UNO_QUERY);
+ m_xSetMetaData = Reference<XResultSetMetaDataSupplier>(_xDriverSet,UNO_QUERY_THROW)->getMetaData();
+ if ( m_xSetMetaData.is() )
{
- m_xDriverSet = _xDriverSet;
- m_xDriverRow.set(_xDriverSet,UNO_QUERY);
- m_xSetMetaData = Reference<XResultSetMetaDataSupplier>(_xDriverSet,UNO_QUERY_THROW)->getMetaData();
- if ( m_xSetMetaData.is() )
- {
- const sal_Int32 nCount = m_xSetMetaData->getColumnCount();
- m_aNullable.resize(nCount);
- m_aSignedFlags.resize(nCount);
- m_aColumnTypes.resize(nCount);
- auto pNullableIter = m_aNullable.begin();
- auto pSignedIter = m_aSignedFlags.begin();
- auto pColumnIter = m_aColumnTypes.begin();
- for (sal_Int32 i=1; i <= nCount; ++i,++pSignedIter,++pColumnIter,++pNullableIter)
- {
- *pNullableIter = m_xSetMetaData->isNullable(i) != ColumnValue::NO_NULLS;
- *pSignedIter = m_xSetMetaData->isSigned(i);
- *pColumnIter = m_xSetMetaData->getColumnType(i);
- }
- }
- Reference< XStatement> xStmt(m_xDriverSet->getStatement(),UNO_QUERY);
- if(xStmt.is())
- m_xConnection = xStmt->getConnection();
- else
+ const sal_Int32 nCount = m_xSetMetaData->getColumnCount();
+ m_aNullable.resize(nCount);
+ m_aSignedFlags.resize(nCount);
+ m_aColumnTypes.resize(nCount);
+ auto pNullableIter = m_aNullable.begin();
+ auto pSignedIter = m_aSignedFlags.begin();
+ auto pColumnIter = m_aColumnTypes.begin();
+ for (sal_Int32 i=1; i <= nCount; ++i,++pSignedIter,++pColumnIter,++pNullableIter)
{
- Reference< XPreparedStatement> xPrepStmt(m_xDriverSet->getStatement(),UNO_QUERY);
- if ( xPrepStmt.is() )
- m_xConnection = xPrepStmt->getConnection();
+ *pNullableIter = m_xSetMetaData->isNullable(i) != ColumnValue::NO_NULLS;
+ *pSignedIter = m_xSetMetaData->isSigned(i);
+ *pColumnIter = m_xSetMetaData->getColumnType(i);
}
}
+ Reference< XStatement> xStmt(m_xDriverSet->getStatement(),UNO_QUERY);
+ if(xStmt.is())
+ m_xConnection = xStmt->getConnection();
+ else
+ {
+ Reference< XPreparedStatement> xPrepStmt(m_xDriverSet->getStatement(),UNO_QUERY);
+ if ( xPrepStmt.is() )
+ m_xConnection = xPrepStmt->getConnection();
+ }
}
OCacheSet::~OCacheSet()
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index d50d9e850080..1e12ba40f7ec 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -68,19 +68,19 @@ namespace
{
void lcl_fillIndexColumns(const Reference<XIndexAccess>& _xIndexes, std::vector< Reference<XNameAccess> >& _rAllIndexColumns)
{
- if ( _xIndexes.is() )
+ if ( !_xIndexes.is() )
+ return;
+
+ Reference<XPropertySet> xIndexColsSup;
+ sal_Int32 nCount = _xIndexes->getCount();
+ for(sal_Int32 j = 0 ; j < nCount ; ++j)
{
- Reference<XPropertySet> xIndexColsSup;
- sal_Int32 nCount = _xIndexes->getCount();
- for(sal_Int32 j = 0 ; j < nCount ; ++j)
- {
- xIndexColsSup.set(_xIndexes->getByIndex(j),UNO_QUERY);
- if( xIndexColsSup.is()
- && comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISUNIQUE))
- && !comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISPRIMARYKEYINDEX))
- )
- _rAllIndexColumns.push_back(Reference<XColumnsSupplier>(xIndexColsSup,UNO_QUERY_THROW)->getColumns());
- }
+ xIndexColsSup.set(_xIndexes->getByIndex(j),UNO_QUERY);
+ if( xIndexColsSup.is()
+ && comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISUNIQUE))
+ && !comphelper::getBOOL(xIndexColsSup->getPropertyValue(PROPERTY_ISPRIMARYKEYINDEX))
+ )
+ _rAllIndexColumns.push_back(Reference<XColumnsSupplier>(xIndexColsSup,UNO_QUERY_THROW)->getColumns());
}
}
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index bd3314082088..f652dc0e60cd 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -532,41 +532,41 @@ void ORowSet::freeResources( bool _bComplete )
m_bLastKnownRowCountFinal = false;
m_nLastKnownRowCount = 0;
- if ( _bComplete )
- {
- // the columns must be disposed before the querycomposer is disposed because
- // their owner can be the composer
- TDataColumns().swap(m_aDataColumns);// clear and resize capacity
- std::vector<bool>().swap(m_aReadOnlyDataColumns);
-
- m_xColumns = nullptr;
- if ( m_pColumns )
- m_pColumns->disposing();
- // dispose the composer to avoid that everybody knows that the querycomposer is eol
- try { ::comphelper::disposeComponent( m_xComposer ); }
- catch(Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- m_xComposer = nullptr;
- }
+ if ( !_bComplete )
+ return;
- // let our warnings container forget the reference to the (possibly disposed) old result set
- m_aWarnings.setExternalWarnings( nullptr );
+ // the columns must be disposed before the querycomposer is disposed because
+ // their owner can be the composer
+ TDataColumns().swap(m_aDataColumns);// clear and resize capacity
+ std::vector<bool>().swap(m_aReadOnlyDataColumns);
+
+ m_xColumns = nullptr;
+ if ( m_pColumns )
+ m_pColumns->disposing();
+ // dispose the composer to avoid that everybody knows that the querycomposer is eol
+ try { ::comphelper::disposeComponent( m_xComposer ); }
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ m_xComposer = nullptr;
+ }
- m_pCache.reset();
+ // let our warnings container forget the reference to the (possibly disposed) old result set
+ m_aWarnings.setExternalWarnings( nullptr );
- impl_resetTables_nothrow();
+ m_pCache.reset();
- m_xStatement = nullptr;
- m_xTypeMap = nullptr;
+ impl_resetTables_nothrow();
- if ( m_aOldRow.is() )
- m_aOldRow->clearRow();
+ m_xStatement = nullptr;
+ m_xTypeMap = nullptr;
- impl_disposeParametersContainer_nothrow();
+ if ( m_aOldRow.is() )
+ m_aOldRow->clearRow();
- m_bCommandFacetsDirty = true;
- }
+ impl_disposeParametersContainer_nothrow();
+
+ m_bCommandFacetsDirty = true;
}
void ORowSet::setActiveConnection( Reference< XConnection > const & _rxNewConn, bool _bFireEvent )
@@ -923,53 +923,53 @@ void SAL_CALL ORowSet::updateRow( )
throwFunctionSequenceException(*this);
- if(m_bModified)
- {
- ORowSetRow aOldValues;
- if ( !m_aCurrentRow.isNull() )
- aOldValues = new ORowSetValueVector( *(*m_aCurrentRow) );
-
- Sequence<Any> aChangedBookmarks;
- RowsChangeEvent aEvt(*this,RowChangeAction::UPDATE,1,aChangedBookmarks);
- notifyAllListenersRowBeforeChange(aGuard,aEvt);
-
- std::vector< Any > aBookmarks;
- m_pCache->updateRow(m_aCurrentRow.operator ->(),aBookmarks);
- if ( !aBookmarks.empty() )
- aEvt.Bookmarks = comphelper::containerToSequence(aBookmarks);
- aEvt.Rows += aBookmarks.size();
- m_aBookmark = m_pCache->getBookmark();
- m_aCurrentRow = m_pCache->m_aMatrixIter;
- m_bIsInsertRow = false;
- if ( m_pCache->m_aMatrixIter != m_pCache->getEnd() && (*m_pCache->m_aMatrixIter).is() )
- {
- if ( m_pCache->isResultSetChanged() )
- {
- impl_rebuild_throw(aGuard);
- }
- else
- {
- m_aOldRow->setRow(new ORowSetValueVector(*(*m_aCurrentRow)));
+ if(!m_bModified)
+ return;
- // notification order
- // - column values
- ORowSetBase::firePropertyChange(aOldValues);
- }
- // - rowChanged
- notifyAllListenersRowChanged(aGuard,aEvt);
+ ORowSetRow aOldValues;
+ if ( !m_aCurrentRow.isNull() )
+ aOldValues = new ORowSetValueVector( *(*m_aCurrentRow) );
- // - IsModified
- if(!m_bModified)
- fireProperty(PROPERTY_ID_ISMODIFIED,false,true);
- OSL_ENSURE( !m_bModified, "ORowSet::updateRow: just updated, but _still_ modified?" );
+ Sequence<Any> aChangedBookmarks;
+ RowsChangeEvent aEvt(*this,RowChangeAction::UPDATE,1,aChangedBookmarks);
+ notifyAllListenersRowBeforeChange(aGuard,aEvt);
- // - RowCount/IsRowCountFinal
- fireRowcount();
+ std::vector< Any > aBookmarks;
+ m_pCache->updateRow(m_aCurrentRow.operator ->(),aBookmarks);
+ if ( !aBookmarks.empty() )
+ aEvt.Bookmarks = comphelper::containerToSequence(aBookmarks);
+ aEvt.Rows += aBookmarks.size();
+ m_aBookmark = m_pCache->getBookmark();
+ m_aCurrentRow = m_pCache->m_aMatrixIter;
+ m_bIsInsertRow = false;
+ if ( m_pCache->m_aMatrixIter != m_pCache->getEnd() && (*m_pCache->m_aMatrixIter).is() )
+ {
+ if ( m_pCache->isResultSetChanged() )
+ {
+ impl_rebuild_throw(aGuard);
}
- else if ( !m_bAfterLast ) // the update went wrong
+ else
{
- ::dbtools::throwSQLException( DBA_RES( RID_STR_UPDATE_FAILED ), StandardSQLState::INVALID_CURSOR_POSITION, *this );
+ m_aOldRow->setRow(new ORowSetValueVector(*(*m_aCurrentRow)));
+
+ // notification order
+ // - column values
+ ORowSetBase::firePropertyChange(aOldValues);
}
+ // - rowChanged
+ notifyAllListenersRowChanged(aGuard,aEvt);
+
+ // - IsModified
+ if(!m_bModified)
+ fireProperty(PROPERTY_ID_ISMODIFIED,false,true);
+ OSL_ENSURE( !m_bModified, "ORowSet::updateRow: just updated, but _still_ modified?" );
+
+ // - RowCount/IsRowCountFinal
+ fireRowcount();
+ }
+ else if ( !m_bAfterLast ) // the update went wrong
+ {
+ ::dbtools::throwSQLException( DBA_RES( RID_STR_UPDATE_FAILED ), StandardSQLState::INVALID_CURSOR_POSITION, *this );
}
}
@@ -1156,55 +1156,55 @@ void SAL_CALL ORowSet::moveToInsertRow( )
if ( ( m_pCache->m_nPrivileges & Privilege::INSERT ) != Privilege::INSERT )
::dbtools::throwSQLException( DBA_RES( RID_STR_NO_INSERT_PRIVILEGE ), StandardSQLState::GENERAL_ERROR, *this );
- if ( notifyAllListenersCursorBeforeMove( aGuard ) )
+ if ( !notifyAllListenersCursorBeforeMove( aGuard ) )
+ return;
+
+ // remember old value for fire
+ ORowSetRow aOldValues;
+ if ( rowDeleted() )
{
- // remember old value for fire
- ORowSetRow aOldValues;
- if ( rowDeleted() )
- {
- positionCache( MOVE_FORWARD );
- m_pCache->next();
- setCurrentRow( true, false, aOldValues, aGuard);
- }
- else
- positionCache( MOVE_NONE );
+ positionCache( MOVE_FORWARD );
+ m_pCache->next();
+ setCurrentRow( true, false, aOldValues, aGuard);
+ }
+ else
+ positionCache( MOVE_NONE );
- // check before because the resultset could be empty
- if ( !m_bBeforeFirst
- && !m_bAfterLast
- && m_pCache->m_aMatrixIter != m_pCache->getEnd()
- && m_pCache->m_aMatrixIter->is()
- )
- aOldValues = new ORowSetValueVector( *(*(m_pCache->m_aMatrixIter)) );
+ // check before because the resultset could be empty
+ if ( !m_bBeforeFirst
+ && !m_bAfterLast
+ && m_pCache->m_aMatrixIter != m_pCache->getEnd()
+ && m_pCache->m_aMatrixIter->is()
+ )
+ aOldValues = new ORowSetValueVector( *(*(m_pCache->m_aMatrixIter)) );
- const bool bNewState = m_bNew;
- const bool bModState = m_bModified;
+ const bool bNewState = m_bNew;
+ const bool bModState = m_bModified;
- m_pCache->moveToInsertRow();
- m_aCurrentRow = m_pCache->m_aInsertRow;
- m_bIsInsertRow = true;
+ m_pCache->moveToInsertRow();
+ m_aCurrentRow = m_pCache->m_aInsertRow;
+ m_bIsInsertRow = true;
- // set read-only flag to false
- impl_setDataColumnsWriteable_throw();
+ // set read-only flag to false
+ impl_setDataColumnsWriteable_throw();
- // notification order
- // - column values
- ORowSetBase::firePropertyChange(aOldValues);
+ // notification order
+ // - column values
+ ORowSetBase::firePropertyChange(aOldValues);
- // - cursorMoved
- notifyAllListenersCursorMoved(aGuard);
+ // - cursorMoved
+ notifyAllListenersCursorMoved(aGuard);
- // - IsModified
- if ( bModState != m_bModified )
- fireProperty( PROPERTY_ID_ISMODIFIED, m_bModified, bModState );
+ // - IsModified
+ if ( bModState != m_bModified )
+ fireProperty( PROPERTY_ID_ISMODIFIED, m_bModified, bModState );
- // - IsNew
- if ( bNewState != m_bNew )
- fireProperty( PROPERTY_ID_ISNEW, m_bNew, bNewState );
+ // - IsNew
+ if ( bNewState != m_bNew )
+ fireProperty( PROPERTY_ID_ISNEW, m_bNew, bNewState );
- // - RowCount/IsRowCountFinal
- fireRowcount();
- }
+ // - RowCount/IsRowCountFinal
+ fireRowcount();
}
void ORowSet::impl_setDataColumnsWriteable_throw()
@@ -1254,20 +1254,20 @@ void SAL_CALL ORowSet::moveToCurrentRow( )
// check "if ( !m_pCache->m_bNew && !m_bModified )"
::dbtools::throwSQLException( DBA_RES( RID_STR_ROW_ALREADY_DELETED ), StandardSQLState::FUNCTION_SEQUENCE_ERROR, *this );
- if ( notifyAllListenersCursorBeforeMove( aGuard ) )
- {
- positionCache( MOVE_NONE_REFRESH );
+ if ( !notifyAllListenersCursorBeforeMove( aGuard ) )
+ return;
- ORowSetNotifier aNotifier( this );
+ positionCache( MOVE_NONE_REFRESH );
- // notification order
- // - cursorMoved
- notifyAllListenersCursorMoved(aGuard);
+ ORowSetNotifier aNotifier( this );
- // - IsModified
- // - IsNew
- aNotifier.fire();
- }
+ // notification order
+ // - cursorMoved
+ notifyAllListenersCursorMoved(aGuard);
+
+ // - IsModified
+ // - IsNew
+ aNotifier.fire();
}
// XRow
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index fdab6417f0e6..63cc6318aafc 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -693,22 +693,22 @@ void ORowSetCache::beforeFirst( )
void ORowSetCache::afterLast( )
{
- if(!m_bAfterLast)
- {
- m_bBeforeFirst = false;
- m_bAfterLast = true;
+ if(m_bAfterLast)
+ return;
- if(!m_bRowCountFinal)
- {
- m_xCacheSet->last();
- m_bRowCountFinal = true;
- m_nRowCount = m_xCacheSet->getRow();// + 1 removed
- }
- m_xCacheSet->afterLast();
+ m_bBeforeFirst = false;
+ m_bAfterLast = true;
- m_nPosition = 0;
- m_aMatrixIter = m_pMatrix->end();
+ if(!m_bRowCountFinal)
+ {
+ m_xCacheSet->last();
+ m_bRowCountFinal = true;
+ m_nRowCount = m_xCacheSet->getRow();// + 1 removed
}
+ m_xCacheSet->afterLast();
+
+ m_nPosition = 0;
+ m_aMatrixIter = m_pMatrix->end();
}
bool ORowSetCache::fillMatrix(sal_Int32& _nNewStartPos, sal_Int32 &_nNewEndPos)
@@ -1436,26 +1436,26 @@ void ORowSetCache::rotateCacheIterator(ORowSetMatrix::difference_type _nDist)
if (m_bModified)
return;
- if(_nDist)
+ if(!_nDist)
+ return;
+
+ // now correct the iterator in our iterator vector
+ for(auto& rCacheIter : m_aCacheIterators)
{
- // now correct the iterator in our iterator vector
- for(auto& rCacheIter : m_aCacheIterators)
+ if ( !rCacheIter.second.pRowSet->isInsertRow()
+ && rCacheIter.second.aIterator != m_pMatrix->end())
{
- if ( !rCacheIter.second.pRowSet->isInsertRow()
- && rCacheIter.second.aIterator != m_pMatrix->end())
+ ptrdiff_t nDist = rCacheIter.second.aIterator - m_pMatrix->begin();
+ if(nDist < _nDist)
{
- ptrdiff_t nDist = rCacheIter.second.aIterator - m_pMatrix->begin();
- if(nDist < _nDist)
- {
- rCacheIter.second.aIterator = m_pMatrix->end();
- }
- else
- {
- OSL_ENSURE((rCacheIter.second.aIterator - m_pMatrix->begin()) >= _nDist,"Invalid Dist value!");
- rCacheIter.second.aIterator -= _nDist;
- OSL_ENSURE(rCacheIter.second.aIterator >= m_pMatrix->begin()
- && rCacheIter.second.aIterator < m_pMatrix->end(),"Iterator out of area!");
- }
+ rCacheIter.second.aIterator = m_pMatrix->end();
+ }
+ else
+ {
+ OSL_ENSURE((rCacheIter.second.aIterator - m_pMatrix->begin()) >= _nDist,"Invalid Dist value!");
+ rCacheIter.second.aIterator -= _nDist;
+ OSL_ENSURE(rCacheIter.second.aIterator >= m_pMatrix->begin()
+ && rCacheIter.second.aIterator < m_pMatrix->end(),"Iterator out of area!");
}
}
}
diff --git a/dbaccess/source/core/api/StaticSet.cxx b/dbaccess/source/core/api/StaticSet.cxx
index 423d61a44626..0a5bd2c2d5fe 100644
--- a/dbaccess/source/core/api/StaticSet.cxx
+++ b/dbaccess/source/core/api/StaticSet.cxx
@@ -89,19 +89,19 @@ bool OStaticSet::fetchRow()
void OStaticSet::fillAllRows()
{
- if(!m_bEnd)
+ if(m_bEnd)
+ return;
+
+ sal_Int32 nColumnCount = m_xSetMetaData->getColumnCount();
+ while(m_xDriverSet->next())
{
- sal_Int32 nColumnCount = m_xSetMetaData->getColumnCount();
- while(m_xDriverSet->next())
- {
- ORowSetRow pRow = new connectivity::ORowVector< connectivity::ORowSetValue >(nColumnCount);
- m_aSet.push_back(pRow);
- m_aSetIter = m_aSet.end() - 1;
- (*pRow)[0] = getRow();
- OCacheSet::fillValueRow(pRow,(*pRow)[0]);
- }
- m_bEnd = true;
+ ORowSetRow pRow = new connectivity::ORowVector< connectivity::ORowSetValue >(nColumnCount);
+ m_aSet.push_back(pRow);
+ m_aSetIter = m_aSet.end() - 1;
+ (*pRow)[0] = getRow();
+ OCacheSet::fillValueRow(pRow,(*pRow)[0]);
}
+ m_bEnd = true;
}
// XResultSet
diff --git a/dbaccess/source/core/api/WrappedResultSet.cxx b/dbaccess/source/core/api/WrappedResultSet.cxx
index 07c2b52f1ad6..a0999e5f32aa 100644
--- a/dbaccess/source/core/api/WrappedResultSet.cxx
+++ b/dbaccess/source/core/api/WrappedResultSet.cxx
@@ -106,77 +106,77 @@ void WrappedResultSet::deleteRow(const ORowSetRow& /*_rDeleteRow*/ ,const connec
void WrappedResultSet::updateColumn(sal_Int32 nPos, const Reference< XRowUpdate >& _xParameter, const ORowSetValue& _rValue)
{
- if(_rValue.isBound() && _rValue.isModified())
+ if(!(_rValue.isBound() && _rValue.isModified()))
+ return;
+
+ if(_rValue.isNull())
+ _xParameter->updateNull(nPos);
+ else
{
- if(_rValue.isNull())
- _xParameter->updateNull(nPos);
- else
- {
- switch(_rValue.getTypeKind())
- {
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- _xParameter->updateNumericObject(nPos,_rValue.makeAny(),m_xSetMetaData->getScale(nPos));
- break;
- case DataType::CHAR:
- case DataType::VARCHAR:
+ switch(_rValue.getTypeKind())
+ {
+ case DataType::DECIMAL:
+ case DataType::NUMERIC:
+ _xParameter->updateNumericObject(nPos,_rValue.makeAny(),m_xSetMetaData->getScale(nPos));
+ break;
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ _xParameter->updateString(nPos,_rValue);
+ break;
+ case DataType::BIGINT:
+ if ( _rValue.isSigned() )
+ _xParameter->updateLong(nPos,_rValue);
+ else
_xParameter->updateString(nPos,_rValue);
- break;
- case DataType::BIGINT:
- if ( _rValue.isSigned() )
- _xParameter->updateLong(nPos,_rValue);
- else
- _xParameter->updateString(nPos,_rValue);
- break;
- case DataType::BIT:
- case DataType::BOOLEAN:
- _xParameter->updateBoolean(nPos,static_cast<bool>(_rValue));
- break;
- case DataType::TINYINT:
- if ( _rValue.isSigned() )
- _xParameter->updateByte(nPos,_rValue);
- else
- _xParameter->updateShort(nPos,_rValue);
- break;
- case DataType::SMALLINT:
- if ( _rValue.isSigned() )
- _xParameter->updateShort(nPos,_rValue);
- else
- _xParameter->updateInt(nPos,_rValue);
- break;
- case DataType::INTEGER:
- if ( _rValue.isSigned() )
- _xParameter->updateInt(nPos,_rValue);
- else
- _xParameter->updateLong(nPos,_rValue);
- break;
- case DataType::FLOAT:
- _xParameter->updateFloat(nPos,_rValue);
- break;
- case DataType::DOUBLE:
- case DataType::REAL:
- _xParameter->updateDouble(nPos,_rValue);
- break;
- case DataType::DATE:
- _xParameter->updateDate(nPos,_rValue);
- break;
- case DataType::TIME:
- _xParameter->updateTime(nPos,_rValue);
- break;
- case DataType::TIMESTAMP:
- _xParameter->updateTimestamp(nPos,_rValue);
- break;
- case DataType::BINARY:
- case DataType::VARBINARY:
- case DataType::LONGVARBINARY:
- _xParameter->updateBytes(nPos,_rValue);
- break;
- case DataType::BLOB:
- case DataType::CLOB:
- _xParameter->updateObject(nPos,_rValue.getAny());
- break;
- }
+ break;
+ case DataType::BIT:
+ case DataType::BOOLEAN:
+ _xParameter->updateBoolean(nPos,static_cast<bool>(_rValue));
+ break;
+ case DataType::TINYINT:
+ if ( _rValue.isSigned() )
+ _xParameter->updateByte(nPos,_rValue);
+ else
+ _xParameter->updateShort(nPos,_rValue);
+ break;
+ case DataType::SMALLINT:
+ if ( _rValue.isSigned() )
+ _xParameter->updateShort(nPos,_rValue);
+ else
+ _xParameter->updateInt(nPos,_rValue);
+ break;
+ case DataType::INTEGER:
+ if ( _rValue.isSigned() )
+ _xParameter->updateInt(nPos,_rValue);
+ else
+ _xParameter->updateLong(nPos,_rValue);
+ break;
+ case DataType::FLOAT:
+ _xParameter->updateFloat(nPos,_rValue);
+ break;
+ case DataType::DOUBLE:
+ case DataType::REAL:
+ _xParameter->updateDouble(nPos,_rValue);
+ break;
+ case DataType::DATE:
+ _xParameter->updateDate(nPos,_rValue);
+ break;
+ case DataType::TIME:
+ _xParameter->updateTime(nPos,_rValue);
+ break;
+ case DataType::TIMESTAMP:
+ _xParameter->updateTimestamp(nPos,_rValue);
+ break;
+ case DataType::BINARY:
+ case DataType::VARBINARY:
+ case DataType::LONGVARBINARY:
+ _xParameter->updateBytes(nPos,_rValue);
+ break;
+ case DataType::BLOB:
+ case DataType::CLOB:
+ _xParameter->updateObject(nPos,_rValue.getAny());
+ break;
}
}
}
diff --git a/dbaccess/source/core/api/definitioncolumn.cxx b/dbaccess/source/core/api/definitioncolumn.cxx
index 5fb97bedcc17..84d1197bda20 100644
--- a/dbaccess/source/core/api/definitioncolumn.cxx
+++ b/dbaccess/source/core/api/definitioncolumn.cxx
@@ -337,19 +337,19 @@ OColumnWrapper::OColumnWrapper( const Reference< XPropertySet > & rCol, const bo
// which type of aggregate property do we have?
// we distinguish the properties by the containment of optional properties
m_nColTypeID = 0;
- if ( m_xAggregate.is() )
- {
- Reference <XPropertySetInfo > xInfo(m_xAggregate->getPropertySetInfo());
- m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_DESCRIPTION) ? HAS_DESCRIPTION : 0;
- m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE) ? HAS_DEFAULTVALUE : 0;
- m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_ISROWVERSION) ? HAS_ROWVERSION : 0;
- m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) ? HAS_AUTOINCREMENT_CREATION : 0;
- m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_CATALOGNAME) ? HAS_CATALOGNAME : 0;
- m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_SCHEMANAME) ? HAS_SCHEMANAME : 0;
- m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_TABLENAME) ? HAS_TABLENAME : 0;
-
- m_xAggregate->getPropertyValue(PROPERTY_NAME) >>= m_sName;
- }
+ if ( !m_xAggregate.is() )
+ return;
+
+ Reference <XPropertySetInfo > xInfo(m_xAggregate->getPropertySetInfo());
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_DESCRIPTION) ? HAS_DESCRIPTION : 0;
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE) ? HAS_DEFAULTVALUE : 0;
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_ISROWVERSION) ? HAS_ROWVERSION : 0;
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) ? HAS_AUTOINCREMENT_CREATION : 0;
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_CATALOGNAME) ? HAS_CATALOGNAME : 0;
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_SCHEMANAME) ? HAS_SCHEMANAME : 0;
+ m_nColTypeID |= xInfo->hasPropertyByName(PROPERTY_TABLENAME) ? HAS_TABLENAME : 0;
+
+ m_xAggregate->getPropertyValue(PROPERTY_NAME) >>= m_sName;
}
OColumnWrapper::~OColumnWrapper()
diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx
index e4eb5107b99b..bc32774fd891 100644
--- a/dbaccess/source/core/api/tablecontainer.cxx
+++ b/dbaccess/source/core/api/tablecontainer.cxx
@@ -133,20 +133,20 @@ void lcl_createDefintionObject(const OUString& _rName
,Reference<XPropertySet>& _xTableDefinition
,Reference<XNameAccess>& _xColumnDefinitions)
{
- if ( _xTableDefinitions.is() )
+ if ( !_xTableDefinitions.is() )
+ return;
+
+ if ( _xTableDefinitions->hasByName(_rName) )
+ _xTableDefinition.set(_xTableDefinitions->getByName(_rName),UNO_QUERY);
+ else
{
- if ( _xTableDefinitions->hasByName(_rName) )
- _xTableDefinition.set(_xTableDefinitions->getByName(_rName),UNO_QUERY);
- else
- {
- // set as folder
- _xTableDefinition = TableDefinition::createWithName( ::comphelper::getProcessComponentContext(), _rName );
- _xTableDefinitions->insertByName(_rName,makeAny(_xTableDefinition));
- }
- Reference<XColumnsSupplier> xColumnsSupplier(_xTableDefinition,UNO_QUERY);
- if ( xColumnsSupplier.is() )
- _xColumnDefinitions = xColumnsSupplier->getColumns();
+ // set as folder
+ _xTableDefinition = TableDefinition::createWithName( ::comphelper::getProcessComponentContext(), _rName );
+ _xTableDefinitions->insertByName(_rName,makeAny(_xTableDefinition));
}
+ Reference<XColumnsSupplier> xColumnsSupplier(_xTableDefinition,UNO_QUERY);
+ if ( xColumnsSupplier.is() )
+ _xColumnDefinitions = xColumnsSupplier->getColumns();
}
}
diff --git a/dbaccess/source/core/api/viewcontainer.cxx b/dbaccess/source/core/api/viewcontainer.cxx
index bec415ffa2f4..690df713923d 100644
--- a/dbaccess/source/core/api/viewcontainer.cxx
+++ b/dbaccess/source/core/api/viewcontainer.cxx
@@ -146,38 +146,38 @@ ObjectType OViewContainer::appendObject( const OUString& _rForName, const Refere
// XDrop
void OViewContainer::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
{
- if ( !m_bInElementRemoved )
+ if ( m_bInElementRemoved )
+ return;
+
+ Reference< XDrop > xDrop(m_xMasterContainer,UNO_QUERY);
+ if(xDrop.is())
+ xDrop->dropByName(_sElementName);
+ else
{
- Reference< XDrop > xDrop(m_xMasterContainer,UNO_QUERY);
- if(xDrop.is())
- xDrop->dropByName(_sElementName);
- else
+ OUString sCatalog,sSchema,sTable,sComposedName;
+
+ Reference<XPropertySet> xTable(getObject(_nPos),UNO_QUERY);
+ if ( xTable.is() )
+ {
+ xTable->getPropertyValue(PROPERTY_CATALOGNAME) >>= sCatalog;
+ xTable->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
+ xTable->getPropertyValue(PROPERTY_NAME) >>= sTable;
+
+ sComposedName = ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sTable, true, ::dbtools::EComposeRule::InTableDefinitions );
+ }
+
+ if(sComposedName.isEmpty())
+ ::dbtools::throwFunctionSequenceException(static_cast<XTypeProvider*>(static_cast<OFilteredContainer*>(this)));
+
+ OUString aSql = "DROP VIEW " + sComposedName;
+ Reference<XConnection> xCon = m_xConnection;
+ OSL_ENSURE(xCon.is(),"Connection is null!");
+ if ( xCon.is() )
{
- OUString sCatalog,sSchema,sTable,sComposedName;
-
- Reference<XPropertySet> xTable(getObject(_nPos),UNO_QUERY);
- if ( xTable.is() )
- {
- xTable->getPropertyValue(PROPERTY_CATALOGNAME) >>= sCatalog;
- xTable->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
- xTable->getPropertyValue(PROPERTY_NAME) >>= sTable;
-
- sComposedName = ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sTable, true, ::dbtools::EComposeRule::InTableDefinitions );
- }
-
- if(sComposedName.isEmpty())
- ::dbtools::throwFunctionSequenceException(static_cast<XTypeProvider*>(static_cast<OFilteredContainer*>(this)));
-
- OUString aSql = "DROP VIEW " + sComposedName;
- Reference<XConnection> xCon = m_xConnection;
- OSL_ENSURE(xCon.is(),"Connection is null!");
- if ( xCon.is() )
- {
- Reference< XStatement > xStmt = xCon->createStatement( );
- if(xStmt.is())
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
+ Reference< XStatement > xStmt = xCon->createStatement( );
+ if(xStmt.is())
+ xStmt->execute(aSql);
+ ::comphelper::disposeComponent(xStmt);
}
}
}
@@ -203,20 +203,20 @@ void SAL_CALL OViewContainer::elementRemoved( const ContainerEvent& Event )
{
::osl::MutexGuard aGuard(m_rMutex);
OUString sName;
- if ( (Event.Accessor >>= sName) && hasByName(sName) )
+ if ( !((Event.Accessor >>= sName) && hasByName(sName)) )
+ return;
+
+ m_bInElementRemoved = true;
+ try
+ {
+ dropByName(sName);
+ }
+ catch(Exception&)
{
- m_bInElementRemoved = true;
- try
- {
- dropByName(sName);
- }
- catch(Exception&)
- {
- m_bInElementRemoved = false;
- throw;
- }
m_bInElementRemoved = false;
+ throw;
}
+ m_bInElementRemoved = false;
}
void SAL_CALL OViewContainer::disposing( const css::lang::EventObject& /*Source*/ )
diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx
index 424d3e8c9cf4..7ad1d22ba2f4 100644
--- a/dbaccess/source/core/dataaccess/ContentHelper.cxx
+++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx
@@ -481,65 +481,65 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent
{
sal_Int32 nCount = evt.getLength();
- if ( nCount )
+ if ( !nCount )
+ return;
+
+ // First, notify listeners interested in changes of every property.
+ OInterfaceContainerHelper* pAllPropsContainer = m_aPropertyChangeListeners.getContainer( OUString() );
+ if ( pAllPropsContainer )
{
- // First, notify listeners interested in changes of every property.
- OInterfaceContainerHelper* pAllPropsContainer = m_aPropertyChangeListeners.getContainer( OUString() );
- if ( pAllPropsContainer )
+ OInterfaceIteratorHelper aIter( *pAllPropsContainer );
+ while ( aIter.hasMoreElements() )
{
- OInterfaceIteratorHelper aIter( *pAllPropsContainer );
- while ( aIter.hasMoreElements() )
- {
- // Propagate event.
- Reference< XPropertiesChangeListener > xListener( aIter.next(), UNO_QUERY );
- if ( xListener.is() )
- xListener->propertiesChange( evt );
- }
+ // Propagate event.
+ Reference< XPropertiesChangeListener > xListener( aIter.next(), UNO_QUERY );
+ if ( xListener.is() )
+ xListener->propertiesChange( evt );
}
+ }
- typedef std::map< XPropertiesChangeListener*, Sequence< PropertyChangeEvent > > PropertiesEventListenerMap;
- PropertiesEventListenerMap aListeners;
+ typedef std::map< XPropertiesChangeListener*, Sequence< PropertyChangeEvent > > PropertiesEventListenerMap;
+ PropertiesEventListenerMap aListeners;
- const PropertyChangeEvent* propertyChangeEvent = evt.getConstArray();
+ const PropertyChangeEvent* propertyChangeEvent = evt.getConstArray();
- for ( sal_Int32 n = 0; n < nCount; ++n, ++propertyChangeEvent )
- {
- const PropertyChangeEvent& rEvent = *propertyChangeEvent;
- const OUString& rName = rEvent.PropertyName;
+ for ( sal_Int32 n = 0; n < nCount; ++n, ++propertyChangeEvent )
+ {
+ const PropertyChangeEvent& rEvent = *propertyChangeEvent;
+ const OUString& rName = rEvent.PropertyName;
- OInterfaceContainerHelper* pPropsContainer = m_aPropertyChangeListeners.getContainer( rName );
- if ( pPropsContainer )
+ OInterfaceContainerHelper* pPropsContainer = m_aPropertyChangeListeners.getContainer( rName );
+ if ( pPropsContainer )
+ {
+ OInterfaceIteratorHelper aIter( *pPropsContainer );
+ while ( aIter.hasMoreElements() )
{
- OInterfaceIteratorHelper aIter( *pPropsContainer );
- while ( aIter.hasMoreElements() )
- {
- Sequence< PropertyChangeEvent >* propertyEvents;
-
- XPropertiesChangeListener* pListener = static_cast< XPropertiesChangeListener * >( aIter.next() );
- PropertiesEventListenerMap::iterator it = aListeners.find( pListener );
- if ( it == aListeners.end() )
- {
- // Not in map - create and insert new entry.
- auto pair = aListeners.emplace( pListener, Sequence< PropertyChangeEvent >( nCount ));
- propertyEvents = &pair.first->second;
- }
- else
- propertyEvents = &(*it).second;
+ Sequence< PropertyChangeEvent >* propertyEvents;
- (*propertyEvents)[n] = rEvent;
+ XPropertiesChangeListener* pListener = static_cast< XPropertiesChangeListener * >( aIter.next() );
+ PropertiesEventListenerMap::iterator it = aListeners.find( pListener );
+ if ( it == aListeners.end() )
+ {
+ // Not in map - create and insert new entry.
+ auto pair = aListeners.emplace( pListener, Sequence< PropertyChangeEvent >( nCount ));
+ propertyEvents = &pair.first->second;
}
+ else
+ propertyEvents = &(*it).second;
+
+ (*propertyEvents)[n] = rEvent;
}
}
+ }
- // Notify listeners.
- for (auto & rPair : aListeners)
- {
- XPropertiesChangeListener* pListener = rPair.first;
- Sequence< PropertyChangeEvent >& rSeq = rPair.second;
+ // Notify listeners.
+ for (auto & rPair : aListeners)
+ {
+ XPropertiesChangeListener* pListener = rPair.first;
+ Sequence< PropertyChangeEvent >& rSeq = rPair.second;
- // Propagate event.
- pListener->propertiesChange( rSeq );
- }
+ // Propagate event.
+ pListener->propertiesChange( rSeq );
}
}
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index 2b098e235e07..068149018264 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -309,19 +309,19 @@ void SAL_CALL DocumentStorageAccess::commited( const css::lang::EventObject& aEv
if ( m_pModelImplementation )
m_pModelImplementation->setModified( true );
- if ( m_pModelImplementation && m_bPropagateCommitToRoot )
- {
- Reference< XStorage > xStorage( aEvent.Source, UNO_QUERY );
+ if ( !(m_pModelImplementation && m_bPropagateCommitToRoot) )
+ return;
- // check if this is the dedicated "database" sub storage
- NamedStorages::const_iterator pos = m_aExposedStorages.find( "database" );
- if ( ( pos != m_aExposedStorages.end() )
- && ( pos->second == xStorage )
- )
- {
- // if so, also commit the root storage
- m_pModelImplementation->commitRootStorage();
- }
+ Reference< XStorage > xStorage( aEvent.Source, UNO_QUERY );
+
+ // check if this is the dedicated "database" sub storage
+ NamedStorages::const_iterator pos = m_aExposedStorages.find( "database" );
+ if ( ( pos != m_aExposedStorages.end() )
+ && ( pos->second == xStorage )
+ )
+ {
+ // if so, also commit the root storage
+ m_pModelImplementation->commitRootStorage();
}
}
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 415d4a5d3c4c..6717e2c403ec 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -160,20 +160,20 @@ ODatabaseDocument::ODatabaseDocument(const ::rtl::Reference<ODatabaseModelImpl>&
// if there previously was a document instance for the same Impl which was already initialized,
// then consider ourself initialized, too.
// #i94840#
- if ( m_pImpl->hadInitializedDocument() )
- {
- // Note we set our init-state to "Initializing", not "Initialized". We're created from inside the ModelImpl,
- // which is expected to call attachResource in case there was a previous incarnation of the document,
- // so we can properly finish our initialization then.
- impl_setInitializing();
+ if ( !m_pImpl->hadInitializedDocument() )
+ return;
- if ( !m_pImpl->getURL().isEmpty() )
- {
- // if the previous incarnation of the DatabaseDocument already had a URL, then creating this incarnation
- // here is effectively loading the document.
- // #i105505#
- m_aViewMonitor.onLoadedDocument();
- }
+ // Note we set our init-state to "Initializing", not "Initialized". We're created from inside the ModelImpl,
+ // which is expected to call attachResource in case there was a previous incarnation of the document,
+ // so we can properly finish our initialization then.
+ impl_setInitializing();
+
+ if ( !m_pImpl->getURL().isEmpty() )
+ {
+ // if the previous incarnation of the DatabaseDocument already had a URL, then creating this incarnation
+ // here is effectively loading the document.
+ // #i105505#
+ m_aViewMonitor.onLoadedDocument();
}
}
@@ -856,18 +856,18 @@ void SAL_CALL ODatabaseDocument::disconnectController( const Reference< XControl
if ( bNotifyViewClosed )
m_aEventNotifier.notifyDocumentEvent( "OnViewClosed", Reference< XController2 >( _xController, UNO_QUERY ) );
- if ( bLastControllerGone && !bIsClosing )
+ if ( !(bLastControllerGone && !bIsClosing) )
+ return;
+
+ // if this was the last view, close the document as a whole
+ // #i51157#
+ try
{
- // if this was the last view, close the document as a whole
- // #i51157#
- try
- {
- close( true );
- }
- catch( const CloseVetoException& )
- {
- // okay, somebody vetoed and took ownership
- }
+ close( true );
+ }
+ catch( const CloseVetoException& )
+ {
+ // okay, somebody vetoed and took ownership
}
}
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 7931fc425163..002d01b21bb2 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -960,128 +960,128 @@ namespace
void ODatabaseSource::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue )
{
- if ( m_pImpl.is() )
+ if ( !m_pImpl.is() )
+ return;
+
+ switch(nHandle)
{
- switch(nHandle)
- {
- case PROPERTY_ID_TABLEFILTER:
- rValue >>= m_pImpl->m_aTableFilter;
- break;
- case PROPERTY_ID_TABLETYPEFILTER:
- rValue >>= m_pImpl->m_aTableTypeFilter;
- break;
- case PROPERTY_ID_USER:
- rValue >>= m_pImpl->m_sUser;
- // if the user name has changed, reset the password
- m_pImpl->m_aPassword.clear();
- break;
- case PROPERTY_ID_PASSWORD:
- rValue >>= m_pImpl->m_aPassword;
- break;
- case PROPERTY_ID_ISPASSWORDREQUIRED:
- m_pImpl->m_bPasswordRequired = any2bool(rValue);
- break;
- case PROPERTY_ID_SUPPRESSVERSIONCL:
- m_pImpl->m_bSuppressVersionColumns = any2bool(rValue);
- break;
- case PROPERTY_ID_URL:
- rValue >>= m_pImpl->m_sConnectURL;
- break;
- case PROPERTY_ID_INFO:
- {
- Sequence< PropertyValue > aInfo;
- OSL_VERIFY( rValue >>= aInfo );
- lcl_setPropertyValues_resetOrRemoveOther( m_pImpl->m_xSettings, aInfo );
- }
+ case PROPERTY_ID_TABLEFILTER:
+ rValue >>= m_pImpl->m_aTableFilter;
break;
- case PROPERTY_ID_LAYOUTINFORMATION:
- rValue >>= m_pImpl->m_aLayoutInformation;
- break;
+ case PROPERTY_ID_TABLETYPEFILTER:
+ rValue >>= m_pImpl->m_aTableTypeFilter;
+ break;
+ case PROPERTY_ID_USER:
+ rValue >>= m_pImpl->m_sUser;
+ // if the user name has changed, reset the password
+ m_pImpl->m_aPassword.clear();
+ break;
+ case PROPERTY_ID_PASSWORD:
+ rValue >>= m_pImpl->m_aPassword;
+ break;
+ case PROPERTY_ID_ISPASSWORDREQUIRED:
+ m_pImpl->m_bPasswordRequired = any2bool(rValue);
+ break;
+ case PROPERTY_ID_SUPPRESSVERSIONCL:
+ m_pImpl->m_bSuppressVersionColumns = any2bool(rValue);
+ break;
+ case PROPERTY_ID_URL:
+ rValue >>= m_pImpl->m_sConnectURL;
+ break;
+ case PROPERTY_ID_INFO:
+ {
+ Sequence< PropertyValue > aInfo;
+ OSL_VERIFY( rValue >>= aInfo );
+ lcl_setPropertyValues_resetOrRemoveOther( m_pImpl->m_xSettings, aInfo );
}
- m_pImpl->setModified(true);
+ break;
+ case PROPERTY_ID_LAYOUTINFORMATION:
+ rValue >>= m_pImpl->m_aLayoutInformation;
+ break;
}
+ m_pImpl->setModified(true);
}
void ODatabaseSource::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
{
- if ( m_pImpl.is() )
+ if ( !m_pImpl.is() )
+ return;
+
+ switch (nHandle)
{
- switch (nHandle)
+ case PROPERTY_ID_TABLEFILTER:
+ rValue <<= m_pImpl->m_aTableFilter;
+ break;
+ case PROPERTY_ID_TABLETYPEFILTER:
+ rValue <<= m_pImpl->m_aTableTypeFilter;
+ break;
+ case PROPERTY_ID_USER:
+ rValue <<= m_pImpl->m_sUser;
+ break;
+ case PROPERTY_ID_PASSWORD:
+ rValue <<= m_pImpl->m_aPassword;
+ break;
+ case PROPERTY_ID_ISPASSWORDREQUIRED:
+ rValue <<= m_pImpl->m_bPasswordRequired;
+ break;
+ case PROPERTY_ID_SUPPRESSVERSIONCL:
+ rValue <<= m_pImpl->m_bSuppressVersionColumns;
+ break;
+ case PROPERTY_ID_ISREADONLY:
+ rValue <<= m_pImpl->m_bReadOnly;
+ break;
+ case PROPERTY_ID_INFO:
{
- case PROPERTY_ID_TABLEFILTER:
- rValue <<= m_pImpl->m_aTableFilter;
- break;
- case PROPERTY_ID_TABLETYPEFILTER:
- rValue <<= m_pImpl->m_aTableTypeFilter;
- break;
- case PROPERTY_ID_USER:
- rValue <<= m_pImpl->m_sUser;
- break;
- case PROPERTY_ID_PASSWORD:
- rValue <<= m_pImpl->m_aPassword;
- break;
- case PROPERTY_ID_ISPASSWORDREQUIRED:
- rValue <<= m_pImpl->m_bPasswordRequired;
- break;
- case PROPERTY_ID_SUPPRESSVERSIONCL:
- rValue <<= m_pImpl->m_bSuppressVersionColumns;
- break;
- case PROPERTY_ID_ISREADONLY:
- rValue <<= m_pImpl->m_bReadOnly;
- break;
- case PROPERTY_ID_INFO:
+ try
{
- try
+ // collect the property attributes of all current settings
+ Reference< XPropertySet > xSettingsAsProps( m_pImpl->m_xSettings, UNO_QUERY_THROW );
+ Reference< XPropertySetInfo > xPST( xSettingsAsProps->getPropertySetInfo(), UNO_SET_THROW );
+ const Sequence< Property > aSettings( xPST->getProperties() );
+ std::map< OUString, sal_Int32 > aPropertyAttributes;
+ for ( auto const & setting : aSettings )
{
- // collect the property attributes of all current settings
- Reference< XPropertySet > xSettingsAsProps( m_pImpl->m_xSettings, UNO_QUERY_THROW );
- Reference< XPropertySetInfo > xPST( xSettingsAsProps->getPropertySetInfo(), UNO_SET_THROW );
- const Sequence< Property > aSettings( xPST->getProperties() );
- std::map< OUString, sal_Int32 > aPropertyAttributes;
- for ( auto const & setting : aSettings )
- {
- aPropertyAttributes[ setting.Name ] = setting.Attributes;
- }
-
- // get all current settings with their values
- Sequence< PropertyValue > aValues( m_pImpl->m_xSettings->getPropertyValues() );
-
- // transform them so that only property values which fulfill certain
- // criteria survive
- Sequence< PropertyValue > aNonDefaultOrUserDefined( aValues.getLength() );
- const PropertyValue* pCopyEnd = std::remove_copy_if(
- aValues.begin(),
- aValues.end(),
- aNonDefaultOrUserDefined.getArray(),
- IsDefaultAndNotRemoveable( aPropertyAttributes )
- );
- aNonDefaultOrUserDefined.realloc( pCopyEnd - aNonDefaultOrUserDefined.getArray() );
- rValue <<= aNonDefaultOrUserDefined;
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
+ aPropertyAttributes[ setting.Name ] = setting.Attributes;
}
+
+ // get all current settings with their values
+ Sequence< PropertyValue > aValues( m_pImpl->m_xSettings->getPropertyValues() );
+
+ // transform them so that only property values which fulfill certain
+ // criteria survive
+ Sequence< PropertyValue > aNonDefaultOrUserDefined( aValues.getLength() );
+ const PropertyValue* pCopyEnd = std::remove_copy_if(
+ aValues.begin(),
+ aValues.end(),
+ aNonDefaultOrUserDefined.getArray(),
+ IsDefaultAndNotRemoveable( aPropertyAttributes )
+ );
+ aNonDefaultOrUserDefined.realloc( pCopyEnd - aNonDefaultOrUserDefined.getArray() );
+ rValue <<= aNonDefaultOrUserDefined;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- break;
- case PROPERTY_ID_SETTINGS:
- rValue <<= m_pImpl->m_xSettings;
- break;
- case PROPERTY_ID_URL:
- rValue <<= m_pImpl->m_sConnectURL;
- break;
- case PROPERTY_ID_NUMBERFORMATSSUPPLIER:
- rValue <<= m_pImpl->getNumberFormatsSupplier();
- break;
- case PROPERTY_ID_NAME:
- rValue <<= m_pImpl->m_sName;
- break;
- case PROPERTY_ID_LAYOUTINFORMATION:
- rValue <<= m_pImpl->m_aLayoutInformation;
- break;
- default:
- SAL_WARN("dbaccess","unknown Property");
}
+ break;
+ case PROPERTY_ID_SETTINGS:
+ rValue <<= m_pImpl->m_xSettings;
+ break;
+ case PROPERTY_ID_URL:
+ rValue <<= m_pImpl->m_sConnectURL;
+ break;
+ case PROPERTY_ID_NUMBERFORMATSSUPPLIER:
+ rValue <<= m_pImpl->getNumberFormatsSupplier();
+ break;
+ case PROPERTY_ID_NAME:
+ rValue <<= m_pImpl->m_sName;
+ break;
+ case PROPERTY_ID_LAYOUTINFORMATION:
+ rValue <<= m_pImpl->m_aLayoutInformation;
+ break;
+ default:
+ SAL_WARN("dbaccess","unknown Property");
}
}
diff --git a/dbaccess/source/core/dataaccess/definitioncontainer.cxx b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
index e31eee40b0dc..dd099c81fa05 100644
--- a/dbaccess/source/core/dataaccess/definitioncontainer.cxx
+++ b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
@@ -602,27 +602,27 @@ void ODefinitionContainer::approveNewObject(const OUString& _sName,const Referen
void SAL_CALL ODefinitionContainer::propertyChange( const PropertyChangeEvent& evt )
{
MutexGuard aGuard(m_aMutex);
- if( evt.PropertyName == PROPERTY_NAME || evt.PropertyName == "Title" )
+ if( !(evt.PropertyName == PROPERTY_NAME || evt.PropertyName == "Title") )
+ return;
+
+ m_bInPropertyChange = true;
+ try
{
- m_bInPropertyChange = true;
- try
- {
- OUString sNewName,sOldName;
- evt.OldValue >>= sOldName;
- evt.NewValue >>= sNewName;
- Reference<XContent> xContent( evt.Source, UNO_QUERY );
- removeObjectListener( xContent );
- implRemove( sOldName );
- implAppend( sNewName, xContent );
- }
- catch(const Exception& ex)
- {
- css::uno::Any anyEx = cppu::getCaughtException();
- throw css::lang::WrappedTargetRuntimeException( ex.Message,
- nullptr, anyEx );
- }
- m_bInPropertyChange = false;
+ OUString sNewName,sOldName;
+ evt.OldValue >>= sOldName;
+ evt.NewValue >>= sNewName;
+ Reference<XContent> xContent( evt.Source, UNO_QUERY );
+ removeObjectListener( xContent );
+ implRemove( sOldName );
+ implAppend( sNewName, xContent );
+ }
+ catch(const Exception& ex)
+ {
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( ex.Message,
+ nullptr, anyEx );
}
+ m_bInPropertyChange = false;
}
// XVetoableChangeListener
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index 8115fd9fe6d2..b16f1fed5aca 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -1696,25 +1696,25 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& i_
void ODocumentDefinition::onCommandPreview(Any& _rImage)
{
loadEmbeddedObjectForPreview();
- if ( m_xEmbeddedObject.is() )
+ if ( !m_xEmbeddedObject.is() )
+ return;
+
+ try
{
- try
+ Reference<XTransferable> xTransfer(getComponent(),UNO_QUERY);
+ if ( xTransfer.is() )
{
- Reference<XTransferable> xTransfer(getComponent(),UNO_QUERY);
- if ( xTransfer.is() )
- {
- DataFlavor aFlavor;
- aFlavor.MimeType = "image/png";
- aFlavor.HumanPresentableName = "Portable Network Graphics";
- aFlavor.DataType = cppu::UnoType<Sequence < sal_Int8 >>::get();
+ DataFlavor aFlavor;
+ aFlavor.MimeType = "image/png";
+ aFlavor.HumanPresentableName = "Portable Network Graphics";
+ aFlavor.DataType = cppu::UnoType<Sequence < sal_Int8 >>::get();
- _rImage = xTransfer->getTransferData( aFlavor );
- }
- }
- catch( const Exception& )
- {
+ _rImage = xTransfer->getTransferData( aFlavor );
}
}
+ catch( const Exception& )
+ {
+ }
}
void ODocumentDefinition::getPropertyDefaultByHandle( sal_Int32 /*_nHandle*/, Any& _rDefault ) const
@@ -1725,19 +1725,19 @@ void ODocumentDefinition::getPropertyDefaultByHandle( sal_Int32 /*_nHandle*/, An
void ODocumentDefinition::onCommandGetDocumentProperties( Any& _rProps )
{
loadEmbeddedObjectForPreview();
- if ( m_xEmbeddedObject.is() )
+ if ( !m_xEmbeddedObject.is() )
+ return;
+
+ try
{
- try
- {
- Reference<XDocumentPropertiesSupplier> xDocSup(
- getComponent(), UNO_QUERY );
- if ( xDocSup.is() )
- _rProps <<= xDocSup->getDocumentProperties();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
+ Reference<XDocumentPropertiesSupplier> xDocSup(
+ getComponent(), UNO_QUERY );
+ if ( xDocSup.is() )
+ _rProps <<= xDocSup->getDocumentProperties();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
}
}
diff --git a/dbaccess/source/core/misc/ContainerMediator.cxx b/dbaccess/source/core/misc/ContainerMediator.cxx
index 5864a42d6cbb..338858c87e76 100644
--- a/dbaccess/source/core/misc/ContainerMediator.cxx
+++ b/dbaccess/source/core/misc/ContainerMediator.cxx
@@ -111,54 +111,54 @@ void SAL_CALL OContainerMediator::elementRemoved( const ContainerEvent& _rEvent
{
::osl::MutexGuard aGuard(m_aMutex);
Reference< XContainer > xContainer = m_xContainer;
- if ( _rEvent.Source == xContainer && xContainer.is() )
+ if ( !(_rEvent.Source == xContainer && xContainer.is()) )
+ return;
+
+ OUString sElementName;
+ _rEvent.Accessor >>= sElementName;
+ m_aForwardList.erase(sElementName);
+ try
{
- OUString sElementName;
- _rEvent.Accessor >>= sElementName;
- m_aForwardList.erase(sElementName);
- try
- {
- Reference<XNameContainer> xNameContainer( m_xSettings, UNO_QUERY );
- if ( xNameContainer.is() && m_xSettings->hasByName( sElementName ) )
- xNameContainer->removeByName( sElementName );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
+ Reference<XNameContainer> xNameContainer( m_xSettings, UNO_QUERY );
+ if ( xNameContainer.is() && m_xSettings->hasByName( sElementName ) )
+ xNameContainer->removeByName( sElementName );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
}
}
void SAL_CALL OContainerMediator::elementReplaced( const ContainerEvent& _rEvent )
{
Reference< XContainer > xContainer = m_xContainer;
- if ( _rEvent.Source == xContainer && xContainer.is() )
- {
- OUString sElementName;
- _rEvent.ReplacedElement >>= sElementName;
+ if ( !(_rEvent.Source == xContainer && xContainer.is()) )
+ return;
- PropertyForwardList::const_iterator aFind = m_aForwardList.find(sElementName);
- if ( aFind != m_aForwardList.end() )
+ OUString sElementName;
+ _rEvent.ReplacedElement >>= sElementName;
+
+ PropertyForwardList::const_iterator aFind = m_aForwardList.find(sElementName);
+ if ( aFind == m_aForwardList.end() )
+ return;
+
+ OUString sNewName;
+ _rEvent.Accessor >>= sNewName;
+ try
+ {
+ Reference<XNameContainer> xNameContainer( m_xSettings, UNO_QUERY_THROW );
+ if ( xNameContainer.is() && m_xSettings->hasByName( sElementName ) )
{
- OUString sNewName;
- _rEvent.Accessor >>= sNewName;
- try
- {
- Reference<XNameContainer> xNameContainer( m_xSettings, UNO_QUERY_THROW );
- if ( xNameContainer.is() && m_xSettings->hasByName( sElementName ) )
- {
- Reference<XRename> xSource(m_xSettings->getByName(sElementName),UNO_QUERY_THROW);
- xSource->rename(sNewName);
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
-
- aFind->second->setName(sNewName);
+ Reference<XRename> xSource(m_xSettings->getByName(sElementName),UNO_QUERY_THROW);
+ xSource->rename(sNewName);
}
}
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
+
+ aFind->second->setName(sNewName);
}
void SAL_CALL OContainerMediator::disposing( const EventObject& /*Source*/ )
diff --git a/dbaccess/source/filter/xml/xmlAutoStyle.cxx b/dbaccess/source/filter/xml/xmlAutoStyle.cxx
index 52b141358fdc..99101567111a 100644
--- a/dbaccess/source/filter/xml/xmlAutoStyle.cxx
+++ b/dbaccess/source/filter/xml/xmlAutoStyle.cxx
@@ -36,30 +36,30 @@ void OXMLAutoStylePoolP::exportStyleAttributes(
) const
{
SvXMLAutoStylePoolP::exportStyleAttributes( rAttrList, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap );
- if ( nFamily == XmlStyleFamily::TABLE_COLUMN )
+ if ( nFamily != XmlStyleFamily::TABLE_COLUMN )
+ return;
+
+ rtl::Reference< XMLPropertySetMapper > aPropMapper = rODBExport.GetColumnStylesPropertySetMapper();
+ for (auto const& property : rProperties)
{
- rtl::Reference< XMLPropertySetMapper > aPropMapper = rODBExport.GetColumnStylesPropertySetMapper();
- for (auto const& property : rProperties)
+ sal_Int16 nContextID = aPropMapper->GetEntryContextId(property.mnIndex);
+ switch (nContextID)
{
- sal_Int16 nContextID = aPropMapper->GetEntryContextId(property.mnIndex);
- switch (nContextID)
+ case CTF_DB_NUMBERFORMAT :
{
- case CTF_DB_NUMBERFORMAT :
+ sal_Int32 nNumberFormat = 0;
+ if ( property.maValue >>= nNumberFormat )
{
- sal_Int32 nNumberFormat = 0;
- if ( property.maValue >>= nNumberFormat )
+ OUString sAttrValue = rODBExport.getDataStyleName(nNumberFormat);
+ if ( !sAttrValue.isEmpty() )
{
- OUString sAttrValue = rODBExport.getDataStyleName(nNumberFormat);
- if ( !sAttrValue.isEmpty() )
- {
- GetExport().AddAttribute(
- aPropMapper->GetEntryNameSpace(property.mnIndex),
- aPropMapper->GetEntryXMLName(property.mnIndex),
- sAttrValue );
- }
+ GetExport().AddAttribute(
+ aPropMapper->GetEntryNameSpace(property.mnIndex),
+ aPropMapper->GetEntryXMLName(property.mnIndex),
+ sAttrValue );
}
- break;
}
+ break;
}
}
}
diff --git a/dbaccess/source/filter/xml/xmlComponent.cxx b/dbaccess/source/filter/xml/xmlComponent.cxx
index f6498108e529..f2be6482acde 100644
--- a/dbaccess/source/filter/xml/xmlComponent.cxx
+++ b/dbaccess/source/filter/xml/xmlComponent.cxx
@@ -71,25 +71,25 @@ OXMLComponent::OXMLComponent( ODBFilter& rImport
SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
}
}
- if ( !sHREF.isEmpty() && !sName.isEmpty() && _xParentContainer.is() )
+ if ( !(!sHREF.isEmpty() && !sName.isEmpty() && _xParentContainer.is()) )
+ return;
+
+ Sequence<Any> aArguments(comphelper::InitAnyPropertySequence(
{
- Sequence<Any> aArguments(comphelper::InitAnyPropertySequence(
- {
- {PROPERTY_NAME, Any(sName)}, // set as folder
- {PROPERTY_PERSISTENT_NAME, Any(sHREF.copy(sHREF.lastIndexOf('/')+1))},
- {PROPERTY_AS_TEMPLATE, Any(bAsTemplate)},
- }));
- try
- {
- Reference< XMultiServiceFactory > xORB( _xParentContainer, UNO_QUERY_THROW );
- Reference< XInterface > xComponent( xORB->createInstanceWithArguments( _sComponentServiceName, aArguments ) );
- Reference< XNameContainer > xNameContainer( _xParentContainer, UNO_QUERY_THROW );
- xNameContainer->insertByName( sName, makeAny( xComponent ) );
- }
- catch(Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
+ {PROPERTY_NAME, Any(sName)}, // set as folder
+ {PROPERTY_PERSISTENT_NAME, Any(sHREF.copy(sHREF.lastIndexOf('/')+1))},
+ {PROPERTY_AS_TEMPLATE, Any(bAsTemplate)},
+ }));
+ try
+ {
+ Reference< XMultiServiceFactory > xORB( _xParentContainer, UNO_QUERY_THROW );
+ Reference< XInterface > xComponent( xORB->createInstanceWithArguments( _sComponentServiceName, aArguments ) );
+ Reference< XNameContainer > xNameContainer( _xParentContainer, UNO_QUERY_THROW );
+ xNameContainer->insertByName( sName, makeAny( xComponent ) );
+ }
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
}
}
diff --git a/dbaccess/source/filter/xml/xmlConnectionResource.cxx b/dbaccess/source/filter/xml/xmlConnectionResource.cxx
index 2df56f371f8c..768ca19840fc 100644
--- a/dbaccess/source/filter/xml/xmlConnectionResource.cxx
+++ b/dbaccess/source/filter/xml/xmlConnectionResource.cxx
@@ -37,46 +37,46 @@ OXMLConnectionResource::OXMLConnectionResource( ODBFilter& rImport,
PropertyValue aProperty;
- if (xDataSource.is())
+ if (!xDataSource.is())
+ return;
+
+ sax_fastparser::FastAttributeList *pAttribList =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( _xAttrList );
+ for (auto &aIter : *pAttribList)
{
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( _xAttrList );
- for (auto &aIter : *pAttribList)
- {
- OUString sValue = aIter.toString();
- aProperty.Name.clear();
- aProperty.Value = Any();
+ OUString sValue = aIter.toString();
+ aProperty.Name.clear();
+ aProperty.Value = Any();
- switch( aIter.getToken() )
- {
- case XML_ELEMENT(XLINK, XML_HREF):
- try
- {
- xDataSource->setPropertyValue(PROPERTY_URL,makeAny(sValue));
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
- break;
- case XML_ELEMENT(XLINK, XML_TYPE):
- aProperty.Name = PROPERTY_TYPE;
- break;
- case XML_ELEMENT(XLINK, XML_SHOW):
- aProperty.Name = "Show";
- break;
- case XML_ELEMENT(XLINK, XML_ACTUATE):
- aProperty.Name = "Actuate";
- break;
- default:
- SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
- }
- if ( !aProperty.Name.isEmpty() )
- {
- if ( !aProperty.Value.hasValue() )
- aProperty.Value <<= sValue;
- rImport.addInfo(aProperty);
- }
+ switch( aIter.getToken() )
+ {
+ case XML_ELEMENT(XLINK, XML_HREF):
+ try
+ {
+ xDataSource->setPropertyValue(PROPERTY_URL,makeAny(sValue));
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
+ break;
+ case XML_ELEMENT(XLINK, XML_TYPE):
+ aProperty.Name = PROPERTY_TYPE;
+ break;
+ case XML_ELEMENT(XLINK, XML_SHOW):
+ aProperty.Name = "Show";
+ break;
+ case XML_ELEMENT(XLINK, XML_ACTUATE):
+ aProperty.Name = "Actuate";
+ break;
+ default:
+ SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
+ }
+ if ( !aProperty.Name.isEmpty() )
+ {
+ if ( !aProperty.Value.hasValue() )
+ aProperty.Value <<= sValue;
+ rImport.addInfo(aProperty);
}
}
}
diff --git a/dbaccess/source/filter/xml/xmlDataSource.cxx b/dbaccess/source/filter/xml/xmlDataSource.cxx
index 550a77eb0c16..66f1ab44f979 100644
--- a/dbaccess/source/filter/xml/xmlDataSource.cxx
+++ b/dbaccess/source/filter/xml/xmlDataSource.cxx
@@ -160,36 +160,36 @@ OXMLDataSource::OXMLDataSource( ODBFilter& rImport,
}
}
}
- if ( rImport.isNewFormat() )
+ if ( !rImport.isNewFormat() )
+ return;
+
+ if ( !bFoundTableNameLengthLimited && ( _eUsedFor == eAppSettings ) )
{
- if ( !bFoundTableNameLengthLimited && ( _eUsedFor == eAppSettings ) )
- {
- aProperty.Name = INFO_ALLOWLONGTABLENAMES;
- aProperty.Value <<= true;
- rImport.addInfo(aProperty);
- }
- if ( !bFoundParamNameSubstitution && ( _eUsedFor == eDriverSettings ) )
- {
- aProperty.Name = INFO_PARAMETERNAMESUBST;
- aProperty.Value <<= true;
- rImport.addInfo(aProperty);
- }
- if ( !bFoundAppendTableAliasName && ( _eUsedFor == eAppSettings ) )
+ aProperty.Name = INFO_ALLOWLONGTABLENAMES;
+ aProperty.Value <<= true;
+ rImport.addInfo(aProperty);
+ }
+ if ( !bFoundParamNameSubstitution && ( _eUsedFor == eDriverSettings ) )
+ {
+ aProperty.Name = INFO_PARAMETERNAMESUBST;
+ aProperty.Value <<= true;
+ rImport.addInfo(aProperty);
+ }
+ if ( !bFoundAppendTableAliasName && ( _eUsedFor == eAppSettings ) )
+ {
+ aProperty.Name = INFO_APPEND_TABLE_ALIAS;
+ aProperty.Value <<= true;
+ rImport.addInfo(aProperty);
+ }
+ if ( !bFoundSuppressVersionColumns && ( _eUsedFor == eAppSettings ) )
+ {
+ try
{
- aProperty.Name = INFO_APPEND_TABLE_ALIAS;
- aProperty.Value <<= true;
- rImport.addInfo(aProperty);
+ xDataSource->setPropertyValue(PROPERTY_SUPPRESSVERSIONCL,makeAny(true));
}
- if ( !bFoundSuppressVersionColumns && ( _eUsedFor == eAppSettings ) )
+ catch(const Exception&)
{
- try
- {
- xDataSource->setPropertyValue(PROPERTY_SUPPRESSVERSIONCL,makeAny(true));
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
}
}
}
diff --git a/dbaccess/source/filter/xml/xmlDataSourceInfo.cxx b/dbaccess/source/filter/xml/xmlDataSourceInfo.cxx
index 8f5c0dec4376..502d0cd4f34b 100644
--- a/dbaccess/source/filter/xml/xmlDataSourceInfo.cxx
+++ b/dbaccess/source/filter/xml/xmlDataSourceInfo.cxx
@@ -88,30 +88,30 @@ OXMLDataSourceInfo::OXMLDataSourceInfo( ODBFilter& rImport
aProperty.Value <<= true;
rImport.addInfo(aProperty);
}
- if ( rImport.isNewFormat() )
+ if ( !rImport.isNewFormat() )
+ return;
+
+ if ( (nElement & TOKEN_MASK) == XML_DELIMITER )
{
- if ( (nElement & TOKEN_MASK) == XML_DELIMITER )
+ if ( !bFoundField )
{
- if ( !bFoundField )
- {
- aProperty.Name = INFO_FIELDDELIMITER;
- aProperty.Value <<= OUString(";");
- rImport.addInfo(aProperty);
- }
- if ( !bFoundThousand )
- {
- aProperty.Name = INFO_THOUSANDSDELIMITER;
- aProperty.Value <<= OUString(",");
- rImport.addInfo(aProperty);
- }
+ aProperty.Name = INFO_FIELDDELIMITER;
+ aProperty.Value <<= OUString(";");
+ rImport.addInfo(aProperty);
}
- if ( (nElement & TOKEN_MASK) == XML_FONT_CHARSET && !bFoundCharset )
+ if ( !bFoundThousand )
{
- aProperty.Name = INFO_CHARSET;
- aProperty.Value <<= OUString("utf8");
+ aProperty.Name = INFO_THOUSANDSDELIMITER;
+ aProperty.Value <<= OUString(",");
rImport.addInfo(aProperty);
}
}
+ if ( (nElement & TOKEN_MASK) == XML_FONT_CHARSET && !bFoundCharset )
+ {
+ aProperty.Name = INFO_CHARSET;
+ aProperty.Value <<= OUString("utf8");
+ rImport.addInfo(aProperty);
+ }
}
OXMLDataSourceInfo::~OXMLDataSourceInfo()
diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx
index 014c5efa7e50..b5edc7b4d3e4 100644
--- a/dbaccess/source/filter/xml/xmlExport.cxx
+++ b/dbaccess/source/filter/xml/xmlExport.cxx
@@ -815,27 +815,27 @@ void ODBExport::exportCollection(const Reference< XNameAccess >& _xCollection
,const ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >& _aMemFunc
)
{
- if ( _xCollection.is() )
+ if ( !_xCollection.is() )
+ return;
+
+ std::unique_ptr<SvXMLElementExport> pComponents;
+ if ( _bExportContext )
+ pComponents.reset( new SvXMLElementExport(*this,XML_NAMESPACE_DB, _eComponents, true, true));
+ Sequence< OUString> aSeq = _xCollection->getElementNames();
+ const OUString* pIter = aSeq.getConstArray();
+ const OUString* pEnd = pIter + aSeq.getLength();
+ for(;pIter != pEnd;++pIter)
{
- std::unique_ptr<SvXMLElementExport> pComponents;
- if ( _bExportContext )
- pComponents.reset( new SvXMLElementExport(*this,XML_NAMESPACE_DB, _eComponents, true, true));
- Sequence< OUString> aSeq = _xCollection->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
- for(;pIter != pEnd;++pIter)
+ Reference<XPropertySet> xProp(_xCollection->getByName(*pIter),UNO_QUERY);
+ if ( _bExportContext && XML_TABLE_REPRESENTATIONS != _eComponents )
+ AddAttribute(XML_NAMESPACE_DB, XML_NAME,*pIter);
+ Reference< XNameAccess > xSub(xProp,UNO_QUERY);
+ if ( xSub.is() )
{
- Reference<XPropertySet> xProp(_xCollection->getByName(*pIter),UNO_QUERY);
- if ( _bExportContext && XML_TABLE_REPRESENTATIONS != _eComponents )
- AddAttribute(XML_NAMESPACE_DB, XML_NAME,*pIter);
- Reference< XNameAccess > xSub(xProp,UNO_QUERY);
- if ( xSub.is() )
- {
- exportCollection(xSub,_eSubComponents,_eSubComponents,_bExportContext,_aMemFunc);
- }
- else if ( xProp.is() )
- _aMemFunc(this,xProp.get());
+ exportCollection(xSub,_eSubComponents,_eSubComponents,_bExportContext,_aMemFunc);
}
+ else if ( xProp.is() )
+ _aMemFunc(this,xProp.get());
}
}
@@ -928,20 +928,20 @@ void ODBExport::exportTableName(XPropertySet* _xProp,bool _bUpdate)
{
OUString sValue;
_xProp->getPropertyValue(_bUpdate ? OUString(PROPERTY_UPDATE_TABLENAME) : OUString(PROPERTY_NAME)) >>= sValue;
+ if ( sValue.isEmpty() )
+ return;
+
+ AddAttribute(XML_NAMESPACE_DB, XML_NAME,sValue);
+ _xProp->getPropertyValue(_bUpdate ? OUString(PROPERTY_UPDATE_SCHEMANAME) : OUString(PROPERTY_SCHEMANAME)) >>= sValue;
if ( !sValue.isEmpty() )
+ AddAttribute(XML_NAMESPACE_DB, XML_SCHEMA_NAME,sValue);
+ _xProp->getPropertyValue(_bUpdate ? OUString(PROPERTY_UPDATE_CATALOGNAME) : OUString(PROPERTY_CATALOGNAME)) >>= sValue;
+ if ( !sValue.isEmpty() )
+ AddAttribute(XML_NAMESPACE_DB, XML_CATALOG_NAME,sValue);
+
+ if ( _bUpdate )
{
- AddAttribute(XML_NAMESPACE_DB, XML_NAME,sValue);
- _xProp->getPropertyValue(_bUpdate ? OUString(PROPERTY_UPDATE_SCHEMANAME) : OUString(PROPERTY_SCHEMANAME)) >>= sValue;
- if ( !sValue.isEmpty() )
- AddAttribute(XML_NAMESPACE_DB, XML_SCHEMA_NAME,sValue);
- _xProp->getPropertyValue(_bUpdate ? OUString(PROPERTY_UPDATE_CATALOGNAME) : OUString(PROPERTY_CATALOGNAME)) >>= sValue;
- if ( !sValue.isEmpty() )
- AddAttribute(XML_NAMESPACE_DB, XML_CATALOG_NAME,sValue);
-
- if ( _bUpdate )
- {
- SvXMLElementExport aComponents(*this,XML_NAMESPACE_DB, XML_UPDATE_TABLE, true, true);
- }
+ SvXMLElementExport aComponents(*this,XML_NAMESPACE_DB, XML_UPDATE_TABLE, true, true);
}
}
@@ -1046,17 +1046,17 @@ void ODBExport::exportForms()
OUString sService;
dbtools::getDataSourceSetting(getDataSource(),"Forms",aValue);
aValue >>= sService;
- if ( sService.isEmpty() )
+ if ( !sService.isEmpty() )
+ return;
+
+ Reference<XFormDocumentsSupplier> xSup(GetModel(),UNO_QUERY);
+ if ( xSup.is() )
{
- Reference<XFormDocumentsSupplier> xSup(GetModel(),UNO_QUERY);
- if ( xSup.is() )
+ Reference< XNameAccess > xCollection = xSup->getFormDocuments();
+ if ( xCollection.is() && xCollection->hasElements() )
{
- Reference< XNameAccess > xCollection = xSup->getFormDocuments();
- if ( xCollection.is() && xCollection->hasElements() )
- {
- ::comphelper::mem_fun1_t<ODBExport,XPropertySet* > aMemFunc(&ODBExport::exportComponent);
- exportCollection(xCollection,XML_FORMS,XML_COMPONENT_COLLECTION,true,aMemFunc);
- }
+ ::comphelper::mem_fun1_t<ODBExport,XPropertySet* > aMemFunc(&ODBExport::exportComponent);
+ exportCollection(xCollection,XML_FORMS,XML_COMPONENT_COLLECTION,true,aMemFunc);
}
}
}
@@ -1067,17 +1067,17 @@ void ODBExport::exportReports()
OUString sService;
dbtools::getDataSourceSetting(getDataSource(),"Reports",aValue);
aValue >>= sService;
- if ( sService.isEmpty() )
+ if ( !sService.isEmpty() )
+ return;
+
+ Reference<XReportDocumentsSupplier> xSup(GetModel(),UNO_QUERY);
+ if ( xSup.is() )
{
- Reference<XReportDocumentsSupplier> xSup(GetModel(),UNO_QUERY);
- if ( xSup.is() )
+ Reference< XNameAccess > xCollection = xSup->getReportDocuments();
+ if ( xCollection.is() && xCollection->hasElements() )
{
- Reference< XNameAccess > xCollection = xSup->getReportDocuments();
- if ( xCollection.is() && xCollection->hasElements() )
- {
- ::comphelper::mem_fun1_t<ODBExport,XPropertySet* > aMemFunc(&ODBExport::exportComponent);
- exportCollection(xCollection,XML_REPORTS,XML_COMPONENT_COLLECTION,true,aMemFunc);
- }
+ ::comphelper::mem_fun1_t<ODBExport,XPropertySet* > aMemFunc(&ODBExport::exportComponent);
+ exportCollection(xCollection,XML_REPORTS,XML_COMPONENT_COLLECTION,true,aMemFunc);
}
}
}
@@ -1088,41 +1088,41 @@ void ODBExport::exportQueries(bool _bExportContext)
OUString sService;
dbtools::getDataSourceSetting(getDataSource(),"CommandDefinitions",aValue);
aValue >>= sService;
- if ( sService.isEmpty() )
+ if ( !sService.isEmpty() )
+ return;
+
+ Reference<XQueryDefinitionsSupplier> xSup(getDataSource(),UNO_QUERY);
+ if ( !xSup.is() )
+ return;
+
+ Reference< XNameAccess > xCollection = xSup->getQueryDefinitions();
+ if ( xCollection.is() && xCollection->hasElements() )
{
- Reference<XQueryDefinitionsSupplier> xSup(getDataSource(),UNO_QUERY);
- if ( xSup.is() )
- {
- Reference< XNameAccess > xCollection = xSup->getQueryDefinitions();
- if ( xCollection.is() && xCollection->hasElements() )
- {
- std::unique_ptr< ::comphelper::mem_fun1_t<ODBExport,XPropertySet* > > pMemFunc;
- if ( _bExportContext )
- pMemFunc.reset( new ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >(&ODBExport::exportQuery) );
- else
- pMemFunc.reset( new ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >(&ODBExport::exportAutoStyle) );
+ std::unique_ptr< ::comphelper::mem_fun1_t<ODBExport,XPropertySet* > > pMemFunc;
+ if ( _bExportContext )
+ pMemFunc.reset( new ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >(&ODBExport::exportQuery) );
+ else
+ pMemFunc.reset( new ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >(&ODBExport::exportAutoStyle) );
- exportCollection(xCollection,XML_QUERIES,XML_QUERY_COLLECTION,_bExportContext,*pMemFunc);
- }
- }
+ exportCollection(xCollection,XML_QUERIES,XML_QUERY_COLLECTION,_bExportContext,*pMemFunc);
}
}
void ODBExport::exportTables(bool _bExportContext)
{
Reference<XTablesSupplier> xSup(getDataSource(),UNO_QUERY);
- if ( xSup.is() )
+ if ( !xSup.is() )
+ return;
+
+ Reference< XNameAccess > xCollection = xSup->getTables();
+ if ( xCollection.is() && xCollection->hasElements() )
{
- Reference< XNameAccess > xCollection = xSup->getTables();
- if ( xCollection.is() && xCollection->hasElements() )
- {
- std::unique_ptr< ::comphelper::mem_fun1_t<ODBExport,XPropertySet* > > pMemFunc;
- if ( _bExportContext )
- pMemFunc.reset( new ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >(&ODBExport::exportTable) );
- else
- pMemFunc.reset( new ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >(&ODBExport::exportAutoStyle) );
- exportCollection(xCollection,XML_TABLE_REPRESENTATIONS,XML_TOKEN_INVALID,_bExportContext,*pMemFunc);
- }
+ std::unique_ptr< ::comphelper::mem_fun1_t<ODBExport,XPropertySet* > > pMemFunc;
+ if ( _bExportContext )
+ pMemFunc.reset( new ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >(&ODBExport::exportTable) );
+ else
+ pMemFunc.reset( new ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >(&ODBExport::exportAutoStyle) );
+ exportCollection(xCollection,XML_TABLE_REPRESENTATIONS,XML_TOKEN_INVALID,_bExportContext,*pMemFunc);
}
}
@@ -1252,37 +1252,37 @@ void ODBExport::ExportAutoStyles_()
void ODBExport::GetViewSettings(Sequence<PropertyValue>& aProps)
{
Reference<XQueryDefinitionsSupplier> xSup(getDataSource(),UNO_QUERY);
- if ( xSup.is() )
+ if ( !xSup.is() )
+ return;
+
+ Reference< XNameAccess > xCollection = xSup->getQueryDefinitions();
+ if ( !(xCollection.is() && xCollection->hasElements()) )
+ return;
+
+ try
{
- Reference< XNameAccess > xCollection = xSup->getQueryDefinitions();
- if ( xCollection.is() && xCollection->hasElements() )
+ sal_Int32 nLength = aProps.getLength();
+ aProps.realloc(nLength + 1);
+ aProps[nLength].Name = "Queries";
+ Sequence< OUString> aSeq = xCollection->getElementNames();
+ const OUString* pIter = aSeq.getConstArray();
+ const OUString* pEnd = pIter + aSeq.getLength();
+
+ Sequence<PropertyValue> aQueries(aSeq.getLength());
+ for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i)
{
- try
- {
- sal_Int32 nLength = aProps.getLength();
- aProps.realloc(nLength + 1);
- aProps[nLength].Name = "Queries";
- Sequence< OUString> aSeq = xCollection->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
-
- Sequence<PropertyValue> aQueries(aSeq.getLength());
- for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i)
- {
- Reference<XPropertySet> xProp(xCollection->getByName(*pIter),UNO_QUERY);
- if ( xProp.is() )
- {
- aQueries[i].Name = *pIter;
- aQueries[i].Value = xProp->getPropertyValue(PROPERTY_LAYOUTINFORMATION);
- }
- }
- aProps[nLength].Value <<= aQueries;
- }
- catch(const Exception&)
+ Reference<XPropertySet> xProp(xCollection->getByName(*pIter),UNO_QUERY);
+ if ( xProp.is() )
{
- OSL_FAIL("ODBExport::GetViewSettings: Exception caught!");
+ aQueries[i].Name = *pIter;
+ aQueries[i].Value = xProp->getPropertyValue(PROPERTY_LAYOUTINFORMATION);
}
}
+ aProps[nLength].Value <<= aQueries;
+ }
+ catch(const Exception&)
+ {
+ OSL_FAIL("ODBExport::GetViewSettings: Exception caught!");
}
}
@@ -1290,26 +1290,26 @@ void ODBExport::GetViewSettings(Sequence<PropertyValue>& aProps)
void ODBExport::GetConfigurationSettings(Sequence<PropertyValue>& aProps)
{
Reference<XPropertySet> xProp(getDataSource());
- if ( xProp.is() )
+ if ( !xProp.is() )
+ return;
+
+ sal_Int32 nLength = aProps.getLength();
+ try
{
- sal_Int32 nLength = aProps.getLength();
- try
+ Any aValue = xProp->getPropertyValue(PROPERTY_LAYOUTINFORMATION);
+ Sequence< PropertyValue > aPropValues;
+ aValue >>= aPropValues;
+ if ( aPropValues.hasElements() )
{
- Any aValue = xProp->getPropertyValue(PROPERTY_LAYOUTINFORMATION);
- Sequence< PropertyValue > aPropValues;
- aValue >>= aPropValues;
- if ( aPropValues.hasElements() )
- {
- aProps.realloc(nLength + 1);
- aProps[nLength].Name = "layout-settings";
- aProps[nLength].Value = aValue;
- }
- }
- catch(const Exception&)
- {
- OSL_FAIL("Could not access layout information from the data source!");
+ aProps.realloc(nLength + 1);
+ aProps[nLength].Name = "layout-settings";
+ aProps[nLength].Value = aValue;
}
}
+ catch(const Exception&)
+ {
+ OSL_FAIL("Could not access layout information from the data source!");
+ }
}
OUString ODBExport::implConvertAny(const Any& _rValue)
diff --git a/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx b/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx
index 79fa94a4b2cc..5d7207a98486 100644
--- a/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx
+++ b/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx
@@ -90,18 +90,18 @@ OXMLFileBasedDatabase::OXMLFileBasedDatabase( ODBFilter& rImport,
}
}
}
- if ( !(sLocation.isEmpty() || sMediaType.isEmpty()) )
+ if ( sLocation.isEmpty() || sMediaType.isEmpty() )
+ return;
+
+ ::dbaccess::ODsnTypeCollection aTypeCollection(rImport.GetComponentContext());
+ OUString sURL = aTypeCollection.getDatasourcePrefixFromMediaType(sMediaType,sFileTypeExtension) + sLocation;
+ try
{
- ::dbaccess::ODsnTypeCollection aTypeCollection(rImport.GetComponentContext());
- OUString sURL = aTypeCollection.getDatasourcePrefixFromMediaType(sMediaType,sFileTypeExtension) + sLocation;
- try
- {
- xDataSource->setPropertyValue(PROPERTY_URL,makeAny(sURL));
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
+ xDataSource->setPropertyValue(PROPERTY_URL,makeAny(sURL));
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
}
}
diff --git a/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx b/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx
index cf616cf7a46d..79035c07bdac 100644
--- a/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx
+++ b/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx
@@ -61,29 +61,29 @@ OXMLHierarchyCollection::OXMLHierarchyCollection( ODBFilter& rImport
SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
}
}
- if ( !sName.isEmpty() && _xParentContainer.is() )
+ if ( !(!sName.isEmpty() && _xParentContainer.is()) )
+ return;
+
+ try
{
- try
+ Reference<XMultiServiceFactory> xORB(_xParentContainer,UNO_QUERY);
+ if ( xORB.is() )
{
- Reference<XMultiServiceFactory> xORB(_xParentContainer,UNO_QUERY);
- if ( xORB.is() )
+ Sequence<Any> aArguments(comphelper::InitAnyPropertySequence(
{
- Sequence<Any> aArguments(comphelper::InitAnyPropertySequence(
- {
- {"Name", Any(sName)}, // set as folder
- {"Parent", Any(_xParentContainer)},
- }));
- m_xContainer.set(xORB->createInstanceWithArguments(_sCollectionServiceName,aArguments),UNO_QUERY);
- Reference<XNameContainer> xNameContainer(_xParentContainer,UNO_QUERY);
- if ( xNameContainer.is() && !xNameContainer->hasByName(sName) )
- xNameContainer->insertByName(sName,makeAny(m_xContainer));
- }
- }
- catch(Exception&)
- {
- OSL_FAIL("OXMLHierarchyCollection::OXMLHierarchyCollection -> exception caught");
+ {"Name", Any(sName)}, // set as folder
+ {"Parent", Any(_xParentContainer)},
+ }));
+ m_xContainer.set(xORB->createInstanceWithArguments(_sCollectionServiceName,aArguments),UNO_QUERY);
+ Reference<XNameContainer> xNameContainer(_xParentContainer,UNO_QUERY);
+ if ( xNameContainer.is() && !xNameContainer->hasByName(sName) )
+ xNameContainer->insertByName(sName,makeAny(m_xContainer));
}
}
+ catch(Exception&)
+ {
+ OSL_FAIL("OXMLHierarchyCollection::OXMLHierarchyCollection -> exception caught");
+ }
}
OXMLHierarchyCollection::OXMLHierarchyCollection( ODBFilter& rImport
diff --git a/dbaccess/source/filter/xml/xmlLogin.cxx b/dbaccess/source/filter/xml/xmlLogin.cxx
index 84a880ba1a19..c94f0a07162d 100644
--- a/dbaccess/source/filter/xml/xmlLogin.cxx
+++ b/dbaccess/source/filter/xml/xmlLogin.cxx
@@ -38,71 +38,71 @@ OXMLLogin::OXMLLogin( ODBFilter& rImport,
static const OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
bool bUserFound = false;
- if (xDataSource.is())
+ if (!xDataSource.is())
+ return;
+
+ sax_fastparser::FastAttributeList *pAttribList =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( _xAttrList );
+ for (auto &aIter : *pAttribList)
{
- sax_fastparser::FastAttributeList *pAttribList =
- sax_fastparser::FastAttributeList::castToFastAttributeList( _xAttrList );
- for (auto &aIter : *pAttribList)
- {
- OUString sValue = aIter.toString();
+ OUString sValue = aIter.toString();
- try
+ try
+ {
+ switch( aIter.getToken() & TOKEN_MASK )
{
- switch( aIter.getToken() & TOKEN_MASK )
- {
- case XML_USER_NAME:
- if ( !bUserFound )
- {
- bUserFound = true;
- try
- {
- xDataSource->setPropertyValue(PROPERTY_USER,makeAny(sValue));
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
- }
- break;
- case XML_IS_PASSWORD_REQUIRED:
- try
- {
- xDataSource->setPropertyValue(PROPERTY_ISPASSWORDREQUIRED,makeAny(sValue == s_sTRUE));
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
- break;
- case XML_USE_SYSTEM_USER:
- if ( !bUserFound )
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list