summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-15 08:56:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-15 09:39:03 +0200
commit598a65a3c1632c24f2aac38c5a2c9f6a55618cd6 (patch)
treeab510c8d34e95b8414c0a43726a0152073ed277d /dbaccess
parentb9db7c7236ab75199c281a510546d6778d28e474 (diff)
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@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/api/BookmarkSet.cxx136
-rw-r--r--dbaccess/source/core/api/CacheSet.cxx54
-rw-r--r--dbaccess/source/core/api/KeySet.cxx24
-rw-r--r--dbaccess/source/core/api/RowSet.cxx238
-rw-r--r--dbaccess/source/core/api/RowSetCache.cxx60
-rw-r--r--dbaccess/source/core/api/StaticSet.cxx22
-rw-r--r--dbaccess/source/core/api/WrappedResultSet.cxx136
-rw-r--r--dbaccess/source/core/api/definitioncolumn.cxx26
-rw-r--r--dbaccess/source/core/api/tablecontainer.cxx24
-rw-r--r--dbaccess/source/core/api/viewcontainer.cxx82
-rw-r--r--dbaccess/source/core/dataaccess/ContentHelper.cxx90
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx24
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx48
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx214
-rw-r--r--dbaccess/source/core/dataaccess/definitioncontainer.cxx38
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx52
-rw-r--r--dbaccess/source/core/misc/ContainerMediator.cxx74
-rw-r--r--dbaccess/source/filter/xml/xmlAutoStyle.cxx34
-rw-r--r--dbaccess/source/filter/xml/xmlComponent.cxx36
-rw-r--r--dbaccess/source/filter/xml/xmlConnectionResource.cxx76
-rw-r--r--dbaccess/source/filter/xml/xmlDataSource.cxx52
-rw-r--r--dbaccess/source/filter/xml/xmlDataSourceInfo.cxx34
-rw-r--r--dbaccess/source/filter/xml/xmlExport.cxx232
-rw-r--r--dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx22
-rw-r--r--dbaccess/source/filter/xml/xmlHierarchyCollection.cxx36
-rw-r--r--dbaccess/source/filter/xml/xmlLogin.cxx106
-rw-r--r--dbaccess/source/filter/xml/xmlServerDatabase.cxx84
-rw-r--r--dbaccess/source/filter/xml/xmlTable.cxx38
-rw-r--r--dbaccess/source/ui/app/AppController.cxx150
-rw-r--r--dbaccess/source/ui/app/AppControllerDnD.cxx324
-rw-r--r--dbaccess/source/ui/app/AppControllerGen.cxx200
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx482
-rw-r--r--dbaccess/source/ui/app/AppView.cxx48
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx124
-rw-r--r--dbaccess/source/ui/browser/dataview.cxx32
-rw-r--r--dbaccess/source/ui/browser/dsEntriesNoExp.cxx84
-rw-r--r--dbaccess/source/ui/browser/exsrcbrw.cxx53
-rw-r--r--dbaccess/source/ui/browser/formadapter.cxx46
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx300
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx92
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx34
-rw-r--r--dbaccess/source/ui/control/RelationControl.cxx20
-rw-r--r--dbaccess/source/ui/control/TableGrantCtrl.cxx44
-rw-r--r--dbaccess/source/ui/control/sqledit.cxx22
-rw-r--r--dbaccess/source/ui/dlg/ConnectionPage.cxx50
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx28
-rw-r--r--dbaccess/source/ui/dlg/adminpages.cxx88
-rw-r--r--dbaccess/source/ui/dlg/dbfindex.cxx26
-rw-r--r--dbaccess/source/ui/dlg/generalpage.cxx148
-rw-r--r--dbaccess/source/ui/dlg/indexdialog.cxx34
-rw-r--r--dbaccess/source/ui/dlg/indexfieldscontrol.cxx53
-rw-r--r--dbaccess/source/ui/dlg/odbcconfig.cxx30
-rw-r--r--dbaccess/source/ui/dlg/queryfilter.cxx36
-rw-r--r--dbaccess/source/ui/dlg/sqlmessage.cxx22
-rw-r--r--dbaccess/source/ui/misc/DExport.cxx334
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx516
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx158
-rw-r--r--dbaccess/source/ui/misc/WNameMatch.cxx80
-rw-r--r--dbaccess/source/ui/misc/indexcollection.cxx86
-rw-r--r--dbaccess/source/ui/querydesign/JoinController.cxx42
-rw-r--r--dbaccess/source/ui/querydesign/JoinTableView.cxx118
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx46
-rw-r--r--dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx30
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx88
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx138
-rw-r--r--dbaccess/source/ui/querydesign/TableFieldDescription.cxx28
-rw-r--r--dbaccess/source/ui/querydesign/TableWindow.cxx46
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowData.cxx32
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowTitle.cxx40
-rw-r--r--dbaccess/source/ui/querydesign/limitboxcontroller.cxx24
-rw-r--r--dbaccess/source/ui/querydesign/querycontainerwindow.cxx70
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx170
-rw-r--r--dbaccess/source/ui/querydesign/querydlg.cxx36
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnectionData.cxx32
-rw-r--r--dbaccess/source/ui/relationdesign/RelationController.cxx108
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescriptions.cxx298
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx60
-rw-r--r--dbaccess/source/ui/uno/ColumnControl.cxx106
-rw-r--r--dbaccess/source/ui/uno/ColumnPeer.cxx70
79 files changed, 3710 insertions, 3708 deletions
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 )
- {
- bUserFound = true;
- PropertyValue aProperty;
- aProperty.Name = "UseSystemUser";
- aProperty.Value <<= (sValue == s_sTRUE);
- rImport.addInfo(aProperty);
- }
- break;
- case XML_LOGIN_TIMEOUT:
+ case XML_USER_NAME:
+ if ( !bUserFound )
+ {
+ bUserFound = true;
try
{
- Reference< XDataSource>(xDataSource,UNO_QUERY_THROW)->setLoginTimeout(sValue.toInt32());
+ xDataSource->setPropertyValue(PROPERTY_USER,makeAny(sValue));
}
catch(const Exception&)
{
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- break;
- default:
- SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
- }
- }
- 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 )
+ {
+ bUserFound = true;
+ PropertyValue aProperty;
+ aProperty.Name = "UseSystemUser";
+ aProperty.Value <<= (sValue == s_sTRUE);
+ rImport.addInfo(aProperty);
+ }
+ break;
+ case XML_LOGIN_TIMEOUT:
+ try
+ {
+ Reference< XDataSource>(xDataSource,UNO_QUERY_THROW)->setLoginTimeout(sValue.toInt32());
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
+ break;
+ default:
+ SAL_WARN("dbaccess", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << aIter.toString());
}
}
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
}
}
diff --git a/dbaccess/source/filter/xml/xmlServerDatabase.cxx b/dbaccess/source/filter/xml/xmlServerDatabase.cxx
index 992803c5ed94..8c77f9591352 100644
--- a/dbaccess/source/filter/xml/xmlServerDatabase.cxx
+++ b/dbaccess/source/filter/xml/xmlServerDatabase.cxx
@@ -69,61 +69,61 @@ OXMLServerDatabase::OXMLServerDatabase( ODBFilter& rImport,
}
}
}
- if ( !sType.isEmpty() )
+ if ( sType.isEmpty() )
+ return;
+
+ OUStringBuffer sURL;
+ if ( sType == "sdbc:mysql:jdbc" || sType == "sdbc:mysqlc" || sType == "sdbc:mysql:mysqlc" )
{
- OUStringBuffer sURL;
- if ( sType == "sdbc:mysql:jdbc" || sType == "sdbc:mysqlc" || sType == "sdbc:mysql:mysqlc" )
+ sURL.append( sType ).append( ":" ).append(sHostName);
+ if ( !sPortNumber.isEmpty() )
{
- sURL.append( sType ).append( ":" ).append(sHostName);
- if ( !sPortNumber.isEmpty() )
- {
- sURL.append(":").append(sPortNumber);
- }
- if ( !sDatabaseName.isEmpty() )
- {
- sURL.append("/").append(sDatabaseName);
- }
+ sURL.append(":").append(sPortNumber);
}
- else if ( sType == "jdbc:oracle:thin" )
+ if ( !sDatabaseName.isEmpty() )
{
- sURL.append("jdbc:oracle:thin:@").append(sHostName);
- if ( !sPortNumber.isEmpty() )
- {
- sURL.append(":").append(sPortNumber);
- }
- if ( !sDatabaseName.isEmpty() )
- {
- sURL.append(":").append(sDatabaseName);
- }
+ sURL.append("/").append(sDatabaseName);
}
- else if ( sType == "sdbc:address:ldap" )
+ }
+ else if ( sType == "jdbc:oracle:thin" )
+ {
+ sURL.append("jdbc:oracle:thin:@").append(sHostName);
+ if ( !sPortNumber.isEmpty() )
{
- sURL.append("sdbc:address:ldap:").append(sHostName);
- if ( !sPortNumber.isEmpty() )
- {
- sURL.append(":").append(sPortNumber);
- }
+ sURL.append(":").append(sPortNumber);
}
- else
+ if ( !sDatabaseName.isEmpty() )
{
- sURL.append(sType).append(":").append(sHostName);
- if ( !sPortNumber.isEmpty() )
- {
- sURL.append(":").append(sPortNumber);
- }
- if ( !sDatabaseName.isEmpty() )
- {
- sURL.append(":").append(sDatabaseName);
- }
+ sURL.append(":").append(sDatabaseName);
}
- try
+ }
+ else if ( sType == "sdbc:address:ldap" )
+ {
+ sURL.append("sdbc:address:ldap:").append(sHostName);
+ if ( !sPortNumber.isEmpty() )
{
- xDataSource->setPropertyValue(PROPERTY_URL,makeAny(sURL.makeStringAndClear()));
+ sURL.append(":").append(sPortNumber);
}
- catch(const Exception&)
+ }
+ else
+ {
+ sURL.append(sType).append(":").append(sHostName);
+ if ( !sPortNumber.isEmpty() )
{
- DBG_UNHANDLED_EXCEPTION("dbaccess");
+ sURL.append(":").append(sPortNumber);
}
+ if ( !sDatabaseName.isEmpty() )
+ {
+ sURL.append(":").append(sDatabaseName);
+ }
+ }
+ try
+ {
+ xDataSource->setPropertyValue(PROPERTY_URL,makeAny(sURL.makeStringAndClear()));
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
}
}
diff --git a/dbaccess/source/filter/xml/xmlTable.cxx b/dbaccess/source/filter/xml/xmlTable.cxx
index b728a88edaed..18c7f25dbaf3 100644
--- a/dbaccess/source/filter/xml/xmlTable.cxx
+++ b/dbaccess/source/filter/xml/xmlTable.cxx
@@ -161,34 +161,34 @@ void OXMLTable::setProperties(uno::Reference< XPropertySet > & _xProp )
void OXMLTable::endFastElement(sal_Int32 )
{
uno::Reference<XNameContainer> xNameContainer(m_xParentContainer,UNO_QUERY);
- if ( xNameContainer.is() )
+ if ( !xNameContainer.is() )
+ return;
+
+ try
{
- try
+ if ( m_xTable.is() )
{
- if ( m_xTable.is() )
- {
- setProperties(m_xTable);
+ setProperties(m_xTable);
- if ( !m_sStyleName.isEmpty() )
+ if ( !m_sStyleName.isEmpty() )
+ {
+ const SvXMLStylesContext* pAutoStyles = GetOwnImport().GetAutoStyles();
+ if ( pAutoStyles )
{
- const SvXMLStylesContext* pAutoStyles = GetOwnImport().GetAutoStyles();
- if ( pAutoStyles )
+ OTableStyleContext* pAutoStyle = const_cast<OTableStyleContext*>(dynamic_cast< const OTableStyleContext* >(pAutoStyles->FindStyleChildContext(XmlStyleFamily::TABLE_TABLE,m_sStyleName)));
+ if ( pAutoStyle )
{
- OTableStyleContext* pAutoStyle = const_cast<OTableStyleContext*>(dynamic_cast< const OTableStyleContext* >(pAutoStyles->FindStyleChildContext(XmlStyleFamily::TABLE_TABLE,m_sStyleName)));
- if ( pAutoStyle )
- {
- pAutoStyle->FillPropertySet(m_xTable);
- }
+ pAutoStyle->FillPropertySet(m_xTable);
}
}
-
- xNameContainer->insertByName(m_sName,makeAny(m_xTable));
}
+
+ xNameContainer->insertByName(m_sName,makeAny(m_xTable));
}
- catch(Exception&)
- {
- OSL_FAIL("OXMLQuery::EndElement -> exception caught");
- }
+ }
+ catch(Exception&)
+ {
+ OSL_FAIL("OXMLQuery::EndElement -> exception caught");
}
}
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 58393e84d0bb..f2ae1614eff0 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -1486,34 +1486,34 @@ void SAL_CALL OApplicationController::elementInserted( const ContainerEvent& _rE
::osl::MutexGuard aGuard( getMutex() );
Reference< XContainer > xContainer(_rEvent.Source, UNO_QUERY);
- if ( std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) != m_aCurrentContainers.end() )
- {
- OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
- if ( getContainer() )
- {
- OUString sName;
- _rEvent.Accessor >>= sName;
- ElementType eType = getElementType(xContainer);
+ if ( std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) == m_aCurrentContainers.end() )
+ return;
- switch( eType )
+ OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
+ if ( !getContainer() )
+ return;
+
+ OUString sName;
+ _rEvent.Accessor >>= sName;
+ ElementType eType = getElementType(xContainer);
+
+ switch( eType )
+ {
+ case E_TABLE:
+ ensureConnection();
+ break;
+ case E_FORM:
+ case E_REPORT:
{
- case E_TABLE:
- ensureConnection();
- break;
- case E_FORM:
- case E_REPORT:
- {
- Reference< XContainer > xSubContainer(_rEvent.Element,UNO_QUERY);
- if ( xSubContainer.is() )
- containerFound(xSubContainer);
- }
- break;
- default:
- break;
+ Reference< XContainer > xSubContainer(_rEvent.Element,UNO_QUERY);
+ if ( xSubContainer.is() )
+ containerFound(xSubContainer);
}
- getContainer()->elementAdded(eType,sName,_rEvent.Element);
- }
+ break;
+ default:
+ break;
}
+ getContainer()->elementAdded(eType,sName,_rEvent.Element);
}
void SAL_CALL OApplicationController::elementRemoved( const ContainerEvent& _rEvent )
@@ -1522,17 +1522,61 @@ void SAL_CALL OApplicationController::elementRemoved( const ContainerEvent& _rEv
::osl::MutexGuard aGuard( getMutex() );
Reference< XContainer > xContainer(_rEvent.Source, UNO_QUERY);
- if ( std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) != m_aCurrentContainers.end() )
+ if ( std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) == m_aCurrentContainers.end() )
+ return;
+
+ OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
+ OUString sName;
+ _rEvent.Accessor >>= sName;
+ ElementType eType = getElementType(xContainer);
+ switch( eType )
+ {
+ case E_TABLE:
+ ensureConnection();
+ break;
+ case E_FORM:
+ case E_REPORT:
+ {
+ Reference<XContent> xContent(xContainer,UNO_QUERY);
+ if ( xContent.is() )
+ {
+ sName = xContent->getIdentifier()->getContentIdentifier() + "/" + sName;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ getContainer()->elementRemoved(eType,sName);
+}
+
+void SAL_CALL OApplicationController::elementReplaced( const ContainerEvent& _rEvent )
+{
+ SolarMutexGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getMutex() );
+
+ Reference< XContainer > xContainer(_rEvent.Source, UNO_QUERY);
+ if ( std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) == m_aCurrentContainers.end() )
+ return;
+
+ OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
+ OUString sName;
+ try
{
- OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
- OUString sName;
_rEvent.Accessor >>= sName;
+ Reference<XPropertySet> xProp(_rEvent.Element,UNO_QUERY);
+ OUString sNewName;
+
ElementType eType = getElementType(xContainer);
switch( eType )
{
case E_TABLE:
+ {
ensureConnection();
- break;
+ if ( xProp.is() && m_xMetaData.is() )
+ sNewName = ::dbaui::composeTableName( m_xMetaData, xProp, ::dbtools::EComposeRule::InDataManipulation, false );
+ }
+ break;
case E_FORM:
case E_REPORT:
{
@@ -1546,55 +1590,11 @@ void SAL_CALL OApplicationController::elementRemoved( const ContainerEvent& _rEv
default:
break;
}
- getContainer()->elementRemoved(eType,sName);
+ // getContainer()->elementReplaced(getContainer()->getElementType(),sName,sNewName);
}
-}
-
-void SAL_CALL OApplicationController::elementReplaced( const ContainerEvent& _rEvent )
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
- Reference< XContainer > xContainer(_rEvent.Source, UNO_QUERY);
- if ( std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) != m_aCurrentContainers.end() )
+ catch( Exception& )
{
- OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
- OUString sName;
- try
- {
- _rEvent.Accessor >>= sName;
- Reference<XPropertySet> xProp(_rEvent.Element,UNO_QUERY);
- OUString sNewName;
-
- ElementType eType = getElementType(xContainer);
- switch( eType )
- {
- case E_TABLE:
- {
- ensureConnection();
- if ( xProp.is() && m_xMetaData.is() )
- sNewName = ::dbaui::composeTableName( m_xMetaData, xProp, ::dbtools::EComposeRule::InDataManipulation, false );
- }
- break;
- case E_FORM:
- case E_REPORT:
- {
- Reference<XContent> xContent(xContainer,UNO_QUERY);
- if ( xContent.is() )
- {
- sName = xContent->getIdentifier()->getContentIdentifier() + "/" + sName;
- }
- }
- break;
- default:
- break;
- }
- // getContainer()->elementReplaced(getContainer()->getElementType(),sName,sNewName);
- }
- catch( Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
}
}
diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx
index 9c5adfb43995..845945b9567f 100644
--- a/dbaccess/source/ui/app/AppControllerDnD.cxx
+++ b/dbaccess/source/ui/app/AppControllerDnD.cxx
@@ -101,184 +101,184 @@ void OApplicationController::deleteTables(const std::vector< OUString>& _rList)
Reference<XTablesSupplier> xSup(xConnection,UNO_QUERY);
OSL_ENSURE(xSup.is(),"OApplicationController::deleteTable: no XTablesSupplier!");
- if ( xSup.is() )
+ if ( !xSup.is() )
+ return;
+
+ Reference<XNameAccess> xTables = xSup->getTables();
+ Reference<XDrop> xDrop(xTables,UNO_QUERY);
+ if ( xDrop.is() )
{
- Reference<XNameAccess> xTables = xSup->getTables();
- Reference<XDrop> xDrop(xTables,UNO_QUERY);
- if ( xDrop.is() )
+ bool bConfirm = true;
+ std::vector< OUString>::const_iterator aEnd = _rList.end();
+ for (std::vector< OUString>::const_iterator aIter = _rList.begin(); aIter != aEnd; ++aIter)
{
- bool bConfirm = true;
- std::vector< OUString>::const_iterator aEnd = _rList.end();
- for (std::vector< OUString>::const_iterator aIter = _rList.begin(); aIter != aEnd; ++aIter)
- {
- OUString sTableName = *aIter;
+ OUString sTableName = *aIter;
- sal_Int32 nResult = RET_YES;
- if ( bConfirm )
- nResult = ::dbaui::askForUserAction(getFrameWeld(), STR_TITLE_CONFIRM_DELETION, STR_QUERY_DELETE_TABLE, _rList.size() > 1 && (aIter+1) != _rList.end(), sTableName);
+ sal_Int32 nResult = RET_YES;
+ if ( bConfirm )
+ nResult = ::dbaui::askForUserAction(getFrameWeld(), STR_TITLE_CONFIRM_DELETION, STR_QUERY_DELETE_TABLE, _rList.size() > 1 && (aIter+1) != _rList.end(), sTableName);
- bool bUserConfirmedDelete =
- ( RET_YES == nResult )
- || ( RET_ALL == nResult );
- if ( bUserConfirmedDelete && m_pSubComponentManager->closeSubFrames( sTableName, E_TABLE ) )
+ bool bUserConfirmedDelete =
+ ( RET_YES == nResult )
+ || ( RET_ALL == nResult );
+ if ( bUserConfirmedDelete && m_pSubComponentManager->closeSubFrames( sTableName, E_TABLE ) )
+ {
+ SQLExceptionInfo aErrorInfo;
+ try
{
- SQLExceptionInfo aErrorInfo;
- try
- {
- if ( xTables->hasByName(sTableName) )
- xDrop->dropByName(sTableName);
- else
- {// could be a view
- Reference<XViewsSupplier> xViewsSup(xConnection,UNO_QUERY);
-
- Reference<XNameAccess> xViews;
- if ( xViewsSup.is() )
+ if ( xTables->hasByName(sTableName) )
+ xDrop->dropByName(sTableName);
+ else
+ {// could be a view
+ Reference<XViewsSupplier> xViewsSup(xConnection,UNO_QUERY);
+
+ Reference<XNameAccess> xViews;
+ if ( xViewsSup.is() )
+ {
+ xViews = xViewsSup->getViews();
+ if ( xViews.is() && xViews->hasByName(sTableName) )
{
- xViews = xViewsSup->getViews();
- if ( xViews.is() && xViews->hasByName(sTableName) )
- {
- xDrop.set(xViews,UNO_QUERY);
- if ( xDrop.is() )
- xDrop->dropByName(sTableName);
- }
+ xDrop.set(xViews,UNO_QUERY);
+ if ( xDrop.is() )
+ xDrop->dropByName(sTableName);
}
}
}
- catch(SQLContext& e) { aErrorInfo = e; }
- catch(SQLWarning& e) { aErrorInfo = e; }
- catch(SQLException& e) { aErrorInfo = e; }
- catch(WrappedTargetException& e)
- {
- SQLException aSql;
- if(e.TargetException >>= aSql)
- aErrorInfo = aSql;
- else
- OSL_FAIL("OApplicationController::implDropTable: something strange happened!");
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
+ }
+ catch(SQLContext& e) { aErrorInfo = e; }
+ catch(SQLWarning& e) { aErrorInfo = e; }
+ catch(SQLException& e) { aErrorInfo = e; }
+ catch(WrappedTargetException& e)
+ {
+ SQLException aSql;
+ if(e.TargetException >>= aSql)
+ aErrorInfo = aSql;
+ else
+ OSL_FAIL("OApplicationController::implDropTable: something strange happened!");
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
- if ( aErrorInfo.isValid() )
- showError(aErrorInfo);
+ if ( aErrorInfo.isValid() )
+ showError(aErrorInfo);
- if ( RET_ALL == nResult )
- bConfirm = false;
- }
- else
- break;
+ if ( RET_ALL == nResult )
+ bConfirm = false;
}
- }
- else
- {
- OUString sMessage(DBA_RES(STR_MISSING_TABLES_XDROP));
- std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(getFrameWeld(),
- VclMessageType::Warning, VclButtonsType::Ok,
- sMessage));
- xError->run();
+ else
+ break;
}
}
+ else
+ {
+ OUString sMessage(DBA_RES(STR_MISSING_TABLES_XDROP));
+ std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(getFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok,
+ sMessage));
+ xError->run();
+ }
}
void OApplicationController::deleteObjects( ElementType _eType, const std::vector< OUString>& _rList, bool _bConfirm )
{
Reference< XNameContainer > xNames( getElements( _eType ), UNO_QUERY );
Reference< XHierarchicalNameContainer > xHierarchyName( xNames, UNO_QUERY );
- if ( xNames.is() )
+ if ( !xNames.is() )
+ return;
+
+ short eResult = _bConfirm ? svtools::QUERYDELETE_YES : svtools::QUERYDELETE_ALL;
+
+ // The list of elements to delete is allowed to contain related elements: A given element may
+ // be the ancestor or child of another element from the list.
+ // We want to ensure that ancestors get deleted first, so we normalize the list in this respect.
+ // #i33353#
+ std::set< OUString > aDeleteNames;
+ // Note that this implicitly uses std::less< OUString > a comparison operation, which
+ // results in lexicographical order, which is exactly what we need, because "foo" is *before*
+ // any "foo/bar" in this order.
+ std::copy(
+ _rList.begin(), _rList.end(),
+ std::insert_iterator< std::set< OUString > >( aDeleteNames, aDeleteNames.begin() )
+ );
+
+ std::set< OUString >::size_type nCount = aDeleteNames.size();
+ for ( std::set< OUString >::size_type nObjectsLeft = nCount; !aDeleteNames.empty(); )
{
- short eResult = _bConfirm ? svtools::QUERYDELETE_YES : svtools::QUERYDELETE_ALL;
-
- // The list of elements to delete is allowed to contain related elements: A given element may
- // be the ancestor or child of another element from the list.
- // We want to ensure that ancestors get deleted first, so we normalize the list in this respect.
- // #i33353#
- std::set< OUString > aDeleteNames;
- // Note that this implicitly uses std::less< OUString > a comparison operation, which
- // results in lexicographical order, which is exactly what we need, because "foo" is *before*
- // any "foo/bar" in this order.
- std::copy(
- _rList.begin(), _rList.end(),
- std::insert_iterator< std::set< OUString > >( aDeleteNames, aDeleteNames.begin() )
- );
-
- std::set< OUString >::size_type nCount = aDeleteNames.size();
- for ( std::set< OUString >::size_type nObjectsLeft = nCount; !aDeleteNames.empty(); )
- {
- std::set< OUString >::const_iterator aThisRound = aDeleteNames.begin();
+ std::set< OUString >::const_iterator aThisRound = aDeleteNames.begin();
- if ( eResult != svtools::QUERYDELETE_ALL )
- {
- svtools::QueryDeleteDlg_Impl aDlg(getFrameWeld(), *aThisRound);
+ if ( eResult != svtools::QUERYDELETE_ALL )
+ {
+ svtools::QueryDeleteDlg_Impl aDlg(getFrameWeld(), *aThisRound);
- if ( nObjectsLeft > 1 )
- aDlg.EnableAllButton();
+ if ( nObjectsLeft > 1 )
+ aDlg.EnableAllButton();
- eResult = aDlg.run();
- }
+ eResult = aDlg.run();
+ }
- bool bSuccess = false;
+ bool bSuccess = false;
- bool bUserConfirmedDelete =
- ( eResult == svtools::QUERYDELETE_ALL )
- || ( eResult == svtools::QUERYDELETE_YES );
+ bool bUserConfirmedDelete =
+ ( eResult == svtools::QUERYDELETE_ALL )
+ || ( eResult == svtools::QUERYDELETE_YES );
- if ( bUserConfirmedDelete
- && ( _eType != E_QUERY || m_pSubComponentManager->closeSubFrames( *aThisRound, _eType ) )
- )
+ if ( bUserConfirmedDelete
+ && ( _eType != E_QUERY || m_pSubComponentManager->closeSubFrames( *aThisRound, _eType ) )
+ )
+ {
+ try
{
- try
- {
- if ( xHierarchyName.is() )
- xHierarchyName->removeByHierarchicalName( *aThisRound );
- else
- xNames->removeByName( *aThisRound );
+ if ( xHierarchyName.is() )
+ xHierarchyName->removeByHierarchicalName( *aThisRound );
+ else
+ xNames->removeByName( *aThisRound );
- bSuccess = true;
+ bSuccess = true;
- // now that we removed the element, care for all its child elements
- // which may also be a part of the list
- // #i33353#
- OSL_ENSURE( aThisRound->getLength() - 1 >= 0, "OApplicationController::deleteObjects: empty name?" );
- OUString sSmallestSiblingName = *aThisRound + OUStringChar( sal_Unicode( '/' + 1) );
+ // now that we removed the element, care for all its child elements
+ // which may also be a part of the list
+ // #i33353#
+ OSL_ENSURE( aThisRound->getLength() - 1 >= 0, "OApplicationController::deleteObjects: empty name?" );
+ OUString sSmallestSiblingName = *aThisRound + OUStringChar( sal_Unicode( '/' + 1) );
- std::set< OUString >::const_iterator aUpperChildrenBound = aDeleteNames.lower_bound( sSmallestSiblingName );
- for ( std::set< OUString >::const_iterator aObsolete = aThisRound;
- aObsolete != aUpperChildrenBound;
- )
- {
- std::set< OUString >::const_iterator aNextObsolete = aObsolete; ++aNextObsolete;
- aDeleteNames.erase( aObsolete );
- --nObjectsLeft;
- aObsolete = aNextObsolete;
- }
- }
- catch(const SQLException&)
- {
- showError( SQLExceptionInfo( ::cppu::getCaughtException() ) );
- }
- catch(const WrappedTargetException& e)
- {
- SQLException aSql;
- if ( e.TargetException >>= aSql )
- showError( SQLExceptionInfo( e.TargetException ) );
- else
- OSL_FAIL( "OApplicationController::deleteObjects: something strange happened!" );
- }
- catch( const Exception& )
+ std::set< OUString >::const_iterator aUpperChildrenBound = aDeleteNames.lower_bound( sSmallestSiblingName );
+ for ( std::set< OUString >::const_iterator aObsolete = aThisRound;
+ aObsolete != aUpperChildrenBound;
+ )
{
- DBG_UNHANDLED_EXCEPTION("dbaccess");
+ std::set< OUString >::const_iterator aNextObsolete = aObsolete; ++aNextObsolete;
+ aDeleteNames.erase( aObsolete );
+ --nObjectsLeft;
+ aObsolete = aNextObsolete;
}
}
-
- if ( !bSuccess )
+ catch(const SQLException&)
+ {
+ showError( SQLExceptionInfo( ::cppu::getCaughtException() ) );
+ }
+ catch(const WrappedTargetException& e)
+ {
+ SQLException aSql;
+ if ( e.TargetException >>= aSql )
+ showError( SQLExceptionInfo( e.TargetException ) );
+ else
+ OSL_FAIL( "OApplicationController::deleteObjects: something strange happened!" );
+ }
+ catch( const Exception& )
{
- // okay, this object could not be deleted (or the user did not want to delete it),
- // but continue with the rest
- aDeleteNames.erase( aThisRound );
- --nObjectsLeft;
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
}
}
+
+ if ( !bSuccess )
+ {
+ // okay, this object could not be deleted (or the user did not want to delete it),
+ // but continue with the rest
+ aDeleteNames.erase( aThisRound );
+ --nObjectsLeft;
+ }
}
}
@@ -287,28 +287,28 @@ void OApplicationController::deleteEntries()
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( getMutex() );
- if ( getContainer() )
+ if ( !getContainer() )
+ return;
+
+ std::vector< OUString> aList;
+ getSelectionElementNames(aList);
+ ElementType eType = getContainer()->getElementType();
+ switch(eType)
{
- std::vector< OUString> aList;
- getSelectionElementNames(aList);
- ElementType eType = getContainer()->getElementType();
- switch(eType)
- {
- case E_TABLE:
- deleteTables(aList);
- break;
- case E_QUERY:
- deleteObjects( E_QUERY, aList, true );
- break;
- case E_FORM:
- deleteObjects( E_FORM, aList, true );
- break;
- case E_REPORT:
- deleteObjects( E_REPORT, aList, true );
- break;
- case E_NONE:
- break;
- }
+ case E_TABLE:
+ deleteTables(aList);
+ break;
+ case E_QUERY:
+ deleteObjects( E_QUERY, aList, true );
+ break;
+ case E_FORM:
+ deleteObjects( E_FORM, aList, true );
+ break;
+ case E_REPORT:
+ deleteObjects( E_REPORT, aList, true );
+ break;
+ case E_NONE:
+ break;
}
}
diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx
index 61a12a87fede..dec3fc9081e7 100644
--- a/dbaccess/source/ui/app/AppControllerGen.cxx
+++ b/dbaccess/source/ui/app/AppControllerGen.cxx
@@ -135,24 +135,24 @@ void OApplicationController::convertToView(const OUString& _sName)
void OApplicationController::pasteFormat(SotClipboardFormatId _nFormatId)
{
- if ( _nFormatId != SotClipboardFormatId::NONE )
- {
- try
- {
- const TransferableDataHelper& rClipboard = getViewClipboard();
- ElementType eType = getContainer()->getElementType();
- if ( eType == E_TABLE )
- {
- m_aTableCopyHelper.pasteTable( _nFormatId, rClipboard, getDatabaseName(), ensureConnection() );
- }
- else
- paste( eType, ODataAccessObjectTransferable::extractObjectDescriptor( rClipboard ) );
+ if ( _nFormatId == SotClipboardFormatId::NONE )
+ return;
- }
- catch( const Exception& )
+ try
+ {
+ const TransferableDataHelper& rClipboard = getViewClipboard();
+ ElementType eType = getContainer()->getElementType();
+ if ( eType == E_TABLE )
{
- DBG_UNHANDLED_EXCEPTION("dbaccess");
+ m_aTableCopyHelper.pasteTable( _nFormatId, rClipboard, getDatabaseName(), ensureConnection() );
}
+ else
+ paste( eType, ODataAccessObjectTransferable::extractObjectDescriptor( rClipboard ) );
+
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
}
}
@@ -218,24 +218,24 @@ void OApplicationController::openDialog( const OUString& _sServiceName )
void OApplicationController::refreshTables()
{
- if ( getContainer() && getContainer()->getDetailView() )
- {
- weld::WaitObject aWO(getFrameWeld());
- OSL_ENSURE(getContainer()->getElementType() == E_TABLE,"Only allowed when the tables container is selected!");
- try
- {
- Reference<XRefreshable> xRefresh(getElements(E_TABLE),UNO_QUERY);
- if ( xRefresh.is() )
- xRefresh->refresh();
- }
- catch(const Exception&)
- {
- OSL_FAIL("Could not refresh tables!");
- }
+ if ( !(getContainer() && getContainer()->getDetailView()) )
+ return;
- getContainer()->getDetailView()->clearPages(false);
- getContainer()->getDetailView()->createTablesPage( ensureConnection() );
+ weld::WaitObject aWO(getFrameWeld());
+ OSL_ENSURE(getContainer()->getElementType() == E_TABLE,"Only allowed when the tables container is selected!");
+ try
+ {
+ Reference<XRefreshable> xRefresh(getElements(E_TABLE),UNO_QUERY);
+ if ( xRefresh.is() )
+ xRefresh->refresh();
}
+ catch(const Exception&)
+ {
+ OSL_FAIL("Could not refresh tables!");
+ }
+
+ getContainer()->getDetailView()->clearPages(false);
+ getContainer()->getDetailView()->createTablesPage( ensureConnection() );
}
void SAL_CALL OApplicationController::propertyChange( const PropertyChangeEvent& evt )
@@ -511,35 +511,35 @@ void OApplicationController::previewChanged( sal_Int32 _nMode )
void OApplicationController::askToReconnect()
{
- if ( m_bNeedToReconnect )
+ if ( !m_bNeedToReconnect )
+ return;
+
+ m_bNeedToReconnect = false;
+ bool bClear = true;
+ if ( !m_pSubComponentManager->empty() )
{
- m_bNeedToReconnect = false;
- bool bClear = true;
- if ( !m_pSubComponentManager->empty() )
- {
- std::unique_ptr<weld::MessageDialog> xQry(Application::CreateMessageDialog(getFrameWeld(),
- VclMessageType::Question, VclButtonsType::YesNo,
- DBA_RES(STR_QUERY_CLOSEDOCUMENTS)));
- switch (xQry->run())
- {
- case RET_YES:
- closeSubComponents();
- break;
- default:
- bClear = false;
- break;
- }
- }
- if ( bClear )
+ std::unique_ptr<weld::MessageDialog> xQry(Application::CreateMessageDialog(getFrameWeld(),
+ VclMessageType::Question, VclButtonsType::YesNo,
+ DBA_RES(STR_QUERY_CLOSEDOCUMENTS)));
+ switch (xQry->run())
{
- ElementType eType = getContainer()->getElementType();
- disconnect();
- getContainer()->getDetailView()->clearPages(false);
- getContainer()->selectContainer(E_NONE); // invalidate the old selection
- m_eCurrentType = E_NONE;
- getContainer()->selectContainer(eType); // reselect the current one again
+ case RET_YES:
+ closeSubComponents();
+ break;
+ default:
+ bClear = false;
+ break;
}
}
+ if ( bClear )
+ {
+ ElementType eType = getContainer()->getElementType();
+ disconnect();
+ getContainer()->getDetailView()->clearPages(false);
+ getContainer()->selectContainer(E_NONE); // invalidate the old selection
+ m_eCurrentType = E_NONE;
+ getContainer()->selectContainer(eType); // reselect the current one again
+ }
}
OUString OApplicationController::getDatabaseName() const
@@ -645,34 +645,34 @@ bool OApplicationController::isRenameDeleteAllowed(ElementType _eType, bool _bDe
void OApplicationController::onLoadedMenu(const Reference< css::frame::XLayoutManager >& _xLayoutManager)
{
- if ( _xLayoutManager.is() )
- {
- static const char s_sStatusbar[] = "private:resource/statusbar/statusbar";
- _xLayoutManager->createElement( s_sStatusbar );
- _xLayoutManager->requestElement( s_sStatusbar );
+ if ( !_xLayoutManager.is() )
+ return;
- if ( getContainer() )
+ static const char s_sStatusbar[] = "private:resource/statusbar/statusbar";
+ _xLayoutManager->createElement( s_sStatusbar );
+ _xLayoutManager->requestElement( s_sStatusbar );
+
+ if ( getContainer() )
+ {
+ // we need to share the "mnemonic space":
+ MnemonicGenerator aMnemonicGenerator;
+ // - the menu already has mnemonics
+ SystemWindow* pSystemWindow = getContainer()->GetSystemWindow();
+ MenuBar* pMenu = pSystemWindow ? pSystemWindow->GetMenuBar() : nullptr;
+ if ( pMenu )
{
- // we need to share the "mnemonic space":
- MnemonicGenerator aMnemonicGenerator;
- // - the menu already has mnemonics
- SystemWindow* pSystemWindow = getContainer()->GetSystemWindow();
- MenuBar* pMenu = pSystemWindow ? pSystemWindow->GetMenuBar() : nullptr;
- if ( pMenu )
- {
- sal_uInt16 nMenuItems = pMenu->GetItemCount();
- for ( sal_uInt16 i = 0; i < nMenuItems; ++i )
- aMnemonicGenerator.RegisterMnemonic( pMenu->GetItemText( pMenu->GetItemId( i ) ) );
- }
- // - the icons should use automatic ones
- getContainer()->createIconAutoMnemonics( aMnemonicGenerator );
- // - as well as the entries in the task pane
- getContainer()->setTaskExternalMnemonics( aMnemonicGenerator );
+ sal_uInt16 nMenuItems = pMenu->GetItemCount();
+ for ( sal_uInt16 i = 0; i < nMenuItems; ++i )
+ aMnemonicGenerator.RegisterMnemonic( pMenu->GetItemText( pMenu->GetItemId( i ) ) );
}
-
- Execute( SID_DB_APP_VIEW_FORMS, Sequence< PropertyValue >() );
- InvalidateAll();
+ // - the icons should use automatic ones
+ getContainer()->createIconAutoMnemonics( aMnemonicGenerator );
+ // - as well as the entries in the task pane
+ getContainer()->setTaskExternalMnemonics( aMnemonicGenerator );
}
+
+ Execute( SID_DB_APP_VIEW_FORMS, Sequence< PropertyValue >() );
+ InvalidateAll();
}
void OApplicationController::doAction(sal_uInt16 _nId, const ElementOpenMode _eOpenMode)
@@ -701,31 +701,31 @@ void OApplicationController::doAction(sal_uInt16 _nId, const ElementOpenMode _eO
}
// special handling for mail, if more than one document is selected attach them all
- if ( _eOpenMode == E_OPEN_FOR_MAIL )
- {
+ if ( _eOpenMode != E_OPEN_FOR_MAIL )
+ return;
- SfxMailModel aSendMail;
- SfxMailModel::SendMailResult eResult = SfxMailModel::SEND_MAIL_OK;
- for (auto const& component : aComponents)
+
+ SfxMailModel aSendMail;
+ SfxMailModel::SendMailResult eResult = SfxMailModel::SEND_MAIL_OK;
+ for (auto const& component : aComponents)
+ {
+ try
{
- try
- {
- Reference< XModel > xModel(component.second,UNO_QUERY);
+ Reference< XModel > xModel(component.second,UNO_QUERY);
- // Send document as e-Mail using stored/default type
- eResult = aSendMail.AttachDocument(xModel,component.first);
- ::comphelper::disposeComponent(xModel);
- if (eResult != SfxMailModel::SEND_MAIL_OK)
- break;
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
+ // Send document as e-Mail using stored/default type
+ eResult = aSendMail.AttachDocument(xModel,component.first);
+ ::comphelper::disposeComponent(xModel);
+ if (eResult != SfxMailModel::SEND_MAIL_OK)
+ break;
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- if ( !aSendMail.IsEmpty() )
- aSendMail.Send( getFrame() );
}
+ if ( !aSendMail.IsEmpty() )
+ aSendMail.Send( getFrame() );
}
ElementType OApplicationController::getElementType(const Reference< XContainer >& _xContainer)
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 4321e07dc9c9..fe8d438845be 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -312,33 +312,33 @@ void OAppDetailPageHelper::sortUp()
void OAppDetailPageHelper::getSelectionElementNames( std::vector< OUString>& _rNames ) const
{
int nPos = getVisibleControlIndex();
- if ( nPos < E_ELEMENT_TYPE_COUNT )
+ if ( nPos >= E_ELEMENT_TYPE_COUNT )
+ return;
+
+ DBTreeListBox& rTree = *m_pLists[nPos];
+ sal_Int32 nCount = rTree.GetEntryCount();
+ _rNames.reserve(nCount);
+ SvTreeListEntry* pEntry = rTree.FirstSelected();
+ ElementType eType = getElementType();
+ while( pEntry )
{
- DBTreeListBox& rTree = *m_pLists[nPos];
- sal_Int32 nCount = rTree.GetEntryCount();
- _rNames.reserve(nCount);
- SvTreeListEntry* pEntry = rTree.FirstSelected();
- ElementType eType = getElementType();
- while( pEntry )
+ if ( eType == E_TABLE )
{
- if ( eType == E_TABLE )
- {
- if( rTree.GetChildCount(pEntry) == 0 )
- _rNames.push_back( getQualifiedName( pEntry ) );
- }
- else
+ if( rTree.GetChildCount(pEntry) == 0 )
+ _rNames.push_back( getQualifiedName( pEntry ) );
+ }
+ else
+ {
+ OUString sName = rTree.GetEntryText(pEntry);
+ SvTreeListEntry* pParent = rTree.GetParent(pEntry);
+ while(pParent)
{
- OUString sName = rTree.GetEntryText(pEntry);
- SvTreeListEntry* pParent = rTree.GetParent(pEntry);
- while(pParent)
- {
- sName = rTree.GetEntryText(pParent) + "/" + sName;
- pParent = rTree.GetParent(pParent);
- }
- _rNames.push_back(sName);
+ sName = rTree.GetEntryText(pParent) + "/" + sName;
+ pParent = rTree.GetParent(pParent);
}
- pEntry = rTree.NextSelected(pEntry);
+ _rNames.push_back(sName);
}
+ pEntry = rTree.NextSelected(pEntry);
}
}
@@ -425,18 +425,18 @@ void OAppDetailPageHelper::describeCurrentSelectionForType( const ElementType _e
void OAppDetailPageHelper::selectElements(const Sequence< OUString>& _aNames)
{
int nPos = getVisibleControlIndex();
- if ( nPos < E_ELEMENT_TYPE_COUNT )
+ if ( nPos >= E_ELEMENT_TYPE_COUNT )
+ return;
+
+ DBTreeListBox& rTree = *m_pLists[nPos];
+ rTree.SelectAll(false);
+ const OUString* pIter = _aNames.getConstArray();
+ const OUString* pEnd = pIter + _aNames.getLength();
+ for(;pIter != pEnd;++pIter)
{
- DBTreeListBox& rTree = *m_pLists[nPos];
- rTree.SelectAll(false);
- const OUString* pIter = _aNames.getConstArray();
- const OUString* pEnd = pIter + _aNames.getLength();
- for(;pIter != pEnd;++pIter)
- {
- SvTreeListEntry* pEntry = rTree.GetEntryPosByName(*pIter);
- if ( pEntry )
- rTree.Select(pEntry);
- }
+ SvTreeListEntry* pEntry = rTree.GetEntryPosByName(*pIter);
+ if ( pEntry )
+ rTree.Select(pEntry);
}
}
@@ -685,31 +685,31 @@ void OAppDetailPageHelper::fillNames( const Reference< XNameAccess >& _xContaine
if ( !pList )
return;
- if ( _xContainer.is() && _xContainer->hasElements() )
- {
- const sal_Int32 nFolderIndicator = lcl_getFolderIndicatorForType( _eType );
+ if ( !(_xContainer.is() && _xContainer->hasElements()) )
+ return;
- Sequence< OUString> aSeq = _xContainer->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
- for(;pIter != pEnd;++pIter)
+ const sal_Int32 nFolderIndicator = lcl_getFolderIndicatorForType( _eType );
+
+ Sequence< OUString> aSeq = _xContainer->getElementNames();
+ const OUString* pIter = aSeq.getConstArray();
+ const OUString* pEnd = pIter + aSeq.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ SvTreeListEntry* pEntry = nullptr;
+ Reference<XNameAccess> xSubElements(_xContainer->getByName(*pIter),UNO_QUERY);
+ if ( xSubElements.is() )
{
- SvTreeListEntry* pEntry = nullptr;
- Reference<XNameAccess> xSubElements(_xContainer->getByName(*pIter),UNO_QUERY);
- if ( xSubElements.is() )
- {
- pEntry = pList->InsertEntry( *pIter, _pParent, false, TREELIST_APPEND, reinterpret_cast< void* >( nFolderIndicator ) );
- getBorderWin().getView()->getAppController().containerFound( Reference< XContainer >( xSubElements, UNO_QUERY ) );
- fillNames( xSubElements, _eType, rImageId, pEntry );
- }
- else
- {
- pEntry = pList->InsertEntry( *pIter, _pParent );
+ pEntry = pList->InsertEntry( *pIter, _pParent, false, TREELIST_APPEND, reinterpret_cast< void* >( nFolderIndicator ) );
+ getBorderWin().getView()->getAppController().containerFound( Reference< XContainer >( xSubElements, UNO_QUERY ) );
+ fillNames( xSubElements, _eType, rImageId, pEntry );
+ }
+ else
+ {
+ pEntry = pList->InsertEntry( *pIter, _pParent );
- Image aImage(StockImage::Yes, rImageId);
- pList->SetExpandedEntryBmp(pEntry, aImage);
- pList->SetCollapsedEntryBmp(pEntry, aImage);
- }
+ Image aImage(StockImage::Yes, rImageId);
+ pList->SetExpandedEntryBmp(pEntry, aImage);
+ pList->SetCollapsedEntryBmp(pEntry, aImage);
}
}
}
@@ -771,31 +771,31 @@ void OAppDetailPageHelper::elementReplaced(ElementType _eType
,const OUString& _rNewName )
{
DBTreeListBox* pTreeView = getCurrentView();
- if ( pTreeView )
+ if ( !pTreeView )
+ return;
+
+ SvTreeListEntry* pEntry = nullptr;
+ switch( _eType )
{
- SvTreeListEntry* pEntry = nullptr;
- switch( _eType )
- {
- case E_TABLE:
- static_cast<OTableTreeListBox*>(pTreeView)->removedTable( _rOldName );
- static_cast<OTableTreeListBox*>(pTreeView)->addedTable( _rNewName );
- return;
-
- case E_QUERY:
- pEntry = lcl_findEntry_impl(*pTreeView,_rOldName,pTreeView->First());
- break;
- case E_FORM:
- case E_REPORT:
- pEntry = lcl_findEntry(*pTreeView,_rOldName,pTreeView->First());
- break;
- default:
- OSL_FAIL("Invalid element type");
- }
- OSL_ENSURE(pEntry,"Do you know that the name isn't existence!");
- if ( pEntry )
- {
- pTreeView->SetEntryText(pEntry,_rNewName);
- }
+ case E_TABLE:
+ static_cast<OTableTreeListBox*>(pTreeView)->removedTable( _rOldName );
+ static_cast<OTableTreeListBox*>(pTreeView)->addedTable( _rNewName );
+ return;
+
+ case E_QUERY:
+ pEntry = lcl_findEntry_impl(*pTreeView,_rOldName,pTreeView->First());
+ break;
+ case E_FORM:
+ case E_REPORT:
+ pEntry = lcl_findEntry(*pTreeView,_rOldName,pTreeView->First());
+ break;
+ default:
+ OSL_FAIL("Invalid element type");
+ }
+ OSL_ENSURE(pEntry,"Do you know that the name isn't existence!");
+ if ( pEntry )
+ {
+ pTreeView->SetEntryText(pEntry,_rNewName);
}
}
@@ -845,29 +845,29 @@ SvTreeListEntry* OAppDetailPageHelper::elementAdded(ElementType _eType,const OUS
void OAppDetailPageHelper::elementRemoved( ElementType _eType,const OUString& _rName )
{
DBTreeListBox* pTreeView = getCurrentView();
- if ( pTreeView )
+ if ( !pTreeView )
+ return;
+
+ switch( _eType )
{
- switch( _eType )
- {
- case E_TABLE:
- // we don't need to clear the table here, it is already done by the dispose listener
- static_cast< OTableTreeListBox* >( pTreeView )->removedTable( _rName );
- break;
- case E_QUERY:
- if (auto pEntry = lcl_findEntry_impl(*pTreeView, _rName, pTreeView->First()))
- pTreeView->GetModel()->Remove(pEntry);
- break;
- case E_FORM:
- case E_REPORT:
- if (auto pEntry = lcl_findEntry(*pTreeView, _rName, pTreeView->First()))
- pTreeView->GetModel()->Remove(pEntry);
- break;
- default:
- OSL_FAIL("Invalid element type");
- }
- if ( !pTreeView->GetEntryCount() )
- showPreview(nullptr);
+ case E_TABLE:
+ // we don't need to clear the table here, it is already done by the dispose listener
+ static_cast< OTableTreeListBox* >( pTreeView )->removedTable( _rName );
+ break;
+ case E_QUERY:
+ if (auto pEntry = lcl_findEntry_impl(*pTreeView, _rName, pTreeView->First()))
+ pTreeView->GetModel()->Remove(pEntry);
+ break;
+ case E_FORM:
+ case E_REPORT:
+ if (auto pEntry = lcl_findEntry(*pTreeView, _rName, pTreeView->First()))
+ pTreeView->GetModel()->Remove(pEntry);
+ break;
+ default:
+ OSL_FAIL("Invalid element type");
}
+ if ( !pTreeView->GetEntryCount() )
+ showPreview(nullptr);
}
IMPL_LINK(OAppDetailPageHelper, OnEntryEnterKey, DBTreeListBox*, _pTree, void )
@@ -909,26 +909,26 @@ void OAppDetailPageHelper::Resize()
long nOutputHeight = aOutputSize.Height();
vcl::Window* pWindow = getCurrentView();
- if ( pWindow )
- {
- Size aFLSize = LogicToPixel(Size(2, 6), MapMode(MapUnit::MapAppFont));
- sal_Int32 n6PPT = aFLSize.Height();
- long nHalfOutputWidth = static_cast<long>(nOutputWidth * 0.5);
+ if ( !pWindow )
+ return;
- pWindow->SetPosSizePixel( Point(0, 0), Size(nHalfOutputWidth - n6PPT, nOutputHeight) );
+ Size aFLSize = LogicToPixel(Size(2, 6), MapMode(MapUnit::MapAppFont));
+ sal_Int32 n6PPT = aFLSize.Height();
+ long nHalfOutputWidth = static_cast<long>(nOutputWidth * 0.5);
- m_aFL->SetPosSizePixel( Point(nHalfOutputWidth , 0 ), Size(aFLSize.Width(), nOutputHeight ) );
+ pWindow->SetPosSizePixel( Point(0, 0), Size(nHalfOutputWidth - n6PPT, nOutputHeight) );
- Size aTBSize = m_aTBPreview->CalcWindowSizePixel();
- m_aTBPreview->SetPosSizePixel(Point(nOutputWidth - aTBSize.getWidth(), 0 ),
- aTBSize );
+ m_aFL->SetPosSizePixel( Point(nHalfOutputWidth , 0 ), Size(aFLSize.Width(), nOutputHeight ) );
- m_aBorder->SetPosSizePixel(Point(nHalfOutputWidth + aFLSize.Width() + n6PPT, aTBSize.getHeight() + n6PPT ),
- Size(nHalfOutputWidth - aFLSize.Width() - n6PPT, nOutputHeight - 2*n6PPT - aTBSize.getHeight()) );
- m_aPreview->SetPosSizePixel(Point(0,0),m_aBorder->GetSizePixel() );
- m_aDocumentInfo->SetPosSizePixel(Point(0,0),m_aBorder->GetSizePixel() );
- m_pTablePreview->SetPosSizePixel(Point(0,0),m_aBorder->GetSizePixel() );
- }
+ Size aTBSize = m_aTBPreview->CalcWindowSizePixel();
+ m_aTBPreview->SetPosSizePixel(Point(nOutputWidth - aTBSize.getWidth(), 0 ),
+ aTBSize );
+
+ m_aBorder->SetPosSizePixel(Point(nHalfOutputWidth + aFLSize.Width() + n6PPT, aTBSize.getHeight() + n6PPT ),
+ Size(nHalfOutputWidth - aFLSize.Width() - n6PPT, nOutputHeight - 2*n6PPT - aTBSize.getHeight()) );
+ m_aPreview->SetPosSizePixel(Point(0,0),m_aBorder->GetSizePixel() );
+ m_aDocumentInfo->SetPosSizePixel(Point(0,0),m_aBorder->GetSizePixel() );
+ m_pTablePreview->SetPosSizePixel(Point(0,0),m_aBorder->GetSizePixel() );
}
@@ -947,179 +947,179 @@ namespace
void OAppDetailPageHelper::switchPreview(PreviewMode _eMode,bool _bForce)
{
- if ( m_ePreviewMode != _eMode || _bForce )
- {
- m_ePreviewMode = _eMode;
+ if ( !(m_ePreviewMode != _eMode || _bForce) )
+ return;
- getBorderWin().getView()->getAppController().previewChanged(static_cast<sal_Int32>(m_ePreviewMode));
+ m_ePreviewMode = _eMode;
- OUString aCommand;
- switch ( m_ePreviewMode )
- {
- case E_PREVIEWNONE:
- aCommand = ".uno:DBDisablePreview";
- break;
- case E_DOCUMENT:
- aCommand = ".uno:DBShowDocPreview";
- break;
- case E_DOCUMENTINFO:
- if ( getBorderWin().getView()->getAppController().isCommandEnabled(SID_DB_APP_VIEW_DOCINFO_PREVIEW) )
- aCommand = ".uno:DBShowDocInfoPreview";
- else
- {
- m_ePreviewMode = E_PREVIEWNONE;
- aCommand = ".uno:DBDisablePreview";
- }
- break;
- }
+ getBorderWin().getView()->getAppController().previewChanged(static_cast<sal_Int32>(m_ePreviewMode));
- auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommand, "com.sun.star.sdb.OfficeDatabaseDocument");
- OUString aCommandLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
- m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(aCommandLabel));
- Resize();
-
- // simulate a selectionChanged event at the controller, to force the preview to be updated
- if ( isPreviewEnabled() )
- {
- if ( getCurrentView() && getCurrentView()->FirstSelected() )
+ OUString aCommand;
+ switch ( m_ePreviewMode )
+ {
+ case E_PREVIEWNONE:
+ aCommand = ".uno:DBDisablePreview";
+ break;
+ case E_DOCUMENT:
+ aCommand = ".uno:DBShowDocPreview";
+ break;
+ case E_DOCUMENTINFO:
+ if ( getBorderWin().getView()->getAppController().isCommandEnabled(SID_DB_APP_VIEW_DOCINFO_PREVIEW) )
+ aCommand = ".uno:DBShowDocInfoPreview";
+ else
{
- getBorderWin().getView()->getAppController().onSelectionChanged();
+ m_ePreviewMode = E_PREVIEWNONE;
+ aCommand = ".uno:DBDisablePreview";
}
- }
- else
+ break;
+ }
+
+ auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommand, "com.sun.star.sdb.OfficeDatabaseDocument");
+ OUString aCommandLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
+ m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(aCommandLabel));
+ Resize();
+
+ // simulate a selectionChanged event at the controller, to force the preview to be updated
+ if ( isPreviewEnabled() )
+ {
+ if ( getCurrentView() && getCurrentView()->FirstSelected() )
{
- m_pTablePreview->Hide();
- m_aPreview->Hide();
- m_aDocumentInfo->Hide();
+ getBorderWin().getView()->getAppController().onSelectionChanged();
}
}
+ else
+ {
+ m_pTablePreview->Hide();
+ m_aPreview->Hide();
+ m_aDocumentInfo->Hide();
+ }
}
void OAppDetailPageHelper::showPreview(const Reference< XContent >& _xContent)
{
- if ( isPreviewEnabled() )
- {
- m_pTablePreview->Hide();
+ if ( !isPreviewEnabled() )
+ return;
- weld::WaitObject aWaitCursor(GetFrameWeld());
- try
+ m_pTablePreview->Hide();
+
+ weld::WaitObject aWaitCursor(GetFrameWeld());
+ try
+ {
+ Reference<XCommandProcessor> xContent(_xContent,UNO_QUERY);
+ if ( xContent.is() )
{
- Reference<XCommandProcessor> xContent(_xContent,UNO_QUERY);
- if ( xContent.is() )
+ css::ucb::Command aCommand;
+ if ( m_ePreviewMode == E_DOCUMENT )
+ aCommand.Name = "preview";
+ else
+ aCommand.Name = "getDocumentInfo";
+
+ Any aPreview = xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >());
+ if ( m_ePreviewMode == E_DOCUMENT )
{
- css::ucb::Command aCommand;
- if ( m_ePreviewMode == E_DOCUMENT )
- aCommand.Name = "preview";
- else
- aCommand.Name = "getDocumentInfo";
+ m_aDocumentInfo->Hide();
+ m_aPreview->Show();
- Any aPreview = xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >());
- if ( m_ePreviewMode == E_DOCUMENT )
+ Graphic aGraphic;
+ Sequence < sal_Int8 > aBmpSequence;
+ if ( aPreview >>= aBmpSequence )
{
- m_aDocumentInfo->Hide();
- m_aPreview->Show();
-
- Graphic aGraphic;
- Sequence < sal_Int8 > aBmpSequence;
- if ( aPreview >>= aBmpSequence )
- {
- SvMemoryStream aData( aBmpSequence.getArray(),
- aBmpSequence.getLength(),
- StreamMode::READ );
-
- GraphicConverter::Import(aData,aGraphic);
- }
- m_aPreview->setGraphic( aGraphic );
- m_aPreview->Invalidate();
- }
- else
- {
- m_aPreview->Hide();
- m_aDocumentInfo->clear();
- m_aDocumentInfo->Show();
- Reference<document::XDocumentProperties> xProp(
- aPreview, UNO_QUERY);
- if ( xProp.is() )
- m_aDocumentInfo->fill(xProp);
+ SvMemoryStream aData( aBmpSequence.getArray(),
+ aBmpSequence.getLength(),
+ StreamMode::READ );
+
+ GraphicConverter::Import(aData,aGraphic);
}
+ m_aPreview->setGraphic( aGraphic );
+ m_aPreview->Invalidate();
}
else
{
m_aPreview->Hide();
- m_aDocumentInfo->Hide();
+ m_aDocumentInfo->clear();
+ m_aDocumentInfo->Show();
+ Reference<document::XDocumentProperties> xProp(
+ aPreview, UNO_QUERY);
+ if ( xProp.is() )
+ m_aDocumentInfo->fill(xProp);
}
}
- catch( const Exception& )
+ else
{
- DBG_UNHANDLED_EXCEPTION("dbaccess");
+ m_aPreview->Hide();
+ m_aDocumentInfo->Hide();
}
}
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
}
void OAppDetailPageHelper::showPreview( const OUString& _sDataSourceName,
const OUString& _sName,
bool _bTable)
{
- if ( isPreviewEnabled() )
+ if ( !isPreviewEnabled() )
+ return;
+
+ weld::WaitObject aWaitCursor(GetFrameWeld());
+ m_aPreview->Hide();
+ m_aDocumentInfo->Hide();
+ m_pTablePreview->Show();
+ if ( !m_xFrame.is() )
{
- weld::WaitObject aWaitCursor(GetFrameWeld());
- m_aPreview->Hide();
- m_aDocumentInfo->Hide();
- m_pTablePreview->Show();
- if ( !m_xFrame.is() )
+ try
{
- try
- {
- m_xFrame = Frame::create( getBorderWin().getView()->getORB() );
- m_xFrame->initialize( m_xWindow );
+ m_xFrame = Frame::create( getBorderWin().getView()->getORB() );
+ m_xFrame->initialize( m_xWindow );
- // no layout manager (and thus no toolbars) in the preview
- // Must be called after initialize ... but before any other call to this frame.
- // Otherwise frame throws "life time exceptions" as e.g. NON_INITIALIZED
- m_xFrame->setLayoutManager( Reference< XLayoutManager >() );
+ // no layout manager (and thus no toolbars) in the preview
+ // Must be called after initialize ... but before any other call to this frame.
+ // Otherwise frame throws "life time exceptions" as e.g. NON_INITIALIZED
+ m_xFrame->setLayoutManager( Reference< XLayoutManager >() );
- Reference<XFramesSupplier> xSup(getBorderWin().getView()->getAppController().getXController()->getFrame(),UNO_QUERY);
- if ( xSup.is() )
- {
- Reference<XFrames> xFrames = xSup->getFrames();
- xFrames->append( Reference<XFrame>(m_xFrame,UNO_QUERY_THROW));
- }
- }
- catch(const Exception&)
+ Reference<XFramesSupplier> xSup(getBorderWin().getView()->getAppController().getXController()->getFrame(),UNO_QUERY);
+ if ( xSup.is() )
{
+ Reference<XFrames> xFrames = xSup->getFrames();
+ xFrames->append( Reference<XFrame>(m_xFrame,UNO_QUERY_THROW));
}
}
+ catch(const Exception&)
+ {
+ }
+ }
- Reference< XDatabaseDocumentUI > xApplication( getBorderWin().getView()->getAppController().getXController(), UNO_QUERY );
- std::unique_ptr< DatabaseObjectView > pDispatcher( new ResultSetBrowser(
- getBorderWin().getView()->getORB(),
- xApplication, nullptr, _bTable
- ) );
- pDispatcher->setTargetFrame( Reference<XFrame>(m_xFrame,UNO_QUERY_THROW) );
+ Reference< XDatabaseDocumentUI > xApplication( getBorderWin().getView()->getAppController().getXController(), UNO_QUERY );
+ std::unique_ptr< DatabaseObjectView > pDispatcher( new ResultSetBrowser(
+ getBorderWin().getView()->getORB(),
+ xApplication, nullptr, _bTable
+ ) );
+ pDispatcher->setTargetFrame( Reference<XFrame>(m_xFrame,UNO_QUERY_THROW) );
- ::comphelper::NamedValueCollection aArgs;
- aArgs.put( "Preview", true );
- aArgs.put( "ReadOnly", true );
- aArgs.put( "AsTemplate", false );
- aArgs.put( OUString(PROPERTY_SHOWMENU), false );
+ ::comphelper::NamedValueCollection aArgs;
+ aArgs.put( "Preview", true );
+ aArgs.put( "ReadOnly", true );
+ aArgs.put( "AsTemplate", false );
+ aArgs.put( OUString(PROPERTY_SHOWMENU), false );
- Reference< XController > xPreview( pDispatcher->openExisting( makeAny( _sDataSourceName ), _sName, aArgs ), UNO_QUERY );
- bool bClearPreview = !xPreview.is();
+ Reference< XController > xPreview( pDispatcher->openExisting( makeAny( _sDataSourceName ), _sName, aArgs ), UNO_QUERY );
+ bool bClearPreview = !xPreview.is();
- // clear the preview when the query or table could not be loaded
+ // clear the preview when the query or table could not be loaded
+ if ( !bClearPreview )
+ {
+ Reference< XTabController > xTabController( xPreview, UNO_QUERY );
+ bClearPreview = !xTabController.is();
if ( !bClearPreview )
{
- Reference< XTabController > xTabController( xPreview, UNO_QUERY );
- bClearPreview = !xTabController.is();
- if ( !bClearPreview )
- {
- Reference< XLoadable > xLoadable( xTabController->getModel(), UNO_QUERY );
- bClearPreview = !( xLoadable.is() && xLoadable->isLoaded() );
- }
+ Reference< XLoadable > xLoadable( xTabController->getModel(), UNO_QUERY );
+ bClearPreview = !( xLoadable.is() && xLoadable->isLoaded() );
}
- if ( bClearPreview )
- showPreview(nullptr);
}
+ if ( bClearPreview )
+ showPreview(nullptr);
}
IMPL_LINK_NOARG(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, void)
diff --git a/dbaccess/source/ui/app/AppView.cxx b/dbaccess/source/ui/app/AppView.cxx
index 96adc210b2f4..09cfa9e0f703 100644
--- a/dbaccess/source/ui/app/AppView.cxx
+++ b/dbaccess/source/ui/app/AppView.cxx
@@ -473,36 +473,36 @@ void OApplicationView::showPreview( const OUString& _sDataSourceName,
bool _bTable)
{
OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- if ( isPreviewEnabled() )
+ if ( !isPreviewEnabled() )
+ return;
+
+ stopComponentListening(m_xObject);
+ m_xObject = nullptr;
+ try
{
- stopComponentListening(m_xObject);
- m_xObject = nullptr;
- try
+ Reference<XNameAccess> xNameAccess;
+ if ( _bTable )
{
- Reference<XNameAccess> xNameAccess;
- if ( _bTable )
- {
- Reference<XTablesSupplier> xSup(_xConnection,UNO_QUERY);
- if ( xSup.is() )
- xNameAccess = xSup->getTables();
- }
- else
- {
- Reference<XQueriesSupplier> xSup(_xConnection,UNO_QUERY);
- if ( xSup.is() )
- xNameAccess = xSup->getQueries();
- }
- if ( xNameAccess.is() && xNameAccess->hasByName(_sName) )
- m_xObject.set(xNameAccess->getByName(_sName),UNO_QUERY);
+ Reference<XTablesSupplier> xSup(_xConnection,UNO_QUERY);
+ if ( xSup.is() )
+ xNameAccess = xSup->getTables();
}
- catch( const Exception& )
+ else
{
- DBG_UNHANDLED_EXCEPTION("dbaccess");
+ Reference<XQueriesSupplier> xSup(_xConnection,UNO_QUERY);
+ if ( xSup.is() )
+ xNameAccess = xSup->getQueries();
}
- if ( m_xObject.is() )
- startComponentListening(m_xObject);
- getDetailView()->showPreview(_sDataSourceName,_sName,_bTable);
+ if ( xNameAccess.is() && xNameAccess->hasByName(_sName) )
+ m_xObject.set(xNameAccess->getByName(_sName),UNO_QUERY);
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
}
+ if ( m_xObject.is() )
+ startComponentListening(m_xObject);
+ getDetailView()->showPreview(_sDataSourceName,_sName,_bTable);
}
void OApplicationView::GetFocus()
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index 4c74fad173d6..73fb0f2b6483 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -1231,34 +1231,36 @@ void SbaXDataBrowserController::frameAction(const css::frame::FrameActionEvent&
SbaXDataBrowserController_Base::frameAction( aEvent );
- if ( aEvent.Source == getFrame() )
- switch ( aEvent.Action )
- {
- case FrameAction_FRAME_ACTIVATED:
- case FrameAction_FRAME_UI_ACTIVATED:
- // ensure that the active cell (if any) has the focus
- m_aAsyncGetCellFocus.Call();
- // start the clipboard timer
- if (getBrowserView() && getBrowserView()->getVclControl() && !m_aInvalidateClipboard.IsActive())
- {
- m_aInvalidateClipboard.Start();
- OnInvalidateClipboard( nullptr );
- }
- break;
- case FrameAction_FRAME_DEACTIVATING:
- case FrameAction_FRAME_UI_DEACTIVATING:
- // stop the clipboard invalidator
- if (getBrowserView() && getBrowserView()->getVclControl() && m_aInvalidateClipboard.IsActive())
- {
- m_aInvalidateClipboard.Stop();
- OnInvalidateClipboard( nullptr );
- }
- // remove the "get cell focus"-event
- m_aAsyncGetCellFocus.CancelCall();
- break;
- default:
- break;
- }
+ if ( aEvent.Source != getFrame() )
+ return;
+
+ switch ( aEvent.Action )
+ {
+ case FrameAction_FRAME_ACTIVATED:
+ case FrameAction_FRAME_UI_ACTIVATED:
+ // ensure that the active cell (if any) has the focus
+ m_aAsyncGetCellFocus.Call();
+ // start the clipboard timer
+ if (getBrowserView() && getBrowserView()->getVclControl() && !m_aInvalidateClipboard.IsActive())
+ {
+ m_aInvalidateClipboard.Start();
+ OnInvalidateClipboard( nullptr );
+ }
+ break;
+ case FrameAction_FRAME_DEACTIVATING:
+ case FrameAction_FRAME_UI_DEACTIVATING:
+ // stop the clipboard invalidator
+ if (getBrowserView() && getBrowserView()->getVclControl() && m_aInvalidateClipboard.IsActive())
+ {
+ m_aInvalidateClipboard.Stop();
+ OnInvalidateClipboard( nullptr );
+ }
+ // remove the "get cell focus"-event
+ m_aAsyncGetCellFocus.CancelCall();
+ break;
+ default:
+ break;
+ }
}
IMPL_LINK_NOARG( SbaXDataBrowserController, OnAsyncDisplayError, void*, void )
@@ -2422,51 +2424,51 @@ void SbaXDataBrowserController::LoadFinished(bool /*bWasSynch*/)
{
m_nRowSetPrivileges = 0;
- if (isValid() && !loadingCancelled())
+ if (!(isValid() && !loadingCancelled()))
+ return;
+
+ // obtain cached values
+ try
{
- // obtain cached values
- try
- {
- Reference< XPropertySet > xFormProps( m_xLoadable, UNO_QUERY_THROW );
- OSL_VERIFY( xFormProps->getPropertyValue( PROPERTY_PRIVILEGES ) >>= m_nRowSetPrivileges );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
+ Reference< XPropertySet > xFormProps( m_xLoadable, UNO_QUERY_THROW );
+ OSL_VERIFY( xFormProps->getPropertyValue( PROPERTY_PRIVILEGES ) >>= m_nRowSetPrivileges );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
- // switch the control to alive mode
- getBrowserView()->getGridControl()->setDesignMode(false);
+ // switch the control to alive mode
+ getBrowserView()->getGridControl()->setDesignMode(false);
- initializeParser();
+ initializeParser();
- InvalidateAll();
+ InvalidateAll();
- m_aAsyncGetCellFocus.Call();
- }
+ m_aAsyncGetCellFocus.Call();
}
void SbaXDataBrowserController::initializeParser() const
{
- if ( !m_xParser.is() )
+ if ( m_xParser.is() )
+ return;
+
+ // create a parser (needed for filtering/sorting)
+ try
{
- // create a parser (needed for filtering/sorting)
- try
- {
- const Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY);
- if (::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING)))
- { // (only if the statement isn't native)
- // (it is allowed to use the PROPERTY_ISPASSTHROUGH : _after_ loading a form it is valid)
- xFormSet->getPropertyValue(PROPERTY_SINGLESELECTQUERYCOMPOSER) >>= m_xParser;
- }
- }
- catch(Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- m_xParser = nullptr;
- // no further handling, we ignore the error
+ const Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY);
+ if (::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING)))
+ { // (only if the statement isn't native)
+ // (it is allowed to use the PROPERTY_ISPASSTHROUGH : _after_ loading a form it is valid)
+ xFormSet->getPropertyValue(PROPERTY_SINGLESELECTQUERYCOMPOSER) >>= m_xParser;
}
}
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ m_xParser = nullptr;
+ // no further handling, we ignore the error
+ }
}
void SbaXDataBrowserController::loaded(const EventObject& /*aEvent*/)
diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx
index 83cda7b2f2ef..724969302a54 100644
--- a/dbaccess/source/ui/browser/dataview.cxx
+++ b/dbaccess/source/ui/browser/dataview.cxx
@@ -139,26 +139,26 @@ namespace dbaui
m_xController->notifyHiContrastChanged();
}
- if ( nType == StateChangedType::InitShow )
+ if ( nType != StateChangedType::InitShow )
+ return;
+
+ // now that there's a view which is finally visible, remove the "Hidden" value from the
+ // model's arguments.
+ try
{
- // now that there's a view which is finally visible, remove the "Hidden" value from the
- // model's arguments.
- try
- {
- Reference< XController > xController( m_xController->getXController(), UNO_SET_THROW );
- Reference< XModel > xModel = xController->getModel();
- if ( xModel.is() )
- {
- ::comphelper::NamedValueCollection aArgs( xModel->getArgs() );
- aArgs.remove( "Hidden" );
- xModel->attachResource( xModel->getURL(), aArgs.getPropertyValues() );
- }
- }
- catch( const Exception& )
+ Reference< XController > xController( m_xController->getXController(), UNO_SET_THROW );
+ Reference< XModel > xModel = xController->getModel();
+ if ( xModel.is() )
{
- DBG_UNHANDLED_EXCEPTION("dbaccess");
+ ::comphelper::NamedValueCollection aArgs( xModel->getArgs() );
+ aArgs.remove( "Hidden" );
+ xModel->attachResource( xModel->getURL(), aArgs.getPropertyValues() );
}
}
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
}
void ODataView::DataChanged( const DataChangedEvent& rDCEvt )
{
diff --git a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
index 1e3bfd3b57d1..7e9bfc851360 100644
--- a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
+++ b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
@@ -195,59 +195,59 @@ sal_Int32 SbaTableQueryBrowser::getDatabaseObjectType( EntryType _eType )
void SbaTableQueryBrowser::notifyHiContrastChanged()
{
- if ( m_pTreeView )
+ if ( !m_pTreeView )
+ return;
+
+ auto pTreeModel = m_pTreeView->GetTreeModel();
+ // change all bitmap entries
+ SvTreeListEntry* pEntryLoop = pTreeModel->First();
+ while ( pEntryLoop )
{
- auto pTreeModel = m_pTreeView->GetTreeModel();
- // change all bitmap entries
- SvTreeListEntry* pEntryLoop = pTreeModel->First();
- while ( pEntryLoop )
+ DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(pEntryLoop->GetUserData());
+ if ( !pData )
{
- DBTreeListUserData* pData = static_cast<DBTreeListUserData*>(pEntryLoop->GetUserData());
- if ( !pData )
- {
- pEntryLoop = pTreeModel->Next(pEntryLoop);
- continue;
- }
+ pEntryLoop = pTreeModel->Next(pEntryLoop);
+ continue;
+ }
- // the connection to which this entry belongs, if any
- std::unique_ptr< ImageProvider > pImageProvider( getImageProviderFor( pEntryLoop ) );
+ // the connection to which this entry belongs, if any
+ std::unique_ptr< ImageProvider > pImageProvider( getImageProviderFor( pEntryLoop ) );
- // the images for this entry
- Image aImage;
- if ( pData->eType == etDatasource )
- aImage = ImageProvider::getDatabaseImage();
- else
+ // the images for this entry
+ Image aImage;
+ if ( pData->eType == etDatasource )
+ aImage = ImageProvider::getDatabaseImage();
+ else
+ {
+ bool bIsFolder = !isObject( pData->eType );
+ if ( bIsFolder )
{
- bool bIsFolder = !isObject( pData->eType );
- if ( bIsFolder )
- {
- sal_Int32 nObjectType( getDatabaseObjectType( pData->eType ) );
- aImage = ImageProvider::getFolderImage( nObjectType );
- }
- else
- {
- sal_Int32 nObjectType( getDatabaseObjectType( pData->eType ) );
- pImageProvider->getImages( GetEntryText( pEntryLoop ), nObjectType, aImage );
- }
+ sal_Int32 nObjectType( getDatabaseObjectType( pData->eType ) );
+ aImage = ImageProvider::getFolderImage( nObjectType );
}
-
- // find the proper item, and set its icons
- sal_uInt16 nCount = pEntryLoop->ItemCount();
- for (sal_uInt16 i=0;i<nCount;++i)
+ else
{
- SvLBoxItem& rItem = pEntryLoop->GetItem(i);
- if (rItem.GetType() != SvLBoxItemType::ContextBmp)
- continue;
+ sal_Int32 nObjectType( getDatabaseObjectType( pData->eType ) );
+ pImageProvider->getImages( GetEntryText( pEntryLoop ), nObjectType, aImage );
+ }
+ }
- SvLBoxContextBmp& rContextBitmapItem = static_cast< SvLBoxContextBmp& >( rItem );
+ // find the proper item, and set its icons
+ sal_uInt16 nCount = pEntryLoop->ItemCount();
+ for (sal_uInt16 i=0;i<nCount;++i)
+ {
+ SvLBoxItem& rItem = pEntryLoop->GetItem(i);
+ if (rItem.GetType() != SvLBoxItemType::ContextBmp)
+ continue;
- rContextBitmapItem.SetBitmap1( aImage );
- rContextBitmapItem.SetBitmap2( aImage );
- break;
- }
+ SvLBoxContextBmp& rContextBitmapItem = static_cast< SvLBoxContextBmp& >( rItem );
- pEntryLoop = pTreeModel->Next(pEntryLoop);
+ rContextBitmapItem.SetBitmap1( aImage );
+ rContextBitmapItem.SetBitmap2( aImage );
+ break;
}
+
+ pEntryLoop = pTreeModel->Next(pEntryLoop);
}
}
diff --git a/dbaccess/source/ui/browser/exsrcbrw.cxx b/dbaccess/source/ui/browser/exsrcbrw.cxx
index 597ab6a73dff..f108670041c6 100644
--- a/dbaccess/source/ui/browser/exsrcbrw.cxx
+++ b/dbaccess/source/ui/browser/exsrcbrw.cxx
@@ -362,37 +362,36 @@ void SbaExternalSourceBrowser::Attach(const Reference< XRowSet > & xMaster)
m_pDataSourceImpl->AttachForm(xMaster);
startListening();
- if (xMaster.is())
- {
- // at this point we have to reset the formatter for the new form
- initFormatter();
- // assume that the master form is already loaded
+ if (!xMaster.is())
+ return;
+
+ // at this point we have to reset the formatter for the new form
+ initFormatter();
+ // assume that the master form is already loaded
#if OSL_DEBUG_LEVEL > 0
- {
- Reference< XLoadable > xLoadable( xMaster, UNO_QUERY );
- OSL_ENSURE( xLoadable.is() && xLoadable->isLoaded(), "SbaExternalSourceBrowser::Attach: master is not loaded!" );
- }
+ {
+ Reference< XLoadable > xLoadable( xMaster, UNO_QUERY );
+ OSL_ENSURE( xLoadable.is() && xLoadable->isLoaded(), "SbaExternalSourceBrowser::Attach: master is not loaded!" );
+ }
#endif
- LoadFinished(true);
-
- Reference< XResultSetUpdate > xUpdate(xMaster, UNO_QUERY);
- try
- {
- if (bWasInsertRow && xUpdate.is())
- xUpdate->moveToInsertRow();
- else if (xCursor.is() && aOldPos.hasValue())
- xCursor->moveToBookmark(aOldPos);
- else if(bBeforeFirst && xMaster.is())
- xMaster->beforeFirst();
- else if(bAfterLast && xMaster.is())
- xMaster->afterLast();
- }
- catch(Exception&)
- {
- SAL_WARN("dbaccess.ui", "SbaExternalSourceBrowser::Attach : couldn't restore the cursor position !");
- }
+ LoadFinished(true);
+ Reference< XResultSetUpdate > xUpdate(xMaster, UNO_QUERY);
+ try
+ {
+ if (bWasInsertRow && xUpdate.is())
+ xUpdate->moveToInsertRow();
+ else if (xCursor.is() && aOldPos.hasValue())
+ xCursor->moveToBookmark(aOldPos);
+ else if(bBeforeFirst && xMaster.is())
+ xMaster->beforeFirst();
+ else if(bAfterLast && xMaster.is())
+ xMaster->afterLast();
+ }
+ catch(Exception&)
+ {
+ SAL_WARN("dbaccess.ui", "SbaExternalSourceBrowser::Attach : couldn't restore the cursor position !");
}
}
diff --git a/dbaccess/source/ui/browser/formadapter.cxx b/dbaccess/source/ui/browser/formadapter.cxx
index cd1f0e958f14..800ee31db23d 100644
--- a/dbaccess/source/ui/browser/formadapter.cxx
+++ b/dbaccess/source/ui/browser/formadapter.cxx
@@ -177,19 +177,19 @@ void SbaXFormAdapter::AttachForm(const Reference< css::sdbc::XRowSet >& xNewMast
m_xMainForm = xNewMaster;
- if (m_xMainForm.is())
- {
- StartListening();
+ if (!m_xMainForm.is())
+ return;
- // if our new master is loaded we have to send an 'loaded' event
- Reference< css::form::XLoadable > xLoadable(m_xMainForm, UNO_QUERY);
- if (xLoadable->isLoaded())
- {
- css::lang::EventObject aEvt(*this);
- ::comphelper::OInterfaceIteratorHelper2 aIt(m_aLoadListeners);
- while (aIt.hasMoreElements())
- static_cast< css::form::XLoadListener*>(aIt.next())->loaded(aEvt);
- }
+ StartListening();
+
+ // if our new master is loaded we have to send an 'loaded' event
+ Reference< css::form::XLoadable > xLoadable(m_xMainForm, UNO_QUERY);
+ if (xLoadable->isLoaded())
+ {
+ css::lang::EventObject aEvt(*this);
+ ::comphelper::OInterfaceIteratorHelper2 aIt(m_aLoadListeners);
+ while (aIt.hasMoreElements())
+ static_cast< css::form::XLoadListener*>(aIt.next())->loaded(aEvt);
}
// TODO : perhaps _all_ of our listeners should be notified about our new state
@@ -1622,18 +1622,18 @@ Reference< css::container::XEnumeration > SAL_CALL SbaXFormAdapter::createEnumer
// css::beans::XPropertyChangeListener
void SAL_CALL SbaXFormAdapter::propertyChange(const css::beans::PropertyChangeEvent& evt)
{
- if (evt.PropertyName == PROPERTY_NAME)
- {
- std::vector< css::uno::Reference< css::form::XFormComponent > >::const_iterator aIter = std::find_if( m_aChildren.begin(),
- m_aChildren.end(),
- [&evt](css::uno::Reference< css::uno::XInterface > const & x) { return x == evt.Source; });
+ if (evt.PropertyName != PROPERTY_NAME)
+ return;
- if(aIter != m_aChildren.end())
- {
- sal_Int32 nPos = aIter - m_aChildren.begin();
- OSL_ENSURE(*(m_aChildNames.begin() + nPos) == ::comphelper::getString(evt.OldValue), "SAL_CALL SbaXFormAdapter::propertyChange : object has a wrong name !");
- *(m_aChildNames.begin() + nPos) = ::comphelper::getString(evt.NewValue);
- }
+ std::vector< css::uno::Reference< css::form::XFormComponent > >::const_iterator aIter = std::find_if( m_aChildren.begin(),
+ m_aChildren.end(),
+ [&evt](css::uno::Reference< css::uno::XInterface > const & x) { return x == evt.Source; });
+
+ if(aIter != m_aChildren.end())
+ {
+ sal_Int32 nPos = aIter - m_aChildren.begin();
+ OSL_ENSURE(*(m_aChildNames.begin() + nPos) == ::comphelper::getString(evt.OldValue), "SAL_CALL SbaXFormAdapter::propertyChange : object has a wrong name !");
+ *(m_aChildNames.begin() + nPos) = ::comphelper::getString(evt.NewValue);
}
}
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 91166e08617b..3cfbfb542c3e 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -219,26 +219,26 @@ void SAL_CALL SbaXGridControl::dispatch(const css::util::URL& aURL, const Sequen
void SAL_CALL SbaXGridControl::addStatusListener( const Reference< XStatusListener > & _rxListener, const URL& _rURL )
{
::osl::MutexGuard aGuard( GetMutex() );
- if ( _rxListener.is() )
+ if ( !_rxListener.is() )
+ return;
+
+ rtl::Reference<SbaXStatusMultiplexer>& xMultiplexer = m_aStatusMultiplexer[ _rURL ];
+ if ( !xMultiplexer.is() )
{
- rtl::Reference<SbaXStatusMultiplexer>& xMultiplexer = m_aStatusMultiplexer[ _rURL ];
- if ( !xMultiplexer.is() )
- {
- xMultiplexer = new SbaXStatusMultiplexer( *this, GetMutex() );
- }
+ xMultiplexer = new SbaXStatusMultiplexer( *this, GetMutex() );
+ }
- xMultiplexer->addInterface( _rxListener );
- if ( getPeer().is() )
- {
- if ( 1 == xMultiplexer->getLength() )
- { // the first external listener for this URL
- Reference< XDispatch > xDisp( getPeer(), UNO_QUERY );
- xDisp->addStatusListener( xMultiplexer.get(), _rURL );
- }
- else
- { // already have other listeners for this URL
- _rxListener->statusChanged( xMultiplexer->getLastEvent() );
- }
+ xMultiplexer->addInterface( _rxListener );
+ if ( getPeer().is() )
+ {
+ if ( 1 == xMultiplexer->getLength() )
+ { // the first external listener for this URL
+ Reference< XDispatch > xDisp( getPeer(), UNO_QUERY );
+ xDisp->addStatusListener( xMultiplexer.get(), _rURL );
+ }
+ else
+ { // already have other listeners for this URL
+ _rxListener->statusChanged( xMultiplexer->getLastEvent() );
}
}
}
@@ -356,21 +356,21 @@ Reference< css::frame::XDispatch > SAL_CALL SbaXGridPeer::queryDispatch(const c
IMPL_LINK_NOARG( SbaXGridPeer, OnDispatchEvent, void*, void )
{
VclPtr< SbaGridControl > pGrid = GetAs< SbaGridControl >();
- if ( pGrid ) // if this fails, we were disposing before arriving here
+ if ( !pGrid ) // if this fails, we were disposing before arriving here
+ return;
+
+ if ( !Application::IsMainThread() )
{
- if ( !Application::IsMainThread() )
- {
- // still not in the main thread (see SbaXGridPeer::dispatch). post an event, again
- // without moving the special even to the back of the queue
- pGrid->PostUserEvent( LINK( this, SbaXGridPeer, OnDispatchEvent ) );
- }
- else
- {
- DispatchArgs aArgs = m_aDispatchArgs.front();
- m_aDispatchArgs.pop();
+ // still not in the main thread (see SbaXGridPeer::dispatch). post an event, again
+ // without moving the special even to the back of the queue
+ pGrid->PostUserEvent( LINK( this, SbaXGridPeer, OnDispatchEvent ) );
+ }
+ else
+ {
+ DispatchArgs aArgs = m_aDispatchArgs.front();
+ m_aDispatchArgs.pop();
- SbaXGridPeer::dispatch( aArgs.aURL, aArgs.aArgs );
- }
+ SbaXGridPeer::dispatch( aArgs.aURL, aArgs.aArgs );
}
}
@@ -440,49 +440,49 @@ void SAL_CALL SbaXGridPeer::dispatch(const URL& aURL, const Sequence< PropertyVa
DispatchType eURLType = classifyDispatchURL( aURL );
- if ( dtUnknown != eURLType )
- {
- // notify any status listeners that the dialog is now active (well, about to be active)
- MapDispatchToBool::const_iterator aThisURLState = m_aDispatchStates.emplace( eURLType, true ).first;
- NotifyStatusChanged( aURL, nullptr );
-
- // execute the dialog
- switch ( eURLType )
- {
- case dtBrowserAttribs:
- pGrid->SetBrowserAttrs();
- break;
+ if ( dtUnknown == eURLType )
+ return;
- case dtRowHeight:
- pGrid->SetRowHeight();
- break;
+ // notify any status listeners that the dialog is now active (well, about to be active)
+ MapDispatchToBool::const_iterator aThisURLState = m_aDispatchStates.emplace( eURLType, true ).first;
+ NotifyStatusChanged( aURL, nullptr );
- case dtColumnAttribs:
- {
- OSL_ENSURE(nColId != -1, "SbaXGridPeer::dispatch : invalid parameter !");
- if (nColId != -1)
- break;
- pGrid->SetColAttrs(nColId);
- }
+ // execute the dialog
+ switch ( eURLType )
+ {
+ case dtBrowserAttribs:
+ pGrid->SetBrowserAttrs();
break;
- case dtColumnWidth:
- {
- OSL_ENSURE(nColId != -1, "SbaXGridPeer::dispatch : invalid parameter !");
- if (nColId != -1)
- break;
- pGrid->SetColWidth(nColId);
- }
+ case dtRowHeight:
+ pGrid->SetRowHeight();
break;
- case dtUnknown:
+ case dtColumnAttribs:
+ {
+ OSL_ENSURE(nColId != -1, "SbaXGridPeer::dispatch : invalid parameter !");
+ if (nColId != -1)
+ break;
+ pGrid->SetColAttrs(nColId);
+ }
+ break;
+
+ case dtColumnWidth:
+ {
+ OSL_ENSURE(nColId != -1, "SbaXGridPeer::dispatch : invalid parameter !");
+ if (nColId != -1)
break;
+ pGrid->SetColWidth(nColId);
}
+ break;
- // notify any status listeners that the dialog vanished
- m_aDispatchStates.erase( aThisURLState );
- NotifyStatusChanged( aURL, nullptr );
+ case dtUnknown:
+ break;
}
+
+ // notify any status listeners that the dialog vanished
+ m_aDispatchStates.erase( aThisURLState );
+ NotifyStatusChanged( aURL, nullptr );
}
void SAL_CALL SbaXGridPeer::addStatusListener(const Reference< css::frame::XStatusListener > & xControl, const css::util::URL& aURL)
@@ -567,23 +567,23 @@ void SbaGridHeader::ImplStartColumnDrag(sal_Int8 _nAction, const Point& _rMouseP
aColRect.AdjustRight( -3 );
bResizingCol = !aColRect.IsInside(_rMousePos);
}
- if (!bResizingCol)
- {
- // force the base class to end its drag mode
- EndTracking(TrackingEventFlags::Cancel | TrackingEventFlags::End);
-
- // because we have 3d-buttons the select handler is called from MouseButtonUp, but StartDrag
- // occurs earlier (while the mouse button is down)
- // so for optical reasons we select the column before really starting the drag operation.
- notifyColumnSelect(nId);
-
- static_cast<SbaGridControl*>(GetParent())->StartDrag(_nAction,
- Point(
- _rMousePos.X() + GetPosPixel().X(), // we aren't left-justified with our parent, in contrast to the data window
- _rMousePos.Y() - GetSizePixel().Height()
- )
- );
- }
+ if (bResizingCol)
+ return;
+
+ // force the base class to end its drag mode
+ EndTracking(TrackingEventFlags::Cancel | TrackingEventFlags::End);
+
+ // because we have 3d-buttons the select handler is called from MouseButtonUp, but StartDrag
+ // occurs earlier (while the mouse button is down)
+ // so for optical reasons we select the column before really starting the drag operation.
+ notifyColumnSelect(nId);
+
+ static_cast<SbaGridControl*>(GetParent())->StartDrag(_nAction,
+ Point(
+ _rMousePos.X() + GetPosPixel().X(), // we aren't left-justified with our parent, in contrast to the data window
+ _rMousePos.Y() - GetSizePixel().Height()
+ )
+ );
}
void SbaGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMenu)
@@ -610,36 +610,36 @@ void SbaGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rM
// prepend some new items
bool bColAttrs = (nColId != sal_uInt16(-1)) && (nColId != 0);
- if ( bColAttrs && !bDBIsReadOnly)
- {
- sal_uInt16 nPos = 0;
- sal_uInt16 nModelPos = static_cast<SbaGridControl*>(GetParent())->GetModelColumnPos(nColId);
- Reference< XPropertySet > xField = static_cast<SbaGridControl*>(GetParent())->getField(nModelPos);
+ if ( !(bColAttrs && !bDBIsReadOnly))
+ return;
- if ( xField.is() )
+ sal_uInt16 nPos = 0;
+ sal_uInt16 nModelPos = static_cast<SbaGridControl*>(GetParent())->GetModelColumnPos(nColId);
+ Reference< XPropertySet > xField = static_cast<SbaGridControl*>(GetParent())->getField(nModelPos);
+
+ if ( xField.is() )
+ {
+ switch( ::comphelper::getINT32(xField->getPropertyValue(PROPERTY_TYPE)) )
{
- switch( ::comphelper::getINT32(xField->getPropertyValue(PROPERTY_TYPE)) )
- {
- case DataType::BINARY:
- case DataType::VARBINARY:
- case DataType::LONGVARBINARY:
- case DataType::SQLNULL:
- case DataType::OBJECT:
- case DataType::BLOB:
- case DataType::CLOB:
- case DataType::REF:
- break;
- default:
- rMenu.InsertItem(ID_BROWSER_COLATTRSET, DBA_RES(RID_STR_COLUMN_FORMAT), MenuItemBits::NONE, OString(), nPos++);
- rMenu.SetHelpId(ID_BROWSER_COLATTRSET, HID_BROWSER_COLUMNFORMAT);
- rMenu.InsertSeparator(OString(), nPos++);
- }
+ case DataType::BINARY:
+ case DataType::VARBINARY:
+ case DataType::LONGVARBINARY:
+ case DataType::SQLNULL:
+ case DataType::OBJECT:
+ case DataType::BLOB:
+ case DataType::CLOB:
+ case DataType::REF:
+ break;
+ default:
+ rMenu.InsertItem(ID_BROWSER_COLATTRSET, DBA_RES(RID_STR_COLUMN_FORMAT), MenuItemBits::NONE, OString(), nPos++);
+ rMenu.SetHelpId(ID_BROWSER_COLATTRSET, HID_BROWSER_COLUMNFORMAT);
+ rMenu.InsertSeparator(OString(), nPos++);
}
-
- rMenu.InsertItem(ID_BROWSER_COLWIDTH, DBA_RES(RID_STR_COLUMN_WIDTH), MenuItemBits::NONE, OString(), nPos++);
- rMenu.SetHelpId(ID_BROWSER_COLWIDTH, HID_BROWSER_COLUMNWIDTH);
- rMenu.InsertSeparator(OString(), nPos++);
}
+
+ rMenu.InsertItem(ID_BROWSER_COLWIDTH, DBA_RES(RID_STR_COLUMN_WIDTH), MenuItemBits::NONE, OString(), nPos++);
+ rMenu.SetHelpId(ID_BROWSER_COLWIDTH, HID_BROWSER_COLUMNWIDTH);
+ rMenu.InsertSeparator(OString(), nPos++);
}
void SbaGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMenu& rMenu, sal_uInt16 nExecutionResult)
@@ -752,29 +752,29 @@ void SbaGridControl::SetColWidth(sal_uInt16 nColId)
if (xCols.is() && (nModelPos != sal_uInt16(-1)))
xAffectedCol.set(xCols->getByIndex(nModelPos), css::uno::UNO_QUERY);
- if (xAffectedCol.is())
- {
- Any aWidth = xAffectedCol->getPropertyValue(PROPERTY_WIDTH);
- sal_Int32 nCurWidth = aWidth.hasValue() ? ::comphelper::getINT32(aWidth) : -1;
+ if (!xAffectedCol.is())
+ return;
+
+ Any aWidth = xAffectedCol->getPropertyValue(PROPERTY_WIDTH);
+ sal_Int32 nCurWidth = aWidth.hasValue() ? ::comphelper::getINT32(aWidth) : -1;
- DlgSize aDlgColWidth(GetFrameWeld(), nCurWidth, false);
- if (aDlgColWidth.run() == RET_OK)
+ DlgSize aDlgColWidth(GetFrameWeld(), nCurWidth, false);
+ if (aDlgColWidth.run() != RET_OK)
+ return;
+
+ sal_Int32 nValue = aDlgColWidth.GetValue();
+ Any aNewWidth;
+ if (-1 == nValue)
+ { // set to default
+ Reference< XPropertyState > xPropState(xAffectedCol, UNO_QUERY);
+ if (xPropState.is())
{
- sal_Int32 nValue = aDlgColWidth.GetValue();
- Any aNewWidth;
- if (-1 == nValue)
- { // set to default
- Reference< XPropertyState > xPropState(xAffectedCol, UNO_QUERY);
- if (xPropState.is())
- {
- try { aNewWidth = xPropState->getPropertyDefault(PROPERTY_WIDTH); } catch(Exception&) { } ;
- }
- }
- else
- aNewWidth <<= nValue;
- try { xAffectedCol->setPropertyValue(PROPERTY_WIDTH, aNewWidth); } catch(Exception&) { } ;
+ try { aNewWidth = xPropState->getPropertyDefault(PROPERTY_WIDTH); } catch(Exception&) { } ;
}
}
+ else
+ aNewWidth <<= nValue;
+ try { xAffectedCol->setPropertyValue(PROPERTY_WIDTH, aNewWidth); } catch(Exception&) { } ;
}
void SbaGridControl::SetRowHeight()
@@ -787,33 +787,33 @@ void SbaGridControl::SetRowHeight()
sal_Int32 nCurHeight = aHeight.hasValue() ? ::comphelper::getINT32(aHeight) : -1;
DlgSize aDlgRowHeight(GetFrameWeld(), nCurHeight, true);
- if (aDlgRowHeight.run() == RET_OK)
- {
- sal_Int32 nValue = aDlgRowHeight.GetValue();
- Any aNewHeight;
- if (sal_Int16(-1) == nValue)
- { // set to default
- Reference< XPropertyState > xPropState(xCols, UNO_QUERY);
- if (xPropState.is())
+ if (aDlgRowHeight.run() != RET_OK)
+ return;
+
+ sal_Int32 nValue = aDlgRowHeight.GetValue();
+ Any aNewHeight;
+ if (sal_Int16(-1) == nValue)
+ { // set to default
+ Reference< XPropertyState > xPropState(xCols, UNO_QUERY);
+ if (xPropState.is())
+ {
+ try
{
- try
- {
- aNewHeight = xPropState->getPropertyDefault(PROPERTY_ROW_HEIGHT);
- }
- catch(Exception&)
- { }
+ aNewHeight = xPropState->getPropertyDefault(PROPERTY_ROW_HEIGHT);
}
+ catch(Exception&)
+ { }
}
- else
- aNewHeight <<= nValue;
- try
- {
- xCols->setPropertyValue(PROPERTY_ROW_HEIGHT, aNewHeight);
- }
- catch(Exception&)
- {
- OSL_FAIL("setPropertyValue: PROPERTY_ROW_HEIGHT throws an exception");
- }
+ }
+ else
+ aNewHeight <<= nValue;
+ try
+ {
+ xCols->setPropertyValue(PROPERTY_ROW_HEIGHT, aNewHeight);
+ }
+ catch(Exception&)
+ {
+ OSL_FAIL("setPropertyValue: PROPERTY_ROW_HEIGHT throws an exception");
}
}
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 641dd537a861..cc74ae42fb79 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -1237,61 +1237,61 @@ void SbaTableQueryBrowser::connectExternalDispatches()
{
Reference< XDispatchProvider > xProvider( getFrame(), UNO_QUERY );
OSL_ENSURE(xProvider.is(), "SbaTableQueryBrowser::connectExternalDispatches: no DispatchProvider !");
- if (xProvider.is())
- {
- if ( m_aExternalFeatures.empty() )
- {
- const char* pURLs[] = {
- ".uno:DataSourceBrowser/DocumentDataSource",
- ".uno:DataSourceBrowser/FormLetter",
- ".uno:DataSourceBrowser/InsertColumns",
- ".uno:DataSourceBrowser/InsertContent",
- };
- const sal_uInt16 nIds[] = {
- ID_BROWSER_DOCUMENT_DATASOURCE,
- ID_BROWSER_FORMLETTER,
- ID_BROWSER_INSERTCOLUMNS,
- ID_BROWSER_INSERTCONTENT
- };
-
- for ( size_t i=0; i < SAL_N_ELEMENTS( pURLs ); ++i )
- {
- URL aURL;
- aURL.Complete = OUString::createFromAscii( pURLs[i] );
- if ( m_xUrlTransformer.is() )
- m_xUrlTransformer->parseStrict( aURL );
- m_aExternalFeatures[ nIds[ i ] ] = ExternalFeature( aURL );
- }
+ if (!xProvider.is())
+ return;
+
+ if ( m_aExternalFeatures.empty() )
+ {
+ const char* pURLs[] = {
+ ".uno:DataSourceBrowser/DocumentDataSource",
+ ".uno:DataSourceBrowser/FormLetter",
+ ".uno:DataSourceBrowser/InsertColumns",
+ ".uno:DataSourceBrowser/InsertContent",
+ };
+ const sal_uInt16 nIds[] = {
+ ID_BROWSER_DOCUMENT_DATASOURCE,
+ ID_BROWSER_FORMLETTER,
+ ID_BROWSER_INSERTCOLUMNS,
+ ID_BROWSER_INSERTCONTENT
+ };
+
+ for ( size_t i=0; i < SAL_N_ELEMENTS( pURLs ); ++i )
+ {
+ URL aURL;
+ aURL.Complete = OUString::createFromAscii( pURLs[i] );
+ if ( m_xUrlTransformer.is() )
+ m_xUrlTransformer->parseStrict( aURL );
+ m_aExternalFeatures[ nIds[ i ] ] = ExternalFeature( aURL );
}
+ }
- for (auto & externalFeature : m_aExternalFeatures)
+ for (auto & externalFeature : m_aExternalFeatures)
+ {
+ externalFeature.second.xDispatcher = xProvider->queryDispatch(
+ externalFeature.second.aURL, "_parent", FrameSearchFlag::PARENT
+ );
+
+ if ( externalFeature.second.xDispatcher.get() == static_cast< XDispatch* >( this ) )
{
- externalFeature.second.xDispatcher = xProvider->queryDispatch(
- externalFeature.second.aURL, "_parent", FrameSearchFlag::PARENT
- );
+ SAL_WARN("dbaccess.ui", "SbaTableQueryBrowser::connectExternalDispatches: this should not happen anymore!" );
+ // (nowadays, the URLs aren't in our SupportedFeatures list anymore, so we should
+ // not supply a dispatcher for this)
+ externalFeature.second.xDispatcher.clear();
+ }
- if ( externalFeature.second.xDispatcher.get() == static_cast< XDispatch* >( this ) )
+ if ( externalFeature.second.xDispatcher.is() )
+ {
+ try
{
- SAL_WARN("dbaccess.ui", "SbaTableQueryBrowser::connectExternalDispatches: this should not happen anymore!" );
- // (nowadays, the URLs aren't in our SupportedFeatures list anymore, so we should
- // not supply a dispatcher for this)
- externalFeature.second.xDispatcher.clear();
+ externalFeature.second.xDispatcher->addStatusListener( this, externalFeature.second.aURL );
}
-
- if ( externalFeature.second.xDispatcher.is() )
+ catch( const Exception& )
{
- try
- {
- externalFeature.second.xDispatcher->addStatusListener( this, externalFeature.second.aURL );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
}
-
- implCheckExternalSlot( externalFeature.first );
}
+
+ implCheckExternalSlot( externalFeature.first );
}
}
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index 315b2998739a..976943b27796 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -338,25 +338,25 @@ IMPL_LINK_NOARG(OFieldDescControl, FormatClickHdl, weld::Button&, void)
return;
SvNumberFormatter* pFormatter = pSupplierImpl->GetNumberFormatter();
- if(::dbaui::callColumnFormatDialog(this,pFormatter,pActFieldDescr->GetType(),nOldFormatKey,rOldJustify,true))
+ if(!::dbaui::callColumnFormatDialog(this,pFormatter,pActFieldDescr->GetType(),nOldFormatKey,rOldJustify,true))
+ return;
+
+ bool bModified = false;
+ if(nOldFormatKey != pActFieldDescr->GetFormatKey())
{
- bool bModified = false;
- if(nOldFormatKey != pActFieldDescr->GetFormatKey())
- {
- pActFieldDescr->SetFormatKey( nOldFormatKey );
- bModified = true;
- }
- if(rOldJustify != pActFieldDescr->GetHorJustify())
- {
- pActFieldDescr->SetHorJustify( rOldJustify );
- bModified = true;
- }
+ pActFieldDescr->SetFormatKey( nOldFormatKey );
+ bModified = true;
+ }
+ if(rOldJustify != pActFieldDescr->GetHorJustify())
+ {
+ pActFieldDescr->SetHorJustify( rOldJustify );
+ bModified = true;
+ }
- if(bModified)
- {
- SetModified(true);
- UpdateFormatSample(pActFieldDescr);
- }
+ if(bModified)
+ {
+ SetModified(true);
+ UpdateFormatSample(pActFieldDescr);
}
}
diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx
index 2f1421d85e7e..e448c69bfebd 100644
--- a/dbaccess/source/ui/control/RelationControl.cxx
+++ b/dbaccess/source/ui/control/RelationControl.cxx
@@ -304,19 +304,19 @@ namespace dbaui
break;
}
- if ( xDef.is() )
+ if ( !xDef.is() )
+ return;
+
+ fillListBox(xDef);
+ OUString sName = GetCellText( nRow, nColumnId );
+ m_pListCell->SelectEntry( sName );
+ if ( m_pListCell->GetSelectedEntry() != sName )
{
- fillListBox(xDef);
- OUString sName = GetCellText( nRow, nColumnId );
+ m_pListCell->InsertEntry( sName );
m_pListCell->SelectEntry( sName );
- if ( m_pListCell->GetSelectedEntry() != sName )
- {
- m_pListCell->InsertEntry( sName );
- m_pListCell->SelectEntry( sName );
- }
-
- m_pListCell->SetHelpId(sHelpId);
}
+
+ m_pListCell->SetHelpId(sHelpId);
}
CellController* ORelationControl::GetController( long /*nRow*/, sal_uInt16 /*nColumnId*/ )
diff --git a/dbaccess/source/ui/control/TableGrantCtrl.cxx b/dbaccess/source/ui/control/TableGrantCtrl.cxx
index 405e0f3d6e14..d4c6829af5cd 100644
--- a/dbaccess/source/ui/control/TableGrantCtrl.cxx
+++ b/dbaccess/source/ui/control/TableGrantCtrl.cxx
@@ -287,32 +287,32 @@ void OTableGrantControl::InitController( CellControllerRef& /*rController*/, lon
void OTableGrantControl::fillPrivilege(sal_Int32 _nRow) const
{
- if ( m_xUsers->hasByName(m_sUserName) )
+ if ( !m_xUsers->hasByName(m_sUserName) )
+ return;
+
+ try
{
- try
- {
- Reference<XAuthorizable> xAuth(m_xUsers->getByName(m_sUserName),UNO_QUERY);
- if ( xAuth.is() )
- {
- // get the privileges
- TPrivileges nRights;
- nRights.nRights = xAuth->getPrivileges(m_aTableNames[_nRow],PrivilegeObject::TABLE);
- if(m_xGrantUser.is())
- nRights.nWithGrant = m_xGrantUser->getGrantablePrivileges(m_aTableNames[_nRow],PrivilegeObject::TABLE);
- else
- nRights.nWithGrant = 0;
-
- m_aPrivMap[m_aTableNames[_nRow]] = nRights;
- }
- }
- catch(SQLException& e)
- {
- ::dbtools::showError(::dbtools::SQLExceptionInfo(e),VCLUnoHelper::GetInterface(GetParent()),m_xContext);
- }
- catch(Exception& )
+ Reference<XAuthorizable> xAuth(m_xUsers->getByName(m_sUserName),UNO_QUERY);
+ if ( xAuth.is() )
{
+ // get the privileges
+ TPrivileges nRights;
+ nRights.nRights = xAuth->getPrivileges(m_aTableNames[_nRow],PrivilegeObject::TABLE);
+ if(m_xGrantUser.is())
+ nRights.nWithGrant = m_xGrantUser->getGrantablePrivileges(m_aTableNames[_nRow],PrivilegeObject::TABLE);
+ else
+ nRights.nWithGrant = 0;
+
+ m_aPrivMap[m_aTableNames[_nRow]] = nRights;
}
}
+ catch(SQLException& e)
+ {
+ ::dbtools::showError(::dbtools::SQLExceptionInfo(e),VCLUnoHelper::GetInterface(GetParent()),m_xContext);
+ }
+ catch(Exception& )
+ {
+ }
}
bool OTableGrantControl::isAllowed(sal_uInt16 _nColumnId,sal_Int32 _nPrivilege)
diff --git a/dbaccess/source/ui/control/sqledit.cxx b/dbaccess/source/ui/control/sqledit.cxx
index e494b452c325..1cdb1c4c5793 100644
--- a/dbaccess/source/ui/control/sqledit.cxx
+++ b/dbaccess/source/ui/control/sqledit.cxx
@@ -152,20 +152,20 @@ void OSqlEdit::GetFocus()
IMPL_LINK_NOARG(OSqlEdit, OnUndoActionTimer, Timer *, void)
{
OUString aText = GetText();
- if(aText != m_strOrigText)
- {
- OJoinController& rController = m_pView->getContainerWindow()->getDesignView()->getController();
- SfxUndoManager& rUndoMgr = rController.GetUndoManager();
- std::unique_ptr<OSqlEditUndoAct> pUndoAct(new OSqlEditUndoAct( this ));
+ if(aText == m_strOrigText)
+ return;
+
+ OJoinController& rController = m_pView->getContainerWindow()->getDesignView()->getController();
+ SfxUndoManager& rUndoMgr = rController.GetUndoManager();
+ std::unique_ptr<OSqlEditUndoAct> pUndoAct(new OSqlEditUndoAct( this ));
- pUndoAct->SetOriginalText( m_strOrigText );
- rUndoMgr.AddUndoAction( std::move(pUndoAct) );
+ pUndoAct->SetOriginalText( m_strOrigText );
+ rUndoMgr.AddUndoAction( std::move(pUndoAct) );
- rController.InvalidateFeature(SID_UNDO);
- rController.InvalidateFeature(SID_REDO);
+ rController.InvalidateFeature(SID_UNDO);
+ rController.InvalidateFeature(SID_REDO);
- m_strOrigText =aText;
- }
+ m_strOrigText =aText;
}
IMPL_LINK_NOARG(OSqlEdit, OnInvalidateTimer, Timer *, void)
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx
index 2fec1cee16b6..e29402a505d0 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx
@@ -209,36 +209,36 @@ namespace dbaui
const SfxBoolItem* pAllowEmptyPwd = _rSet.GetItem<SfxBoolItem>(DSID_PASSWORDREQUIRED);
// forward the values to the controls
- if ( bValid )
- {
- m_xUserName->set_text(pUidItem->GetValue());
- m_xPasswordRequired->set_active(pAllowEmptyPwd->GetValue());
+ if ( !bValid )
+ return;
- const OUString& sUrl = pUrlItem->GetValue();
- setURL( sUrl );
+ m_xUserName->set_text(pUidItem->GetValue());
+ m_xPasswordRequired->set_active(pAllowEmptyPwd->GetValue());
- const bool bEnableJDBC = m_pCollection->determineType(m_eType) == ::dbaccess::DST_JDBC;
- if ( !pJdbcDrvItem->GetValue().getLength() )
- {
- OUString sDefaultJdbcDriverName = m_pCollection->getJavaDriverClass(m_eType);
- if ( !sDefaultJdbcDriverName.isEmpty() )
- m_xJavaDriver->set_text(sDefaultJdbcDriverName);
- }
- else
- m_xJavaDriver->set_text(pJdbcDrvItem->GetValue());
+ const OUString& sUrl = pUrlItem->GetValue();
+ setURL( sUrl );
- m_xJavaDriverLabel->set_visible(bEnableJDBC);
- m_xJavaDriver->set_visible(bEnableJDBC);
- m_xTestJavaDriver->set_visible(bEnableJDBC);
- m_xTestJavaDriver->set_sensitive( !m_xJavaDriver->get_text().trim().isEmpty() );
- m_xFL3->set_visible(bEnableJDBC);
+ const bool bEnableJDBC = m_pCollection->determineType(m_eType) == ::dbaccess::DST_JDBC;
+ if ( !pJdbcDrvItem->GetValue().getLength() )
+ {
+ OUString sDefaultJdbcDriverName = m_pCollection->getJavaDriverClass(m_eType);
+ if ( !sDefaultJdbcDriverName.isEmpty() )
+ m_xJavaDriver->set_text(sDefaultJdbcDriverName);
+ }
+ else
+ m_xJavaDriver->set_text(pJdbcDrvItem->GetValue());
- checkTestConnection();
+ m_xJavaDriverLabel->set_visible(bEnableJDBC);
+ m_xJavaDriver->set_visible(bEnableJDBC);
+ m_xTestJavaDriver->set_visible(bEnableJDBC);
+ m_xTestJavaDriver->set_sensitive( !m_xJavaDriver->get_text().trim().isEmpty() );
+ m_xFL3->set_visible(bEnableJDBC);
- m_xUserName->save_value();
- m_xConnectionURL->save_value();
- m_xJavaDriver->save_value();
- }
+ checkTestConnection();
+
+ m_xUserName->save_value();
+ m_xConnectionURL->save_value();
+ m_xJavaDriver->save_value();
}
bool OConnectionTabPage::FillItemSet(SfxItemSet* _rSet)
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 2645cd70373b..ae6735d4c029 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -781,24 +781,24 @@ void ODbDataSourceAdministrationHelper::fillDatasourceInfo(const SfxItemSet& _rS
}
// check which values are still left ('cause they were not present in the original sequence, but are to be set)
- if ( !aRelevantSettings.empty() )
+ if ( aRelevantSettings.empty() )
+ return;
+
+ sal_Int32 nOldLength = _rInfo.getLength();
+ _rInfo.realloc(nOldLength + aRelevantSettings.size());
+ PropertyValue* pAppendValues = _rInfo.getArray() + nOldLength;
+ for (auto const& relevantSetting : aRelevantSettings)
{
- sal_Int32 nOldLength = _rInfo.getLength();
- _rInfo.realloc(nOldLength + aRelevantSettings.size());
- PropertyValue* pAppendValues = _rInfo.getArray() + nOldLength;
- for (auto const& relevantSetting : aRelevantSettings)
+ if ( relevantSetting.Name == INFO_CHARSET )
{
- if ( relevantSetting.Name == INFO_CHARSET )
- {
- OUString sCharSet;
- relevantSetting.Value >>= sCharSet;
- if ( !sCharSet.isEmpty() )
- *pAppendValues = relevantSetting;
- }
- else
+ OUString sCharSet;
+ relevantSetting.Value >>= sCharSet;
+ if ( !sCharSet.isEmpty() )
*pAppendValues = relevantSetting;
- ++pAppendValues;
}
+ else
+ *pAppendValues = relevantSetting;
+ ++pAppendValues;
}
}
diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx
index e4d75d15bcb4..3f709f845d9d 100644
--- a/dbaccess/source/ui/dlg/adminpages.cxx
+++ b/dbaccess/source/ui/dlg/adminpages.cxx
@@ -194,24 +194,24 @@ namespace dbaui
}
void OGenericAdministrationPage::fillBool( SfxItemSet& _rSet, const weld::CheckButton* pCheckBox, sal_uInt16 _nID, bool bOptionalBool, bool& _bChangedSomething, bool _bRevertValue )
{
- if (pCheckBox && pCheckBox->get_state_changed_from_saved())
- {
- bool bValue = pCheckBox->get_active();
- if ( _bRevertValue )
- bValue = !bValue;
+ if (!(pCheckBox && pCheckBox->get_state_changed_from_saved()))
+ return;
- if (bOptionalBool)
- {
- OptionalBoolItem aValue( _nID );
- if ( pCheckBox->get_state() != TRISTATE_INDET )
- aValue.SetValue( bValue );
- _rSet.Put( aValue );
- }
- else
- _rSet.Put( SfxBoolItem( _nID, bValue ) );
+ bool bValue = pCheckBox->get_active();
+ if ( _bRevertValue )
+ bValue = !bValue;
- _bChangedSomething = true;
+ if (bOptionalBool)
+ {
+ OptionalBoolItem aValue( _nID );
+ if ( pCheckBox->get_state() != TRISTATE_INDET )
+ aValue.SetValue( bValue );
+ _rSet.Put( aValue );
}
+ else
+ _rSet.Put( SfxBoolItem( _nID, bValue ) );
+
+ _bChangedSomething = true;
}
void OGenericAdministrationPage::fillInt32(SfxItemSet& _rSet, const weld::SpinButton* pEdit, sal_uInt16 _nID, bool& _bChangedSomething)
{
@@ -242,41 +242,41 @@ namespace dbaui
{
OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
bool bSuccess = false;
- if ( m_pAdminDialog )
+ if ( !m_pAdminDialog )
+ return;
+
+ m_pAdminDialog->saveDatasource();
+ OGenericAdministrationPage::implInitControls(*m_pItemSetHelper->getOutputSet(), true);
+ bool bShowMessage = true;
+ try
{
- m_pAdminDialog->saveDatasource();
- OGenericAdministrationPage::implInitControls(*m_pItemSetHelper->getOutputSet(), true);
- bool bShowMessage = true;
- try
- {
- std::pair< Reference<XConnection>,bool> aConnectionPair = m_pAdminDialog->createConnection();
- bShowMessage = aConnectionPair.second;
- bSuccess = aConnectionPair.first.is();
- ::comphelper::disposeComponent(aConnectionPair.first);
- }
- catch(Exception&)
+ std::pair< Reference<XConnection>,bool> aConnectionPair = m_pAdminDialog->createConnection();
+ bShowMessage = aConnectionPair.second;
+ bSuccess = aConnectionPair.first.is();
+ ::comphelper::disposeComponent(aConnectionPair.first);
+ }
+ catch(Exception&)
+ {
+ }
+ if ( bShowMessage )
+ {
+ MessageType eImage = MessageType::Info;
+ OUString aMessage,sTitle;
+ sTitle = DBA_RES(STR_CONNECTION_TEST);
+ if ( bSuccess )
{
+ aMessage = DBA_RES(STR_CONNECTION_SUCCESS);
}
- if ( bShowMessage )
+ else
{
- MessageType eImage = MessageType::Info;
- OUString aMessage,sTitle;
- sTitle = DBA_RES(STR_CONNECTION_TEST);
- if ( bSuccess )
- {
- aMessage = DBA_RES(STR_CONNECTION_SUCCESS);
- }
- else
- {
- eImage = MessageType::Error;
- aMessage = DBA_RES(STR_CONNECTION_NO_SUCCESS);
- }
- OSQLMessageBox aMsg(GetFrameWeld(), sTitle, aMessage, MessBoxStyle::Ok, eImage);
- aMsg.run();
+ eImage = MessageType::Error;
+ aMessage = DBA_RES(STR_CONNECTION_NO_SUCCESS);
}
- if ( !bSuccess )
- m_pAdminDialog->clearPassword();
+ OSQLMessageBox aMsg(GetFrameWeld(), sTitle, aMessage, MessBoxStyle::Ok, eImage);
+ aMsg.run();
}
+ if ( !bSuccess )
+ m_pAdminDialog->clearPassword();
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/dlg/dbfindex.cxx b/dbaccess/source/ui/dlg/dbfindex.cxx
index 42bcff9585e7..01e7fcda9e84 100644
--- a/dbaccess/source/ui/dlg/dbfindex.cxx
+++ b/dbaccess/source/ui/dlg/dbfindex.cxx
@@ -410,20 +410,20 @@ void OTableInfo::WriteInfFile( const OUString& rDSN ) const
aInfFile.Flush();
// if only [dbase] is left in INF-file, delete file
- if(!nPos)
+ if(nPos)
+ return;
+
+ try
{
- try
- {
- ::ucbhelper::Content aContent(aURL.GetURLNoPass(),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
- aContent.executeCommand( "delete", makeAny( true ) );
- }
- catch (const Exception& )
- {
- // simply silent this. The strange algorithm here does a lot of
- // things even if no files at all were created or accessed, so it's
- // possible that the file we're trying to delete does not even
- // exist, and this is a valid condition.
- }
+ ::ucbhelper::Content aContent(aURL.GetURLNoPass(),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
+ aContent.executeCommand( "delete", makeAny( true ) );
+ }
+ catch (const Exception& )
+ {
+ // simply silent this. The strange algorithm here does a lot of
+ // things even if no files at all were created or accessed, so it's
+ // possible that the file we're trying to delete does not even
+ // exist, and this is a valid condition.
}
}
diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx
index fa379c8d79ef..055053a76af5 100644
--- a/dbaccess/source/ui/dlg/generalpage.cxx
+++ b/dbaccess/source/ui/dlg/generalpage.cxx
@@ -99,81 +99,81 @@ namespace dbaui
void OGeneralPage::initializeTypeList()
{
- if ( m_bInitTypeList )
- {
- m_bInitTypeList = false;
- m_xDatasourceType->clear();
+ if ( !m_bInitTypeList )
+ return;
+
+ m_bInitTypeList = false;
+ m_xDatasourceType->clear();
+
+ if ( !m_pCollection )
+ return;
+
+ DisplayedTypes aDisplayedTypes;
- if ( m_pCollection )
+ ::dbaccess::ODsnTypeCollection::TypeIterator aEnd = m_pCollection->end();
+ for ( ::dbaccess::ODsnTypeCollection::TypeIterator aTypeLoop = m_pCollection->begin();
+ aTypeLoop != aEnd;
+ ++aTypeLoop
+ )
+ {
+ const OUString& sURLPrefix = aTypeLoop.getURLPrefix();
+ if ( !sURLPrefix.isEmpty() )
{
- DisplayedTypes aDisplayedTypes;
+ // skip mysql connection variations. It is handled in another window.
+ if(sURLPrefix.startsWith("sdbc:mysql:") && !sURLPrefix.startsWith("sdbc:mysql:jdbc:"))
+ continue;
- ::dbaccess::ODsnTypeCollection::TypeIterator aEnd = m_pCollection->end();
- for ( ::dbaccess::ODsnTypeCollection::TypeIterator aTypeLoop = m_pCollection->begin();
- aTypeLoop != aEnd;
- ++aTypeLoop
- )
+ OUString sDisplayName = aTypeLoop.getDisplayName();
+ if (m_xDatasourceType->find_text(sDisplayName) == -1 &&
+ approveDatasourceType(sURLPrefix, sDisplayName))
{
- const OUString& sURLPrefix = aTypeLoop.getURLPrefix();
- if ( !sURLPrefix.isEmpty() )
- {
- // skip mysql connection variations. It is handled in another window.
- if(sURLPrefix.startsWith("sdbc:mysql:") && !sURLPrefix.startsWith("sdbc:mysql:jdbc:"))
- continue;
-
- OUString sDisplayName = aTypeLoop.getDisplayName();
- if (m_xDatasourceType->find_text(sDisplayName) == -1 &&
- approveDatasourceType(sURLPrefix, sDisplayName))
- {
- aDisplayedTypes.emplace_back( sURLPrefix, sDisplayName );
- }
- }
+ aDisplayedTypes.emplace_back( sURLPrefix, sDisplayName );
}
- std::sort( aDisplayedTypes.begin(), aDisplayedTypes.end(), DisplayedTypeLess() );
- for ( const auto& rDisplayedType : aDisplayedTypes )
- insertDatasourceTypeEntryData( rDisplayedType.eType, rDisplayedType.sDisplayName );
}
}
+ std::sort( aDisplayedTypes.begin(), aDisplayedTypes.end(), DisplayedTypeLess() );
+ for ( const auto& rDisplayedType : aDisplayedTypes )
+ insertDatasourceTypeEntryData( rDisplayedType.eType, rDisplayedType.sDisplayName );
}
void OGeneralPageWizard::initializeEmbeddedDBList()
{
- if ( m_bInitEmbeddedDBList )
- {
- m_bInitEmbeddedDBList = false;
- m_xEmbeddedDBType->clear();
+ if ( !m_bInitEmbeddedDBList )
+ return;
- if ( m_pCollection )
- {
- DisplayedTypes aDisplayedTypes;
+ m_bInitEmbeddedDBList = false;
+ m_xEmbeddedDBType->clear();
- ::dbaccess::ODsnTypeCollection::TypeIterator aEnd = m_pCollection->end();
+ if ( !m_pCollection )
+ return;
- SvtMiscOptions aMiscOptions;
+ DisplayedTypes aDisplayedTypes;
- for ( ::dbaccess::ODsnTypeCollection::TypeIterator aTypeLoop = m_pCollection->begin();
- aTypeLoop != aEnd;
- ++aTypeLoop
- )
+ ::dbaccess::ODsnTypeCollection::TypeIterator aEnd = m_pCollection->end();
+
+ SvtMiscOptions aMiscOptions;
+
+ for ( ::dbaccess::ODsnTypeCollection::TypeIterator aTypeLoop = m_pCollection->begin();
+ aTypeLoop != aEnd;
+ ++aTypeLoop
+ )
+ {
+ const OUString& sURLPrefix = aTypeLoop.getURLPrefix();
+ if ( !sURLPrefix.isEmpty() )
+ {
+ OUString sDisplayName = aTypeLoop.getDisplayName();
+ if (m_xEmbeddedDBType->find_text(sDisplayName) == -1 &&
+ dbaccess::ODsnTypeCollection::isEmbeddedDatabase(sURLPrefix))
{
- const OUString& sURLPrefix = aTypeLoop.getURLPrefix();
- if ( !sURLPrefix.isEmpty() )
- {
- OUString sDisplayName = aTypeLoop.getDisplayName();
- if (m_xEmbeddedDBType->find_text(sDisplayName) == -1 &&
- dbaccess::ODsnTypeCollection::isEmbeddedDatabase(sURLPrefix))
- {
- if( !aMiscOptions.IsExperimentalMode() && sURLPrefix.startsWith("sdbc:embedded:firebird") )
- continue;
- aDisplayedTypes.emplace_back( sURLPrefix, sDisplayName );
- }
- }
+ if( !aMiscOptions.IsExperimentalMode() && sURLPrefix.startsWith("sdbc:embedded:firebird") )
+ continue;
+ aDisplayedTypes.emplace_back( sURLPrefix, sDisplayName );
}
- std::sort( aDisplayedTypes.begin(), aDisplayedTypes.end(), DisplayedTypeLess() );
- for (auto const& displayedType : aDisplayedTypes)
- insertEmbeddedDBTypeEntryData( displayedType.eType, displayedType.sDisplayName );
}
}
+ std::sort( aDisplayedTypes.begin(), aDisplayedTypes.end(), DisplayedTypeLess() );
+ for (auto const& displayedType : aDisplayedTypes)
+ insertEmbeddedDBTypeEntryData( displayedType.eType, displayedType.sDisplayName );
}
void OGeneralPage::setParentTitle(const OUString&)
@@ -664,26 +664,26 @@ namespace dbaui
{
aFileDlg.SetCurrentFilter(pFilter->GetUIName());
}
- if ( aFileDlg.Execute() == ERRCODE_NONE )
+ if ( aFileDlg.Execute() != ERRCODE_NONE )
+ return;
+
+ OUString sPath = aFileDlg.GetPath();
+ // check for aFileDlg.GetCurrentFilter used to be here but current fpicker filter
+ // can be set to anything, see tdf#125267 how this breaks if other value
+ // than 'ODF Database' is selected. Let's therefore check only if wildcard matches
+ if ( !pFilter->GetWildcard().Matches(sPath) )
{
- OUString sPath = aFileDlg.GetPath();
- // check for aFileDlg.GetCurrentFilter used to be here but current fpicker filter
- // can be set to anything, see tdf#125267 how this breaks if other value
- // than 'ODF Database' is selected. Let's therefore check only if wildcard matches
- if ( !pFilter->GetWildcard().Matches(sPath) )
- {
- OUString sMessage(DBA_RES(STR_ERR_USE_CONNECT_TO));
- std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
- VclMessageType::Info, VclButtonsType::Ok,
- sMessage));
- xInfoBox->run();
- m_xRB_ConnectDatabase->set_active(true);
- OnSetupModeSelected( *m_xRB_ConnectDatabase );
- return;
- }
- m_aBrowsedDocumentURL = sPath;
- m_aChooseDocumentHandler.Call( *this );
+ OUString sMessage(DBA_RES(STR_ERR_USE_CONNECT_TO));
+ std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Info, VclButtonsType::Ok,
+ sMessage));
+ xInfoBox->run();
+ m_xRB_ConnectDatabase->set_active(true);
+ OnSetupModeSelected( *m_xRB_ConnectDatabase );
+ return;
}
+ m_aBrowsedDocumentURL = sPath;
+ m_aChooseDocumentHandler.Call( *this );
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx
index a70ffd59a540..1ab95230acf5 100644
--- a/dbaccess/source/ui/dlg/indexdialog.cxx
+++ b/dbaccess/source/ui/dlg/indexdialog.cxx
@@ -281,26 +281,26 @@ namespace dbaui
{
std::unique_ptr<weld::TreeIter> xSelected(m_xIndexList->make_iterator());
// the selected index
- if (m_xIndexList->get_selected(xSelected.get()))
+ if (!m_xIndexList->get_selected(xSelected.get()))
+ return;
+
+ // let the user confirm the drop
+ if (_bConfirm)
{
- // let the user confirm the drop
- if (_bConfirm)
- {
- OUString sConfirm(DBA_RES(STR_CONFIRM_DROP_INDEX));
- sConfirm = sConfirm.replaceFirst("$name$", m_xIndexList->get_text(*xSelected));
- std::unique_ptr<weld::MessageDialog> xConfirm(Application::CreateMessageDialog(m_xDialog.get(),
- VclMessageType::Question, VclButtonsType::YesNo,
- sConfirm));
- if (RET_YES != xConfirm->run())
- return;
- }
+ OUString sConfirm(DBA_RES(STR_CONFIRM_DROP_INDEX));
+ sConfirm = sConfirm.replaceFirst("$name$", m_xIndexList->get_text(*xSelected));
+ std::unique_ptr<weld::MessageDialog> xConfirm(Application::CreateMessageDialog(m_xDialog.get(),
+ VclMessageType::Question, VclButtonsType::YesNo,
+ sConfirm));
+ if (RET_YES != xConfirm->run())
+ return;
+ }
- // do the drop
- implDropIndex(xSelected.get(), true);
+ // do the drop
+ implDropIndex(xSelected.get(), true);
- // reflect the new selection in the toolbox
- updateToolbox();
- }
+ // reflect the new selection in the toolbox
+ updateToolbox();
}
bool DbaIndexDialog::implDropIndex(const weld::TreeIter* pEntry, bool _bRemoveFromCollection)
diff --git a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
index 5f256f27021d..9a51f99ba100 100644
--- a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
+++ b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
@@ -370,34 +370,35 @@ static constexpr auto BROWSER_STANDARD_FLAGS = BrowserMode::COLUMNSELECTION | Br
if (!rListBox.IsTravelSelect())
m_aModifyHdl.Call(*this);
- if (&rListBox == m_pFieldNameCell.get())
- { // a field has been selected
- if (GetCurRow() >= GetRowCount() - 2)
- { // and we're in one of the last two rows
- OUString sSelectedEntry = m_pFieldNameCell->GetSelectedEntry();
- sal_Int32 nCurrentRow = GetCurRow();
- sal_Int32 rowCount = GetRowCount();
-
- OSL_ENSURE((static_cast<sal_Int32>(m_aFields.size() + 1)) == rowCount, "IndexFieldsControl::OnListEntrySelected: inconsistence!");
-
- if (!sSelectedEntry.isEmpty() && (nCurrentRow == rowCount - 1) /*&& (!m_nMaxColumnsInIndex || rowCount < m_nMaxColumnsInIndex )*/ )
- { // in the last row, a non-empty string has been selected
- // -> insert a new row
- m_aFields.emplace_back();
- RowInserted(GetRowCount());
- Invalidate(GetRowRectPixel(nCurrentRow));
- }
- else if (sSelectedEntry.isEmpty() && (nCurrentRow == rowCount - 2))
- { // in the (last-1)th row, an empty entry has been selected
- // -> remove the last row
- m_aFields.pop_back();
- RowRemoved(GetRowCount() - 1);
- Invalidate(GetRowRectPixel(nCurrentRow));
- }
+ if (&rListBox != m_pFieldNameCell.get())
+ return;
+
+// a field has been selected
+ if (GetCurRow() >= GetRowCount() - 2)
+ { // and we're in one of the last two rows
+ OUString sSelectedEntry = m_pFieldNameCell->GetSelectedEntry();
+ sal_Int32 nCurrentRow = GetCurRow();
+ sal_Int32 rowCount = GetRowCount();
+
+ OSL_ENSURE((static_cast<sal_Int32>(m_aFields.size() + 1)) == rowCount, "IndexFieldsControl::OnListEntrySelected: inconsistence!");
+
+ if (!sSelectedEntry.isEmpty() && (nCurrentRow == rowCount - 1) /*&& (!m_nMaxColumnsInIndex || rowCount < m_nMaxColumnsInIndex )*/ )
+ { // in the last row, a non-empty string has been selected
+ // -> insert a new row
+ m_aFields.emplace_back();
+ RowInserted(GetRowCount());
+ Invalidate(GetRowRectPixel(nCurrentRow));
+ }
+ else if (sSelectedEntry.isEmpty() && (nCurrentRow == rowCount - 2))
+ { // in the (last-1)th row, an empty entry has been selected
+ // -> remove the last row
+ m_aFields.pop_back();
+ RowRemoved(GetRowCount() - 1);
+ Invalidate(GetRowRectPixel(nCurrentRow));
}
-
- SaveModified();
}
+
+ SaveModified();
}
OUString IndexFieldsControl::GetCellText(long _nRow,sal_uInt16 nColId) const
{
diff --git a/dbaccess/source/ui/dlg/odbcconfig.cxx b/dbaccess/source/ui/dlg/odbcconfig.cxx
index 551202f5ca69..c9c6e73e1dda 100644
--- a/dbaccess/source/ui/dlg/odbcconfig.cxx
+++ b/dbaccess/source/ui/dlg/odbcconfig.cxx
@@ -129,23 +129,23 @@ OOdbcEnumeration::OOdbcEnumeration()
bLoaded = load(ODBC_LIBRARY_PLAIN);
#endif
- if ( bLoaded )
- {
+ if ( !bLoaded )
+ return;
+
#ifdef HAVE_ODBC_SUPPORT
- // load the generic functions
- m_pAllocHandle = loadSymbol("SQLAllocHandle");
- m_pFreeHandle = loadSymbol("SQLFreeHandle");
- m_pSetEnvAttr = loadSymbol("SQLSetEnvAttr");
- m_pDataSources = loadSymbol("SQLDataSources");
-
- // all or nothing
- if (!m_pAllocHandle || !m_pSetEnvAttr || !m_pDataSources || !m_pFreeHandle)
- {
- unload();
- m_pAllocHandle = m_pFreeHandle = m_pSetEnvAttr = m_pDataSources = nullptr;
- }
-#endif
+ // load the generic functions
+ m_pAllocHandle = loadSymbol("SQLAllocHandle");
+ m_pFreeHandle = loadSymbol("SQLFreeHandle");
+ m_pSetEnvAttr = loadSymbol("SQLSetEnvAttr");
+ m_pDataSources = loadSymbol("SQLDataSources");
+
+ // all or nothing
+ if (!m_pAllocHandle || !m_pSetEnvAttr || !m_pDataSources || !m_pFreeHandle)
+ {
+ unload();
+ m_pAllocHandle = m_pFreeHandle = m_pSetEnvAttr = m_pDataSources = nullptr;
}
+#endif
}
OOdbcEnumeration::~OOdbcEnumeration()
diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx
index 8f771f5367a3..b6370d1e6b51 100644
--- a/dbaccess/source/ui/dlg/queryfilter.cxx
+++ b/dbaccess/source/ui/dlg/queryfilter.cxx
@@ -480,25 +480,25 @@ void DlgFilterCrit::SetLine( int nIdx, const PropertyValue& _rItem, bool _bOr )
break;
}
- if ( pColumnListControl && pPredicateListControl && pPredicateValueControl )
- {
- OUString sName;
- if ( xColumn.is() )
- xColumn->getPropertyValue(PROPERTY_NAME) >>= sName;
- else
- sName = _rItem.Name;
- // select the appropriate field name
- SelectField( *pColumnListControl, sName );
- ListSelectHdl( *pColumnListControl );
-
- // select the appropriate condition
- pPredicateListControl->set_active( GetSelectionPos( _rItem.Handle, *pPredicateListControl ) );
+ if ( !(pColumnListControl && pPredicateListControl && pPredicateValueControl) )
+ return;
- // initially normalize this value
- OUString aString( aStr );
- m_aPredicateInput.normalizePredicateString( aString, xColumn );
- pPredicateValueControl->set_text( aString );
- }
+ OUString sName;
+ if ( xColumn.is() )
+ xColumn->getPropertyValue(PROPERTY_NAME) >>= sName;
+ else
+ sName = _rItem.Name;
+ // select the appropriate field name
+ SelectField( *pColumnListControl, sName );
+ ListSelectHdl( *pColumnListControl );
+
+ // select the appropriate condition
+ pPredicateListControl->set_active( GetSelectionPos( _rItem.Handle, *pPredicateListControl ) );
+
+ // initially normalize this value
+ OUString aString( aStr );
+ m_aPredicateInput.normalizePredicateString( aString, xColumn );
+ pPredicateValueControl->set_text( aString );
}
void DlgFilterCrit::SelectField(weld::ComboBox& rBox, const OUString& rField)
diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx
index b19e4209b230..73c9aa001221 100644
--- a/dbaccess/source/ui/dlg/sqlmessage.cxx
+++ b/dbaccess/source/ui/dlg/sqlmessage.cxx
@@ -476,19 +476,19 @@ void OSQLMessageBox::impl_createStandardButtons( MessBoxStyle _nStyle )
lcl_addButton(m_xDialog.get(), StandardButtonType::OK, true);
}
- if ( !m_sHelpURL.isEmpty() )
- {
- lcl_addButton(m_xDialog.get(), StandardButtonType::Help, false);
+ if ( m_sHelpURL.isEmpty() )
+ return;
- OUString aTmp;
- INetURLObject aHID( m_sHelpURL );
- if ( aHID.GetProtocol() == INetProtocol::Hid )
- aTmp = aHID.GetURLPath();
- else
- aTmp = m_sHelpURL;
+ lcl_addButton(m_xDialog.get(), StandardButtonType::Help, false);
- m_xDialog->set_help_id(OUStringToOString(aTmp, RTL_TEXTENCODING_UTF8));
- }
+ OUString aTmp;
+ INetURLObject aHID( m_sHelpURL );
+ if ( aHID.GetProtocol() == INetProtocol::Hid )
+ aTmp = aHID.GetURLPath();
+ else
+ aTmp = m_sHelpURL;
+
+ m_xDialog->set_help_id(OUStringToOString(aTmp, RTL_TEXTENCODING_UTF8));
}
void OSQLMessageBox::impl_addDetailsButton()
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index 9e2d23eb418e..2dbd0496320c 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -285,115 +285,115 @@ ODatabaseExport::~ODatabaseExport()
void ODatabaseExport::insertValueIntoColumn()
{
- if(m_nColumnPos < sal_Int32(m_vDestVector.size()))
+ if(m_nColumnPos >= sal_Int32(m_vDestVector.size()))
+ return;
+
+ OFieldDescription* pField = m_vDestVector[m_nColumnPos]->second;
+ if(!pField)
+ return;
+
+ sal_Int32 nNewPos = m_bIsAutoIncrement ? m_nColumnPos+1 : m_nColumnPos;
+ OSL_ENSURE(nNewPos < static_cast<sal_Int32>(m_vColumnPositions.size()),"m_vColumnPositions: Illegal index for vector");
+
+ if ( nNewPos < static_cast<sal_Int32>(m_vColumnPositions.size() ) )
{
- OFieldDescription* pField = m_vDestVector[m_nColumnPos]->second;
- if(pField)
+ sal_Int32 nPos = m_vColumnPositions[nNewPos].first;
+ if ( nPos != COLUMN_POSITION_NOT_FOUND )
{
- sal_Int32 nNewPos = m_bIsAutoIncrement ? m_nColumnPos+1 : m_nColumnPos;
- OSL_ENSURE(nNewPos < static_cast<sal_Int32>(m_vColumnPositions.size()),"m_vColumnPositions: Illegal index for vector");
-
- if ( nNewPos < static_cast<sal_Int32>(m_vColumnPositions.size() ) )
+ if ( m_sTextToken.isEmpty() && pField->IsNullable() )
+ m_pUpdateHelper->updateNull(nPos,pField->GetType());
+ else
{
- sal_Int32 nPos = m_vColumnPositions[nNewPos].first;
- if ( nPos != COLUMN_POSITION_NOT_FOUND )
+ OSL_ENSURE((nNewPos) < static_cast<sal_Int32>(m_vColumnTypes.size()),"Illegal index for vector");
+ if (m_vColumnTypes[nNewPos] != DataType::VARCHAR && m_vColumnTypes[nNewPos] != DataType::CHAR && m_vColumnTypes[nNewPos] != DataType::LONGVARCHAR )
{
- if ( m_sTextToken.isEmpty() && pField->IsNullable() )
- m_pUpdateHelper->updateNull(nPos,pField->GetType());
+ SAL_INFO("dbaccess.ui", "ODatabaseExport::insertValueIntoColumn != DataType::VARCHAR" );
+ ensureFormatter();
+ sal_Int32 nNumberFormat = 0;
+ double fOutNumber = 0.0;
+ bool bNumberFormatError = false;
+ if ( m_pFormatter && !m_sNumToken.isEmpty() )
+ {
+ LanguageType eNumLang = LANGUAGE_NONE;
+ sal_uInt32 nNumberFormat2( nNumberFormat );
+ fOutNumber = SfxHTMLParser::GetTableDataOptionsValNum(nNumberFormat2,eNumLang,m_sTextToken,m_sNumToken,*m_pFormatter);
+ if ( eNumLang != LANGUAGE_NONE )
+ {
+ nNumberFormat2 = m_pFormatter->GetFormatForLanguageIfBuiltIn( nNumberFormat2, eNumLang );
+ (void)m_pFormatter->IsNumberFormat( m_sTextToken, nNumberFormat2, fOutNumber );
+ }
+ nNumberFormat = static_cast<sal_Int32>(nNumberFormat2);
+ }
else
{
- OSL_ENSURE((nNewPos) < static_cast<sal_Int32>(m_vColumnTypes.size()),"Illegal index for vector");
- if (m_vColumnTypes[nNewPos] != DataType::VARCHAR && m_vColumnTypes[nNewPos] != DataType::CHAR && m_vColumnTypes[nNewPos] != DataType::LONGVARCHAR )
+ Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier();
+ Reference<XNumberFormatTypes> xNumType(xSupplier->getNumberFormats(),UNO_QUERY);
+ const sal_Int16 nFormats[] = {
+ NumberFormat::DATETIME
+ ,NumberFormat::DATE
+ ,NumberFormat::TIME
+ ,NumberFormat::CURRENCY
+ ,NumberFormat::NUMBER
+ ,NumberFormat::LOGICAL
+ };
+ for (short nFormat : nFormats)
{
- SAL_INFO("dbaccess.ui", "ODatabaseExport::insertValueIntoColumn != DataType::VARCHAR" );
- ensureFormatter();
- sal_Int32 nNumberFormat = 0;
- double fOutNumber = 0.0;
- bool bNumberFormatError = false;
- if ( m_pFormatter && !m_sNumToken.isEmpty() )
+ try
{
- LanguageType eNumLang = LANGUAGE_NONE;
- sal_uInt32 nNumberFormat2( nNumberFormat );
- fOutNumber = SfxHTMLParser::GetTableDataOptionsValNum(nNumberFormat2,eNumLang,m_sTextToken,m_sNumToken,*m_pFormatter);
- if ( eNumLang != LANGUAGE_NONE )
- {
- nNumberFormat2 = m_pFormatter->GetFormatForLanguageIfBuiltIn( nNumberFormat2, eNumLang );
- (void)m_pFormatter->IsNumberFormat( m_sTextToken, nNumberFormat2, fOutNumber );
- }
- nNumberFormat = static_cast<sal_Int32>(nNumberFormat2);
+ nNumberFormat = m_xFormatter->detectNumberFormat(xNumType->getStandardFormat(nFormat,m_aLocale),m_sTextToken);
+ break;
}
- else
+ catch(Exception&)
{
- Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier();
- Reference<XNumberFormatTypes> xNumType(xSupplier->getNumberFormats(),UNO_QUERY);
- const sal_Int16 nFormats[] = {
- NumberFormat::DATETIME
- ,NumberFormat::DATE
- ,NumberFormat::TIME
- ,NumberFormat::CURRENCY
- ,NumberFormat::NUMBER
- ,NumberFormat::LOGICAL
- };
- for (short nFormat : nFormats)
- {
- try
- {
- nNumberFormat = m_xFormatter->detectNumberFormat(xNumType->getStandardFormat(nFormat,m_aLocale),m_sTextToken);
- break;
- }
- catch(Exception&)
- {
- }
- }
- try
- {
- fOutNumber = m_xFormatter->convertStringToNumber(nNumberFormat,m_sTextToken);
- }
- catch(Exception&)
- {
- bNumberFormatError = true;
- m_pUpdateHelper->updateString(nPos,m_sTextToken);
- }
}
- if ( !bNumberFormatError )
+ }
+ try
+ {
+ fOutNumber = m_xFormatter->convertStringToNumber(nNumberFormat,m_sTextToken);
+ }
+ catch(Exception&)
+ {
+ bNumberFormatError = true;
+ m_pUpdateHelper->updateString(nPos,m_sTextToken);
+ }
+ }
+ if ( !bNumberFormatError )
+ {
+ try
+ {
+ Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier();
+ Reference< XNumberFormats > xFormats = xSupplier->getNumberFormats();
+ Reference<XPropertySet> xProp = xFormats->getByKey(nNumberFormat);
+ sal_Int16 nType = 0;
+ xProp->getPropertyValue(PROPERTY_TYPE) >>= nType;
+ switch(nType)
{
- try
- {
- Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier();
- Reference< XNumberFormats > xFormats = xSupplier->getNumberFormats();
- Reference<XPropertySet> xProp = xFormats->getByKey(nNumberFormat);
- sal_Int16 nType = 0;
- xProp->getPropertyValue(PROPERTY_TYPE) >>= nType;
- switch(nType)
- {
- case NumberFormat::DATE:
- m_pUpdateHelper->updateDate(nPos,::dbtools::DBTypeConversion::toDate(fOutNumber,m_aNullDate));
- break;
- case NumberFormat::DATETIME:
- m_pUpdateHelper->updateTimestamp(nPos,::dbtools::DBTypeConversion::toDateTime(fOutNumber,m_aNullDate));
- break;
- case NumberFormat::TIME:
- m_pUpdateHelper->updateTime(nPos,::dbtools::DBTypeConversion::toTime(fOutNumber));
- break;
- default:
- m_pUpdateHelper->updateDouble(nPos,fOutNumber);
- }
- }
- catch(Exception&)
- {
- m_pUpdateHelper->updateString(nPos,m_sTextToken);
- }
+ case NumberFormat::DATE:
+ m_pUpdateHelper->updateDate(nPos,::dbtools::DBTypeConversion::toDate(fOutNumber,m_aNullDate));
+ break;
+ case NumberFormat::DATETIME:
+ m_pUpdateHelper->updateTimestamp(nPos,::dbtools::DBTypeConversion::toDateTime(fOutNumber,m_aNullDate));
+ break;
+ case NumberFormat::TIME:
+ m_pUpdateHelper->updateTime(nPos,::dbtools::DBTypeConversion::toTime(fOutNumber));
+ break;
+ default:
+ m_pUpdateHelper->updateDouble(nPos,fOutNumber);
}
-
}
- else
+ catch(Exception&)
+ {
m_pUpdateHelper->updateString(nPos,m_sTextToken);
+ }
}
+
}
+ else
+ m_pUpdateHelper->updateString(nPos,m_sTextToken);
}
- eraseTokens();
}
}
+ eraseTokens();
}
sal_Int16 ODatabaseExport::CheckString(const OUString& aCheckToken, sal_Int16 _nOldNumberFormat)
@@ -543,76 +543,76 @@ sal_Int16 ODatabaseExport::CheckString(const OUString& aCheckToken, sal_Int16 _n
void ODatabaseExport::SetColumnTypes(const TColumnVector* _pList,const OTypeInfoMap* _pInfoMap)
{
- if(_pList && _pInfoMap)
+ if(!(_pList && _pInfoMap))
+ return;
+
+ OSL_ENSURE(m_vNumberFormat.size() == m_vColumnSize.size() && m_vColumnSize.size() == _pList->size(),"Illegal columns in list");
+ Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier();
+ Reference< XNumberFormats > xFormats = xSupplier->getNumberFormats();
+ sal_Int32 minBothSize = std::min<sal_Int32>(m_vNumberFormat.size(), m_vColumnSize.size());
+ sal_Int32 i = 0;
+ for (auto const& elem : *_pList)
{
- OSL_ENSURE(m_vNumberFormat.size() == m_vColumnSize.size() && m_vColumnSize.size() == _pList->size(),"Illegal columns in list");
- Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier();
- Reference< XNumberFormats > xFormats = xSupplier->getNumberFormats();
- sal_Int32 minBothSize = std::min<sal_Int32>(m_vNumberFormat.size(), m_vColumnSize.size());
- sal_Int32 i = 0;
- for (auto const& elem : *_pList)
- {
- if (i >= minBothSize)
- break;
+ if (i >= minBothSize)
+ break;
- sal_Int32 nDataType;
- sal_Int32 nLength(0),nScale(0);
- sal_Int16 nType = m_vNumberFormat[i] & ~NumberFormat::DEFINED;
+ sal_Int32 nDataType;
+ sal_Int32 nLength(0),nScale(0);
+ sal_Int16 nType = m_vNumberFormat[i] & ~NumberFormat::DEFINED;
- switch ( nType )
- {
- case NumberFormat::ALL:
- nDataType = DataType::DOUBLE;
- break;
- case NumberFormat::DEFINED:
- nDataType = DataType::VARCHAR;
- nLength = ((m_vColumnSize[i] % 10 ) ? m_vColumnSize[i]/ 10 + 1: m_vColumnSize[i]/ 10) * 10;
- break;
- case NumberFormat::DATE:
- nDataType = DataType::DATE;
- break;
- case NumberFormat::TIME:
- nDataType = DataType::TIME;
- break;
- case NumberFormat::DATETIME:
- nDataType = DataType::TIMESTAMP;
- break;
- case NumberFormat::CURRENCY:
- nDataType = DataType::NUMERIC;
- nScale = 4;
- nLength = 19;
- break;
- case NumberFormat::NUMBER:
- case NumberFormat::SCIENTIFIC:
- case NumberFormat::FRACTION:
- case NumberFormat::PERCENT:
- nDataType = DataType::DOUBLE;
- break;
- case NumberFormat::TEXT:
- case NumberFormat::UNDEFINED:
- case NumberFormat::LOGICAL:
- default:
- nDataType = DataType::VARCHAR;
- nLength = ((m_vColumnSize[i] % 10 ) ? m_vColumnSize[i]/ 10 + 1: m_vColumnSize[i]/ 10) * 10;
- break;
- }
- OTypeInfoMap::const_iterator aFind = _pInfoMap->find(nDataType);
- if(aFind != _pInfoMap->end())
- {
- elem->second->SetType(aFind->second);
- elem->second->SetPrecision(std::min<sal_Int32>(aFind->second->nPrecision,nLength));
- elem->second->SetScale(std::min<sal_Int32>(aFind->second->nMaximumScale,nScale));
+ switch ( nType )
+ {
+ case NumberFormat::ALL:
+ nDataType = DataType::DOUBLE;
+ break;
+ case NumberFormat::DEFINED:
+ nDataType = DataType::VARCHAR;
+ nLength = ((m_vColumnSize[i] % 10 ) ? m_vColumnSize[i]/ 10 + 1: m_vColumnSize[i]/ 10) * 10;
+ break;
+ case NumberFormat::DATE:
+ nDataType = DataType::DATE;
+ break;
+ case NumberFormat::TIME:
+ nDataType = DataType::TIME;
+ break;
+ case NumberFormat::DATETIME:
+ nDataType = DataType::TIMESTAMP;
+ break;
+ case NumberFormat::CURRENCY:
+ nDataType = DataType::NUMERIC;
+ nScale = 4;
+ nLength = 19;
+ break;
+ case NumberFormat::NUMBER:
+ case NumberFormat::SCIENTIFIC:
+ case NumberFormat::FRACTION:
+ case NumberFormat::PERCENT:
+ nDataType = DataType::DOUBLE;
+ break;
+ case NumberFormat::TEXT:
+ case NumberFormat::UNDEFINED:
+ case NumberFormat::LOGICAL:
+ default:
+ nDataType = DataType::VARCHAR;
+ nLength = ((m_vColumnSize[i] % 10 ) ? m_vColumnSize[i]/ 10 + 1: m_vColumnSize[i]/ 10) * 10;
+ break;
+ }
+ OTypeInfoMap::const_iterator aFind = _pInfoMap->find(nDataType);
+ if(aFind != _pInfoMap->end())
+ {
+ elem->second->SetType(aFind->second);
+ elem->second->SetPrecision(std::min<sal_Int32>(aFind->second->nPrecision,nLength));
+ elem->second->SetScale(std::min<sal_Int32>(aFind->second->nMaximumScale,nScale));
- sal_Int32 nFormatKey = ::dbtools::getDefaultNumberFormat( nDataType,
- elem->second->GetScale(),
- elem->second->IsCurrency(),
- Reference< XNumberFormatTypes>(xFormats,UNO_QUERY),
- m_aLocale);
+ sal_Int32 nFormatKey = ::dbtools::getDefaultNumberFormat( nDataType,
+ elem->second->GetScale(),
+ elem->second->IsCurrency(),
+ Reference< XNumberFormatTypes>(xFormats,UNO_QUERY),
+ m_aLocale);
- elem->second->SetFormatKey(nFormatKey);
- }
- ++i;
+ elem->second->SetFormatKey(nFormatKey);
}
+ ++i;
}
}
@@ -754,24 +754,24 @@ void ODatabaseExport::showErrorDialog(const css::sdbc::SQLException& e)
void ODatabaseExport::adjustFormat()
{
- if ( !m_sTextToken.isEmpty() )
+ if ( m_sTextToken.isEmpty() )
+ return;
+
+ sal_Int32 nNewPos = m_bIsAutoIncrement ? m_nColumnPos+1 : m_nColumnPos;
+ OSL_ENSURE(nNewPos < static_cast<sal_Int32>(m_vColumnPositions.size()),"Illegal index for vector");
+ if ( nNewPos < static_cast<sal_Int32>(m_vColumnPositions.size()) )
{
- sal_Int32 nNewPos = m_bIsAutoIncrement ? m_nColumnPos+1 : m_nColumnPos;
- OSL_ENSURE(nNewPos < static_cast<sal_Int32>(m_vColumnPositions.size()),"Illegal index for vector");
- if ( nNewPos < static_cast<sal_Int32>(m_vColumnPositions.size()) )
+ sal_Int32 nColPos = m_vColumnPositions[nNewPos].first;
+ if( nColPos != COLUMN_POSITION_NOT_FOUND)
{
- sal_Int32 nColPos = m_vColumnPositions[nNewPos].first;
- if( nColPos != COLUMN_POSITION_NOT_FOUND)
- {
- --nColPos;
- OSL_ENSURE((nColPos) < static_cast<sal_Int32>(m_vNumberFormat.size()),"m_vFormatKey: Illegal index for vector");
- OSL_ENSURE((nColPos) < static_cast<sal_Int32>(m_vColumnSize.size()),"m_vColumnSize: Illegal index for vector");
- m_vNumberFormat[nColPos] = CheckString(m_sTextToken,m_vNumberFormat[nColPos]);
- m_vColumnSize[nColPos] = std::max<sal_Int32>(static_cast<sal_Int32>(m_vColumnSize[nColPos]), m_sTextToken.getLength());
- }
+ --nColPos;
+ OSL_ENSURE((nColPos) < static_cast<sal_Int32>(m_vNumberFormat.size()),"m_vFormatKey: Illegal index for vector");
+ OSL_ENSURE((nColPos) < static_cast<sal_Int32>(m_vColumnSize.size()),"m_vColumnSize: Illegal index for vector");
+ m_vNumberFormat[nColPos] = CheckString(m_sTextToken,m_vNumberFormat[nColPos]);
+ m_vColumnSize[nColPos] = std::max<sal_Int32>(static_cast<sal_Int32>(m_vColumnSize[nColPos]), m_sTextToken.getLength());
}
- eraseTokens();
}
+ eraseTokens();
}
void ODatabaseExport::eraseTokens()
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index 9273b4759f07..ed4676d7a1a9 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -427,208 +427,208 @@ void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection,
Reference< XResultSet> xRs = _rxConnection->getMetaData ()->getTypeInfo ();
Reference< XRow> xRow(xRs,UNO_QUERY);
// Information for a single SQL type
- if(xRs.is())
+ if(!xRs.is())
+ return;
+
+ Reference<XResultSetMetaData> xResultSetMetaData = Reference<XResultSetMetaDataSupplier>(xRs,UNO_QUERY_THROW)->getMetaData();
+ ::connectivity::ORowSetValue aValue;
+ std::vector<sal_Int32> aTypes;
+ std::vector<bool> aNullable;
+ // Loop on the result set until we reach end of file
+ while (xRs->next())
{
- Reference<XResultSetMetaData> xResultSetMetaData = Reference<XResultSetMetaDataSupplier>(xRs,UNO_QUERY_THROW)->getMetaData();
- ::connectivity::ORowSetValue aValue;
- std::vector<sal_Int32> aTypes;
- std::vector<bool> aNullable;
- // Loop on the result set until we reach end of file
- while (xRs->next())
+ TOTypeInfoSP pInfo = std::make_shared<OTypeInfo>();
+ sal_Int32 nPos = 1;
+ if ( aTypes.empty() )
{
- TOTypeInfoSP pInfo = std::make_shared<OTypeInfo>();
- sal_Int32 nPos = 1;
- if ( aTypes.empty() )
+ sal_Int32 nCount = xResultSetMetaData->getColumnCount();
+ if ( nCount < 1 )
+ nCount = 18;
+ aTypes.reserve(nCount+1);
+ aTypes.push_back(-1);
+ aNullable.push_back(false);
+ for (sal_Int32 j = 1; j <= nCount ; ++j)
{
- sal_Int32 nCount = xResultSetMetaData->getColumnCount();
- if ( nCount < 1 )
- nCount = 18;
- aTypes.reserve(nCount+1);
- aTypes.push_back(-1);
- aNullable.push_back(false);
- for (sal_Int32 j = 1; j <= nCount ; ++j)
- {
- aTypes.push_back(xResultSetMetaData->getColumnType(j));
- aNullable.push_back(xResultSetMetaData->isNullable(j) != ColumnValue::NO_NULLS);
- }
+ aTypes.push_back(xResultSetMetaData->getColumnType(j));
+ aNullable.push_back(xResultSetMetaData->isNullable(j) != ColumnValue::NO_NULLS);
}
+ }
- aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->aTypeName = aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nType = aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nPrecision = aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); // LiteralPrefix
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); //LiteralSuffix
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->aCreateParams = aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->bNullable = static_cast<sal_Int32>(aValue) == ColumnValue::NULLABLE;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- // bCaseSensitive
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nSearchType = aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- // bUnsigned
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->bCurrency = static_cast<bool>(aValue);
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->bAutoIncrement = static_cast<bool>(aValue);
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->aLocalTypeName = aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nMinimumScale = aValue;
- ++nPos;
- aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nMaximumScale = aValue;
- assert(nPos == 15);
- // 16 and 17 are unused
- nPos = 18;
- aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nNumPrecRadix = aValue;
-
- // check if values are less than zero like it happens in a oracle jdbc driver
- if( pInfo->nPrecision < 0)
- pInfo->nPrecision = 0;
- if( pInfo->nMinimumScale < 0)
- pInfo->nMinimumScale = 0;
- if( pInfo->nMaximumScale < 0)
- pInfo->nMaximumScale = 0;
- if( pInfo->nNumPrecRadix <= 1)
- pInfo->nNumPrecRadix = 10;
-
- OUString aName;
- switch(pInfo->nType)
- {
- case DataType::CHAR:
- aName = _rsTypeNames.getToken(TYPE_CHAR, ';');
- break;
- case DataType::VARCHAR:
- aName = _rsTypeNames.getToken(TYPE_TEXT, ';');
- break;
- case DataType::DECIMAL:
- aName = _rsTypeNames.getToken(TYPE_DECIMAL, ';');
- break;
- case DataType::NUMERIC:
- aName = _rsTypeNames.getToken(TYPE_NUMERIC, ';');
- break;
- case DataType::BIGINT:
- aName = _rsTypeNames.getToken(TYPE_BIGINT, ';');
- break;
- case DataType::FLOAT:
- aName = _rsTypeNames.getToken(TYPE_FLOAT, ';');
- break;
- case DataType::DOUBLE:
- aName = _rsTypeNames.getToken(TYPE_DOUBLE, ';');
- break;
- case DataType::LONGVARCHAR:
- aName = _rsTypeNames.getToken(TYPE_MEMO, ';');
- break;
- case DataType::LONGVARBINARY:
- aName = _rsTypeNames.getToken(TYPE_IMAGE, ';');
- break;
- case DataType::DATE:
- aName = _rsTypeNames.getToken(TYPE_DATE, ';');
- break;
- case DataType::TIME:
- aName = _rsTypeNames.getToken(TYPE_TIME, ';');
- break;
- case DataType::TIMESTAMP:
- aName = _rsTypeNames.getToken(TYPE_DATETIME, ';');
- break;
- case DataType::BIT:
- if ( !pInfo->aCreateParams.isEmpty() )
- {
- aName = _rsTypeNames.getToken(TYPE_BIT, ';');
- break;
- }
- [[fallthrough]];
- case DataType::BOOLEAN:
- aName = _rsTypeNames.getToken(TYPE_BOOL, ';');
- break;
- case DataType::TINYINT:
- aName = _rsTypeNames.getToken(TYPE_TINYINT, ';');
- break;
- case DataType::SMALLINT:
- aName = _rsTypeNames.getToken(TYPE_SMALLINT, ';');
- break;
- case DataType::INTEGER:
- aName = _rsTypeNames.getToken(TYPE_INTEGER, ';');
- break;
- case DataType::REAL:
- aName = _rsTypeNames.getToken(TYPE_REAL, ';');
- break;
- case DataType::BINARY:
- aName = _rsTypeNames.getToken(TYPE_BINARY, ';');
- break;
- case DataType::VARBINARY:
- aName = _rsTypeNames.getToken(TYPE_VARBINARY, ';');
- break;
- case DataType::SQLNULL:
- aName = _rsTypeNames.getToken(TYPE_SQLNULL, ';');
- break;
- case DataType::OBJECT:
- aName = _rsTypeNames.getToken(TYPE_OBJECT, ';');
- break;
- case DataType::DISTINCT:
- aName = _rsTypeNames.getToken(TYPE_DISTINCT, ';');
- break;
- case DataType::STRUCT:
- aName = _rsTypeNames.getToken(TYPE_STRUCT, ';');
- break;
- case DataType::ARRAY:
- aName = _rsTypeNames.getToken(TYPE_ARRAY, ';');
- break;
- case DataType::BLOB:
- aName = _rsTypeNames.getToken(TYPE_BLOB, ';');
- break;
- case DataType::CLOB:
- aName = _rsTypeNames.getToken(TYPE_CLOB, ';');
- break;
- case DataType::REF:
- aName = _rsTypeNames.getToken(TYPE_REF, ';');
- break;
- case DataType::OTHER:
- aName = _rsTypeNames.getToken(TYPE_OTHER, ';');
+ aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
+ pInfo->aTypeName = aValue;
+ ++nPos;
+ aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
+ pInfo->nType = aValue;
+ ++nPos;
+ aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
+ pInfo->nPrecision = aValue;
+ ++nPos;
+ aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); // LiteralPrefix
+ ++nPos;
+ aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); //LiteralSuffix
+ ++nPos;
+ aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
+ pInfo->aCreateParams = aValue;
+ ++nPos;
+ aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
+ pInfo->bNullable = static_cast<sal_Int32>(aValue) == ColumnValue::NULLABLE;
+ ++nPos;
+ aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
+ // bCaseSensitive
+ ++nPos;
+ aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
+ pInfo->nSearchType = aValue;
+ ++nPos;
+ aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
+ // bUnsigned
+ ++nPos;
+ aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
+ pInfo->bCurrency = static_cast<bool>(aValue);
+ ++nPos;
+ aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
+ pInfo->bAutoIncrement = static_cast<bool>(aValue);
+ ++nPos;
+ aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
+ pInfo->aLocalTypeName = aValue;
+ ++nPos;
+ aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
+ pInfo->nMinimumScale = aValue;
+ ++nPos;
+ aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
+ pInfo->nMaximumScale = aValue;
+ assert(nPos == 15);
+ // 16 and 17 are unused
+ nPos = 18;
+ aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
+ pInfo->nNumPrecRadix = aValue;
+
+ // check if values are less than zero like it happens in a oracle jdbc driver
+ if( pInfo->nPrecision < 0)
+ pInfo->nPrecision = 0;
+ if( pInfo->nMinimumScale < 0)
+ pInfo->nMinimumScale = 0;
+ if( pInfo->nMaximumScale < 0)
+ pInfo->nMaximumScale = 0;
+ if( pInfo->nNumPrecRadix <= 1)
+ pInfo->nNumPrecRadix = 10;
+
+ OUString aName;
+ switch(pInfo->nType)
+ {
+ case DataType::CHAR:
+ aName = _rsTypeNames.getToken(TYPE_CHAR, ';');
+ break;
+ case DataType::VARCHAR:
+ aName = _rsTypeNames.getToken(TYPE_TEXT, ';');
+ break;
+ case DataType::DECIMAL:
+ aName = _rsTypeNames.getToken(TYPE_DECIMAL, ';');
+ break;
+ case DataType::NUMERIC:
+ aName = _rsTypeNames.getToken(TYPE_NUMERIC, ';');
+ break;
+ case DataType::BIGINT:
+ aName = _rsTypeNames.getToken(TYPE_BIGINT, ';');
+ break;
+ case DataType::FLOAT:
+ aName = _rsTypeNames.getToken(TYPE_FLOAT, ';');
+ break;
+ case DataType::DOUBLE:
+ aName = _rsTypeNames.getToken(TYPE_DOUBLE, ';');
+ break;
+ case DataType::LONGVARCHAR:
+ aName = _rsTypeNames.getToken(TYPE_MEMO, ';');
+ break;
+ case DataType::LONGVARBINARY:
+ aName = _rsTypeNames.getToken(TYPE_IMAGE, ';');
+ break;
+ case DataType::DATE:
+ aName = _rsTypeNames.getToken(TYPE_DATE, ';');
+ break;
+ case DataType::TIME:
+ aName = _rsTypeNames.getToken(TYPE_TIME, ';');
+ break;
+ case DataType::TIMESTAMP:
+ aName = _rsTypeNames.getToken(TYPE_DATETIME, ';');
+ break;
+ case DataType::BIT:
+ if ( !pInfo->aCreateParams.isEmpty() )
+ {
+ aName = _rsTypeNames.getToken(TYPE_BIT, ';');
break;
- }
- if ( !aName.isEmpty() )
- {
- pInfo->aUIName = aName;
- pInfo->aUIName += " [ ";
- }
- pInfo->aUIName += pInfo->aTypeName;
- if ( !aName.isEmpty() )
- pInfo->aUIName += " ]";
- // Now that we have the type info, save it in the multimap
- _rTypeInfoMap.emplace(pInfo->nType,pInfo);
+ }
+ [[fallthrough]];
+ case DataType::BOOLEAN:
+ aName = _rsTypeNames.getToken(TYPE_BOOL, ';');
+ break;
+ case DataType::TINYINT:
+ aName = _rsTypeNames.getToken(TYPE_TINYINT, ';');
+ break;
+ case DataType::SMALLINT:
+ aName = _rsTypeNames.getToken(TYPE_SMALLINT, ';');
+ break;
+ case DataType::INTEGER:
+ aName = _rsTypeNames.getToken(TYPE_INTEGER, ';');
+ break;
+ case DataType::REAL:
+ aName = _rsTypeNames.getToken(TYPE_REAL, ';');
+ break;
+ case DataType::BINARY:
+ aName = _rsTypeNames.getToken(TYPE_BINARY, ';');
+ break;
+ case DataType::VARBINARY:
+ aName = _rsTypeNames.getToken(TYPE_VARBINARY, ';');
+ break;
+ case DataType::SQLNULL:
+ aName = _rsTypeNames.getToken(TYPE_SQLNULL, ';');
+ break;
+ case DataType::OBJECT:
+ aName = _rsTypeNames.getToken(TYPE_OBJECT, ';');
+ break;
+ case DataType::DISTINCT:
+ aName = _rsTypeNames.getToken(TYPE_DISTINCT, ';');
+ break;
+ case DataType::STRUCT:
+ aName = _rsTypeNames.getToken(TYPE_STRUCT, ';');
+ break;
+ case DataType::ARRAY:
+ aName = _rsTypeNames.getToken(TYPE_ARRAY, ';');
+ break;
+ case DataType::BLOB:
+ aName = _rsTypeNames.getToken(TYPE_BLOB, ';');
+ break;
+ case DataType::CLOB:
+ aName = _rsTypeNames.getToken(TYPE_CLOB, ';');
+ break;
+ case DataType::REF:
+ aName = _rsTypeNames.getToken(TYPE_REF, ';');
+ break;
+ case DataType::OTHER:
+ aName = _rsTypeNames.getToken(TYPE_OTHER, ';');
+ break;
+ }
+ if ( !aName.isEmpty() )
+ {
+ pInfo->aUIName = aName;
+ pInfo->aUIName += " [ ";
}
- // for a faster index access
- _rTypeInfoIters.reserve(_rTypeInfoMap.size());
+ pInfo->aUIName += pInfo->aTypeName;
+ if ( !aName.isEmpty() )
+ pInfo->aUIName += " ]";
+ // Now that we have the type info, save it in the multimap
+ _rTypeInfoMap.emplace(pInfo->nType,pInfo);
+ }
+ // for a faster index access
+ _rTypeInfoIters.reserve(_rTypeInfoMap.size());
- OTypeInfoMap::iterator aIter = _rTypeInfoMap.begin();
- OTypeInfoMap::const_iterator aEnd = _rTypeInfoMap.end();
- for(;aIter != aEnd;++aIter)
- _rTypeInfoIters.push_back(aIter);
+ OTypeInfoMap::iterator aIter = _rTypeInfoMap.begin();
+ OTypeInfoMap::const_iterator aEnd = _rTypeInfoMap.end();
+ for(;aIter != aEnd;++aIter)
+ _rTypeInfoIters.push_back(aIter);
- // Close the result set/statement.
+ // Close the result set/statement.
- ::comphelper::disposeComponent(xRs);
- }
+ ::comphelper::disposeComponent(xRs);
}
void setColumnProperties(const Reference<XPropertySet>& _rxColumn,const OFieldDescription* _pFieldDesc)
@@ -743,35 +743,35 @@ void callColumnFormatDialog(const Reference<XPropertySet>& xAffectedCol,
SvNumberFormatter* _pFormatter,
const vcl::Window* _pParent)
{
- if (xAffectedCol.is() && xField.is())
+ if (!(xAffectedCol.is() && xField.is()))
+ return;
+
+ try
{
- try
+ Reference< XPropertySetInfo > xInfo = xAffectedCol->getPropertySetInfo();
+ bool bHasFormat = xInfo->hasPropertyByName(PROPERTY_FORMATKEY);
+ sal_Int32 nDataType = ::comphelper::getINT32(xField->getPropertyValue(PROPERTY_TYPE));
+
+ SvxCellHorJustify eJustify(SvxCellHorJustify::Standard);
+ Any aAlignment = xAffectedCol->getPropertyValue(PROPERTY_ALIGN);
+ if (aAlignment.hasValue())
+ eJustify = dbaui::mapTextJustify(::comphelper::getINT16(aAlignment));
+ sal_Int32 nFormatKey = 0;
+ if ( bHasFormat )
+ nFormatKey = ::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_FORMATKEY));
+
+ if(callColumnFormatDialog(_pParent,_pFormatter,nDataType,nFormatKey,eJustify,bHasFormat))
{
- Reference< XPropertySetInfo > xInfo = xAffectedCol->getPropertySetInfo();
- bool bHasFormat = xInfo->hasPropertyByName(PROPERTY_FORMATKEY);
- sal_Int32 nDataType = ::comphelper::getINT32(xField->getPropertyValue(PROPERTY_TYPE));
-
- SvxCellHorJustify eJustify(SvxCellHorJustify::Standard);
- Any aAlignment = xAffectedCol->getPropertyValue(PROPERTY_ALIGN);
- if (aAlignment.hasValue())
- eJustify = dbaui::mapTextJustify(::comphelper::getINT16(aAlignment));
- sal_Int32 nFormatKey = 0;
- if ( bHasFormat )
- nFormatKey = ::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_FORMATKEY));
-
- if(callColumnFormatDialog(_pParent,_pFormatter,nDataType,nFormatKey,eJustify,bHasFormat))
- {
- xAffectedCol->setPropertyValue(PROPERTY_ALIGN, makeAny(static_cast<sal_Int16>(dbaui::mapTextAllign(eJustify))));
- if (bHasFormat)
- xAffectedCol->setPropertyValue(PROPERTY_FORMATKEY, makeAny(nFormatKey));
+ xAffectedCol->setPropertyValue(PROPERTY_ALIGN, makeAny(static_cast<sal_Int16>(dbaui::mapTextAllign(eJustify))));
+ if (bHasFormat)
+ xAffectedCol->setPropertyValue(PROPERTY_FORMATKEY, makeAny(nFormatKey));
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
}
}
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
}
bool callColumnFormatDialog(const vcl::Window* _pParent,
@@ -963,20 +963,20 @@ void adjustBrowseBoxColumnWidth( ::svt::EditBrowseBox* _pBox, sal_uInt16 _nColId
Size aDefaultMM = _pBox->PixelToLogic( Size( nDefaultWidth, 0 ), MapMode( MapUnit::MapMM ) );
DlgSize aColumnSizeDlg(_pBox->GetFrameWeld(), nColSize, false, aDefaultMM.Width() * 10);
- if (aColumnSizeDlg.run() == RET_OK)
+ if (aColumnSizeDlg.run() != RET_OK)
+ return;
+
+ sal_Int32 nValue = aColumnSizeDlg.GetValue();
+ if ( -1 == nValue )
+ { // default width
+ nValue = _pBox->GetDefaultColumnWidth( _pBox->GetColumnTitle( _nColId ) );
+ }
+ else
{
- sal_Int32 nValue = aColumnSizeDlg.GetValue();
- if ( -1 == nValue )
- { // default width
- nValue = _pBox->GetDefaultColumnWidth( _pBox->GetColumnTitle( _nColId ) );
- }
- else
- {
- Size aSizeMM( nValue / 10, 0 );
- nValue = _pBox->LogicToPixel( aSizeMM, MapMode( MapUnit::MapMM ) ).Width();
- }
- _pBox->SetColumnWidth( _nColId, nValue );
+ Size aSizeMM( nValue / 10, 0 );
+ nValue = _pBox->LogicToPixel( aSizeMM, MapMode( MapUnit::MapMM ) ).Width();
}
+ _pBox->SetColumnWidth( _nColId, nValue );
}
// check if SQL92 name checking is enabled
@@ -999,26 +999,26 @@ void fillAutoIncrementValue(const Reference<XPropertySet>& _xDatasource,
bool& _rAutoIncrementValueEnabled,
OUString& _rsAutoIncrementValue)
{
- if ( _xDatasource.is() )
- {
- OSL_ENSURE(_xDatasource->getPropertySetInfo()->hasPropertyByName(PROPERTY_INFO),"NO datasource supplied!");
- Sequence<PropertyValue> aInfo;
- _xDatasource->getPropertyValue(PROPERTY_INFO) >>= aInfo;
-
- // search the right propertyvalue
- const PropertyValue* pValue =std::find_if(aInfo.begin(), aInfo.end(),
- [](const PropertyValue& lhs)
- {return lhs.Name == PROPERTY_AUTOINCREMENTCREATION;} );
-
- if ( pValue != aInfo.end() )
- pValue->Value >>= _rsAutoIncrementValue;
- pValue =std::find_if(aInfo.begin(), aInfo.end(),
- [](const PropertyValue& lhs)
- {return lhs.Name == "IsAutoRetrievingEnabled";} );
-
- if ( pValue != aInfo.end() )
- pValue->Value >>= _rAutoIncrementValueEnabled;
- }
+ if ( !_xDatasource.is() )
+ return;
+
+ OSL_ENSURE(_xDatasource->getPropertySetInfo()->hasPropertyByName(PROPERTY_INFO),"NO datasource supplied!");
+ Sequence<PropertyValue> aInfo;
+ _xDatasource->getPropertyValue(PROPERTY_INFO) >>= aInfo;
+
+ // search the right propertyvalue
+ const PropertyValue* pValue =std::find_if(aInfo.begin(), aInfo.end(),
+ [](const PropertyValue& lhs)
+ {return lhs.Name == PROPERTY_AUTOINCREMENTCREATION;} );
+
+ if ( pValue != aInfo.end() )
+ pValue->Value >>= _rsAutoIncrementValue;
+ pValue =std::find_if(aInfo.begin(), aInfo.end(),
+ [](const PropertyValue& lhs)
+ {return lhs.Name == "IsAutoRetrievingEnabled";} );
+
+ if ( pValue != aInfo.end() )
+ pValue->Value >>= _rAutoIncrementValueEnabled;
}
void fillAutoIncrementValue(const Reference<XConnection>& _xConnection,
@@ -1056,18 +1056,18 @@ OUString getStrippedDatabaseName(const Reference<XPropertySet>& _xDataSource,OUS
void setEvalDateFormatForFormatter(Reference< css::util::XNumberFormatter > const & _rxFormatter)
{
OSL_ENSURE( _rxFormatter.is(),"setEvalDateFormatForFormatter: Formatter is NULL!");
- if ( _rxFormatter.is() )
- {
- Reference< css::util::XNumberFormatsSupplier > xSupplier = _rxFormatter->getNumberFormatsSupplier();
+ if ( !_rxFormatter.is() )
+ return;
- auto pSupplierImpl = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>(xSupplier);
- OSL_ENSURE(pSupplierImpl,"No Supplier!");
+ Reference< css::util::XNumberFormatsSupplier > xSupplier = _rxFormatter->getNumberFormatsSupplier();
- if ( pSupplierImpl )
- {
- SvNumberFormatter* pFormatter = pSupplierImpl->GetNumberFormatter();
- pFormatter->SetEvalDateFormat(NF_EVALDATEFORMAT_FORMAT);
- }
+ auto pSupplierImpl = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>(xSupplier);
+ OSL_ENSURE(pSupplierImpl,"No Supplier!");
+
+ if ( pSupplierImpl )
+ {
+ SvNumberFormatter* pFormatter = pSupplierImpl->GetNumberFormatter();
+ pFormatter->SetEvalDateFormat(NF_EVALDATEFORMAT_FORMAT);
}
}
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index ca85547679ce..6e015c23fd1b 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -809,89 +809,89 @@ IMPL_LINK_NOARG(OCopyTableWizard, ImplOKHdl, weld::Button&, void)
m_ePressed = WIZARD_FINISH;
bool bFinish = DeactivatePage();
- if(bFinish)
+ if(!bFinish)
+ return;
+
+ weld::WaitObject aWait(m_xAssistant.get());
+ switch(getOperation())
{
- weld::WaitObject aWait(m_xAssistant.get());
- switch(getOperation())
+ case CopyTableOperation::CopyDefinitionAndData:
+ case CopyTableOperation::CopyDefinitionOnly:
{
- case CopyTableOperation::CopyDefinitionAndData:
- case CopyTableOperation::CopyDefinitionOnly:
+ bool bOnFirstPage = GetCurLevel() == 0;
+ if ( bOnFirstPage )
+ {
+ // we came from the first page so we have to clear
+ // all column information already collected
+ clearDestColumns();
+ m_mNameMapping.clear();
+ }
+ sal_Int32 nBreakPos = 0;
+ bool bCheckOk = CheckColumns(nBreakPos);
+ if ( bOnFirstPage && !bCheckOk )
{
- bool bOnFirstPage = GetCurLevel() == 0;
- if ( bOnFirstPage )
+ showColumnTypeNotSupported(m_vSourceVec[nBreakPos-1]->first);
+ OWizTypeSelect* pPage = static_cast<OWizTypeSelect*>(GetPage(3));
+ if ( pPage )
{
- // we came from the first page so we have to clear
- // all column information already collected
- clearDestColumns();
m_mNameMapping.clear();
+ pPage->setDisplayRow(nBreakPos);
+ ShowPage(3);
+ return;
}
- sal_Int32 nBreakPos = 0;
- bool bCheckOk = CheckColumns(nBreakPos);
- if ( bOnFirstPage && !bCheckOk )
- {
- showColumnTypeNotSupported(m_vSourceVec[nBreakPos-1]->first);
- OWizTypeSelect* pPage = static_cast<OWizTypeSelect*>(GetPage(3));
- if ( pPage )
- {
- m_mNameMapping.clear();
- pPage->setDisplayRow(nBreakPos);
- ShowPage(3);
- return;
- }
- }
- if ( m_xDestConnection.is() )
+ }
+ if ( m_xDestConnection.is() )
+ {
+ if ( supportsPrimaryKey() )
{
- if ( supportsPrimaryKey() )
+ bool noPrimaryKey = std::none_of(m_vDestColumns.begin(),m_vDestColumns.end(),
+ [] (const ODatabaseExport::TColumns::value_type& tCol) { return tCol.second->IsPrimaryKey(); });
+ if ( noPrimaryKey && m_xInteractionHandler.is() )
{
- bool noPrimaryKey = std::none_of(m_vDestColumns.begin(),m_vDestColumns.end(),
- [] (const ODatabaseExport::TColumns::value_type& tCol) { return tCol.second->IsPrimaryKey(); });
- if ( noPrimaryKey && m_xInteractionHandler.is() )
- {
- OUString sMsg(DBA_RES(STR_TABLEDESIGN_NO_PRIM_KEY));
- SQLContext aError;
- aError.Message = sMsg;
- ::rtl::Reference xRequest( new ::comphelper::OInteractionRequest( makeAny( aError ) ) );
- ::rtl::Reference xYes = new ::comphelper::OInteractionApprove;
- xRequest->addContinuation( xYes.get() );
- xRequest->addContinuation( new ::comphelper::OInteractionDisapprove );
- ::rtl::Reference< ::comphelper::OInteractionAbort > xAbort = new ::comphelper::OInteractionAbort;
- xRequest->addContinuation( xAbort.get() );
-
- m_xInteractionHandler->handle( xRequest.get() );
-
- if ( xYes->wasSelected() )
- {
- OCopyTable* pPage = static_cast<OCopyTable*>(GetPage(0));
- m_bCreatePrimaryKeyColumn = true;
- m_aKeyName = pPage->GetKeyName();
- if ( m_aKeyName.isEmpty() )
- m_aKeyName = "ID";
- m_aKeyName = createUniqueName( m_aKeyName );
- sal_Int32 nBreakPos2 = 0;
- CheckColumns(nBreakPos2);
- }
- else if ( xAbort->wasSelected() )
- {
- ShowPage(3);
- return;
- }
+ OUString sMsg(DBA_RES(STR_TABLEDESIGN_NO_PRIM_KEY));
+ SQLContext aError;
+ aError.Message = sMsg;
+ ::rtl::Reference xRequest( new ::comphelper::OInteractionRequest( makeAny( aError ) ) );
+ ::rtl::Reference xYes = new ::comphelper::OInteractionApprove;
+ xRequest->addContinuation( xYes.get() );
+ xRequest->addContinuation( new ::comphelper::OInteractionDisapprove );
+ ::rtl::Reference< ::comphelper::OInteractionAbort > xAbort = new ::comphelper::OInteractionAbort;
+ xRequest->addContinuation( xAbort.get() );
+
+ m_xInteractionHandler->handle( xRequest.get() );
+
+ if ( xYes->wasSelected() )
+ {
+ OCopyTable* pPage = static_cast<OCopyTable*>(GetPage(0));
+ m_bCreatePrimaryKeyColumn = true;
+ m_aKeyName = pPage->GetKeyName();
+ if ( m_aKeyName.isEmpty() )
+ m_aKeyName = "ID";
+ m_aKeyName = createUniqueName( m_aKeyName );
+ sal_Int32 nBreakPos2 = 0;
+ CheckColumns(nBreakPos2);
+ }
+ else if ( xAbort->wasSelected() )
+ {
+ ShowPage(3);
+ return;
}
}
}
- break;
- }
- case CopyTableOperation::AppendData:
- case CopyTableOperation::CreateAsView:
- break;
- default:
- {
- SAL_WARN("dbaccess.ui", "OCopyTableWizard::ImplOKHdl: invalid creation style!");
}
+ break;
+ }
+ case CopyTableOperation::AppendData:
+ case CopyTableOperation::CreateAsView:
+ break;
+ default:
+ {
+ SAL_WARN("dbaccess.ui", "OCopyTableWizard::ImplOKHdl: invalid creation style!");
}
-
- m_xAssistant->response(RET_OK);
}
+
+ m_xAssistant->response(RET_OK);
}
void OCopyTableWizard::setCreatePrimaryKey( bool _bDoCreate, const OUString& _rSuggestedName )
@@ -964,19 +964,19 @@ void OCopyTableWizard::AddWizardPage(std::unique_ptr<OWizardPage> xPage)
void OCopyTableWizard::insertColumn(sal_Int32 _nPos,OFieldDescription* _pField)
{
OSL_ENSURE(_pField,"FieldDescrioption is null!");
- if ( _pField )
- {
- ODatabaseExport::TColumns::const_iterator aFind = m_vDestColumns.find(_pField->GetName());
- if ( aFind != m_vDestColumns.end() )
- {
- delete aFind->second;
- m_vDestColumns.erase(aFind);
- }
+ if ( !_pField )
+ return;
- m_aDestVec.insert(m_aDestVec.begin() + _nPos,
- m_vDestColumns.emplace(_pField->GetName(),_pField).first);
- m_mNameMapping[_pField->GetName()] = _pField->GetName();
+ ODatabaseExport::TColumns::const_iterator aFind = m_vDestColumns.find(_pField->GetName());
+ if ( aFind != m_vDestColumns.end() )
+ {
+ delete aFind->second;
+ m_vDestColumns.erase(aFind);
}
+
+ m_aDestVec.insert(m_aDestVec.begin() + _nPos,
+ m_vDestColumns.emplace(_pField->GetName(),_pField).first);
+ m_mNameMapping[_pField->GetName()] = _pField->GetName();
}
void OCopyTableWizard::replaceColumn(sal_Int32 _nPos,OFieldDescription* _pField,const OUString& _sOldName)
diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index f440d1625ef2..bc902ceee81f 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -242,60 +242,60 @@ namespace
IMPL_LINK_NOARG(OWizNameMatching, TableListClickHdl, weld::TreeView&, void)
{
int nPos = m_xCTRL_LEFT->get_selected_index();
- if (nPos != -1)
+ if (nPos == -1)
+ return;
+
+ int nOldEntry = m_xCTRL_RIGHT->get_selected_index();
+ if (nOldEntry != -1 && nPos != nOldEntry)
{
- int nOldEntry = m_xCTRL_RIGHT->get_selected_index();
- if (nOldEntry != -1 && nPos != nOldEntry)
- {
- m_xCTRL_RIGHT->unselect(nOldEntry);
- if (nPos < m_xCTRL_RIGHT->n_children())
- {
- int nNewPos = GetFirstEntryInView(*m_xCTRL_LEFT);
- if ( nNewPos - nPos == 1 )
- --nNewPos;
- m_xCTRL_RIGHT->scroll_to_row(nNewPos);
- m_xCTRL_RIGHT->select(nPos);
- }
- }
- else if (nOldEntry == -1)
+ m_xCTRL_RIGHT->unselect(nOldEntry);
+ if (nPos < m_xCTRL_RIGHT->n_children())
{
- if (nPos < m_xCTRL_RIGHT->n_children())
- m_xCTRL_RIGHT->select(nPos);
+ int nNewPos = GetFirstEntryInView(*m_xCTRL_LEFT);
+ if ( nNewPos - nPos == 1 )
+ --nNewPos;
+ m_xCTRL_RIGHT->scroll_to_row(nNewPos);
+ m_xCTRL_RIGHT->select(nPos);
}
}
+ else if (nOldEntry == -1)
+ {
+ if (nPos < m_xCTRL_RIGHT->n_children())
+ m_xCTRL_RIGHT->select(nPos);
+ }
}
IMPL_LINK_NOARG( OWizNameMatching, TableListRightSelectHdl, weld::TreeView&, void )
{
int nPos = m_xCTRL_RIGHT->get_selected_index();
- if (nPos != -1)
+ if (nPos == -1)
+ return;
+
+ OFieldDescription* pColumn = reinterpret_cast<OFieldDescription*>(m_xCTRL_RIGHT->get_id(nPos).toInt64());
+ if (pColumn->IsAutoIncrement())
{
- OFieldDescription* pColumn = reinterpret_cast<OFieldDescription*>(m_xCTRL_RIGHT->get_id(nPos).toInt64());
- if (pColumn->IsAutoIncrement())
- {
- m_xCTRL_RIGHT->unselect(nPos);
- return;
- }
+ m_xCTRL_RIGHT->unselect(nPos);
+ return;
+ }
- int nOldEntry = m_xCTRL_LEFT->get_selected_index();
- if (nOldEntry != -1 && nPos != nOldEntry)
- {
- m_xCTRL_LEFT->unselect(nOldEntry);
- if (nPos < m_xCTRL_LEFT->n_children())
- {
- int nNewPos = GetFirstEntryInView(*m_xCTRL_RIGHT);
- if ( nNewPos - nPos == 1 )
- nNewPos--;
- m_xCTRL_LEFT->scroll_to_row(nNewPos);
- m_xCTRL_LEFT->select(nPos);
- }
- }
- else if (nOldEntry == -1)
+ int nOldEntry = m_xCTRL_LEFT->get_selected_index();
+ if (nOldEntry != -1 && nPos != nOldEntry)
+ {
+ m_xCTRL_LEFT->unselect(nOldEntry);
+ if (nPos < m_xCTRL_LEFT->n_children())
{
- if (nPos < m_xCTRL_LEFT->n_children())
- m_xCTRL_LEFT->select(nPos);
+ int nNewPos = GetFirstEntryInView(*m_xCTRL_RIGHT);
+ if ( nNewPos - nPos == 1 )
+ nNewPos--;
+ m_xCTRL_LEFT->scroll_to_row(nNewPos);
+ m_xCTRL_LEFT->select(nPos);
}
}
+ else if (nOldEntry == -1)
+ {
+ if (nPos < m_xCTRL_LEFT->n_children())
+ m_xCTRL_LEFT->select(nPos);
+ }
}
IMPL_LINK(OWizNameMatching, AllNoneClickHdl, weld::Button&, rButton, void)
diff --git a/dbaccess/source/ui/misc/indexcollection.cxx b/dbaccess/source/ui/misc/indexcollection.cxx
index f3606d4bd927..fff00d56fd0a 100644
--- a/dbaccess/source/ui/misc/indexcollection.cxx
+++ b/dbaccess/source/ui/misc/indexcollection.cxx
@@ -230,36 +230,36 @@ namespace dbaui
if (xSuppCols.is())
xCols = xSuppCols->getColumns();
OSL_ENSURE(xCols.is(), "OIndexCollection::implFillIndexInfo: the index does not have columns!");
- if (xCols.is())
- {
- Sequence< OUString > aFieldNames = xCols->getElementNames();
- _rIndex.aFields.resize(aFieldNames.getLength());
+ if (!xCols.is())
+ return;
- const OUString* pFieldNames = aFieldNames.getConstArray();
- const OUString* pFieldNamesEnd = pFieldNames + aFieldNames.getLength();
- IndexFields::iterator aCopyTo = _rIndex.aFields.begin();
+ Sequence< OUString > aFieldNames = xCols->getElementNames();
+ _rIndex.aFields.resize(aFieldNames.getLength());
- Reference< XPropertySet > xIndexColumn;
- for (;pFieldNames < pFieldNamesEnd; ++pFieldNames, ++aCopyTo)
- {
- // extract the column
- xIndexColumn.clear();
- xCols->getByName(*pFieldNames) >>= xIndexColumn;
- if (!xIndexColumn.is())
- {
- OSL_FAIL("OIndexCollection::implFillIndexInfo: invalid index column!");
- --aCopyTo;
- continue;
- }
+ const OUString* pFieldNames = aFieldNames.getConstArray();
+ const OUString* pFieldNamesEnd = pFieldNames + aFieldNames.getLength();
+ IndexFields::iterator aCopyTo = _rIndex.aFields.begin();
- // get the relevant properties
- aCopyTo->sFieldName = *pFieldNames;
- aCopyTo->bSortAscending = ::cppu::any2bool(xIndexColumn->getPropertyValue("IsAscending"));
+ Reference< XPropertySet > xIndexColumn;
+ for (;pFieldNames < pFieldNamesEnd; ++pFieldNames, ++aCopyTo)
+ {
+ // extract the column
+ xIndexColumn.clear();
+ xCols->getByName(*pFieldNames) >>= xIndexColumn;
+ if (!xIndexColumn.is())
+ {
+ OSL_FAIL("OIndexCollection::implFillIndexInfo: invalid index column!");
+ --aCopyTo;
+ continue;
}
- _rIndex.aFields.resize(aCopyTo - _rIndex.aFields.begin());
- // (just in case some fields were invalid ...)
+ // get the relevant properties
+ aCopyTo->sFieldName = *pFieldNames;
+ aCopyTo->bSortAscending = ::cppu::any2bool(xIndexColumn->getPropertyValue("IsAscending"));
}
+
+ _rIndex.aFields.resize(aCopyTo - _rIndex.aFields.begin());
+ // (just in case some fields were invalid ...)
}
void OIndexCollection::resetIndex(const Indexes::iterator& _rPos)
@@ -299,28 +299,28 @@ namespace dbaui
detach();
m_xIndexes = _rxIndexes;
- if (m_xIndexes.is())
+ if (!m_xIndexes.is())
+ return;
+
+ // loop through all the indexes
+ Sequence< OUString > aNames = m_xIndexes->getElementNames();
+ const OUString* pNames = aNames.getConstArray();
+ const OUString* pEnd = pNames + aNames.getLength();
+ for (; pNames < pEnd; ++pNames)
{
- // loop through all the indexes
- Sequence< OUString > aNames = m_xIndexes->getElementNames();
- const OUString* pNames = aNames.getConstArray();
- const OUString* pEnd = pNames + aNames.getLength();
- for (; pNames < pEnd; ++pNames)
+ // extract the index object
+ Reference< XPropertySet > xIndex;
+ m_xIndexes->getByName(*pNames) >>= xIndex;
+ if (!xIndex.is())
{
- // extract the index object
- Reference< XPropertySet > xIndex;
- m_xIndexes->getByName(*pNames) >>= xIndex;
- if (!xIndex.is())
- {
- OSL_FAIL("OIndexCollection::implConstructFrom: got an invalid index object ... ignoring!");
- continue;
- }
-
- // fill the OIndex structure
- OIndex aCurrentIndex(*pNames);
- implFillIndexInfo(aCurrentIndex);
- m_aIndexes.push_back(aCurrentIndex);
+ OSL_FAIL("OIndexCollection::implConstructFrom: got an invalid index object ... ignoring!");
+ continue;
}
+
+ // fill the OIndex structure
+ OIndex aCurrentIndex(*pNames);
+ implFillIndexInfo(aCurrentIndex);
+ m_aIndexes.push_back(aCurrentIndex);
}
}
diff --git a/dbaccess/source/ui/querydesign/JoinController.cxx b/dbaccess/source/ui/querydesign/JoinController.cxx
index 4ad6b6c23337..d8f21cf26705 100644
--- a/dbaccess/source/ui/querydesign/JoinController.cxx
+++ b/dbaccess/source/ui/querydesign/JoinController.cxx
@@ -384,29 +384,29 @@ void OJoinController::loadTableWindow( const ::comphelper::NamedValueCollection&
void OJoinController::saveTableWindows( ::comphelper::NamedValueCollection& o_rViewSettings ) const
{
- if ( !m_vTableData.empty() )
+ if ( m_vTableData.empty() )
+ return;
+
+ ::comphelper::NamedValueCollection aAllTablesData;
+
+ sal_Int32 i = 1;
+ for (auto const& elem : m_vTableData)
{
- ::comphelper::NamedValueCollection aAllTablesData;
-
- sal_Int32 i = 1;
- for (auto const& elem : m_vTableData)
- {
- ::comphelper::NamedValueCollection aWindowData;
- aWindowData.put( "ComposedName", elem->GetComposedName() );
- aWindowData.put( "TableName", elem->GetTableName() );
- aWindowData.put( "WindowName", elem->GetWinName() );
- aWindowData.put( "WindowTop", static_cast<sal_Int32>(elem->GetPosition().Y()) );
- aWindowData.put( "WindowLeft", static_cast<sal_Int32>(elem->GetPosition().X()) );
- aWindowData.put( "WindowWidth", static_cast<sal_Int32>(elem->GetSize().Width()) );
- aWindowData.put( "WindowHeight", static_cast<sal_Int32>(elem->GetSize().Height()) );
- aWindowData.put( "ShowAll", elem->IsShowAll() );
-
- const OUString sTableName( "Table" + OUString::number( i++ ) );
- aAllTablesData.put( sTableName, aWindowData.getPropertyValues() );
- }
-
- o_rViewSettings.put( "Tables", aAllTablesData.getPropertyValues() );
+ ::comphelper::NamedValueCollection aWindowData;
+ aWindowData.put( "ComposedName", elem->GetComposedName() );
+ aWindowData.put( "TableName", elem->GetTableName() );
+ aWindowData.put( "WindowName", elem->GetWinName() );
+ aWindowData.put( "WindowTop", static_cast<sal_Int32>(elem->GetPosition().Y()) );
+ aWindowData.put( "WindowLeft", static_cast<sal_Int32>(elem->GetPosition().X()) );
+ aWindowData.put( "WindowWidth", static_cast<sal_Int32>(elem->GetSize().Width()) );
+ aWindowData.put( "WindowHeight", static_cast<sal_Int32>(elem->GetSize().Height()) );
+ aWindowData.put( "ShowAll", elem->IsShowAll() );
+
+ const OUString sTableName( "Table" + OUString::number( i++ ) );
+ aAllTablesData.put( sTableName, aWindowData.getPropertyValues() );
}
+
+ o_rViewSettings.put( "Tables", aAllTablesData.getPropertyValues() );
}
TTableWindowData::value_type OJoinController::createTableWindowData(const OUString& _sComposedName,const OUString& _sTableName,const OUString& _sWindowName)
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index d9aa87f38ccd..193a1ba51ac5 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -817,22 +817,22 @@ void OJoinTableView::MouseButtonUp( const MouseEvent& rEvt )
{
Window::MouseButtonUp(rEvt);
// Has a connection been selected?
- if( !m_vTableConnection.empty() )
- {
- DeselectConn(GetSelectedConn());
+ if( m_vTableConnection.empty() )
+ return;
- for (auto & elem : m_vTableConnection)
+ DeselectConn(GetSelectedConn());
+
+ for (auto & elem : m_vTableConnection)
+ {
+ if( elem->CheckHit(rEvt.GetPosPixel()) )
{
- if( elem->CheckHit(rEvt.GetPosPixel()) )
- {
- SelectConn(elem);
+ SelectConn(elem);
- // Double-click
- if( rEvt.GetClicks() == 2 )
- ConnDoubleClicked(elem);
+ // Double-click
+ if( rEvt.GetClicks() == 2 )
+ ConnDoubleClicked(elem);
- break;
- }
+ break;
}
}
}
@@ -881,47 +881,47 @@ void OJoinTableView::SelectConn(OTableConnection* pConn)
// select the concerned entries in the windows
OTableWindow* pConnSource = pConn->GetSourceWin();
OTableWindow* pConnDest = pConn->GetDestWin();
- if (pConnSource && pConnDest)
- {
- OTableWindowListBox* pSourceBox = pConnSource->GetListBox().get();
- OTableWindowListBox* pDestBox = pConnDest->GetListBox().get();
- if (pSourceBox && pDestBox)
- {
- pSourceBox->SelectAll(false);
- pDestBox->SelectAll(false);
+ if (!(pConnSource && pConnDest))
+ return;
- SvTreeListEntry* pFirstSourceVisible = pSourceBox->GetFirstEntryInView();
- SvTreeListEntry* pFirstDestVisible = pDestBox->GetFirstEntryInView();
+ OTableWindowListBox* pSourceBox = pConnSource->GetListBox().get();
+ OTableWindowListBox* pDestBox = pConnDest->GetListBox().get();
+ if (!(pSourceBox && pDestBox))
+ return;
- const std::vector<std::unique_ptr<OConnectionLine>>& rLines = pConn->GetConnLineList();
- auto aIter = rLines.rbegin();
- for(;aIter != rLines.rend();++aIter)
- {
- if ((*aIter)->IsValid())
- {
- SvTreeListEntry* pSourceEntry = pSourceBox->GetEntryFromText((*aIter)->GetData()->GetSourceFieldName());
- if (pSourceEntry)
- {
- pSourceBox->Select(pSourceEntry);
- pSourceBox->MakeVisible(pSourceEntry);
- }
+ pSourceBox->SelectAll(false);
+ pDestBox->SelectAll(false);
- SvTreeListEntry* pDestEntry = pDestBox->GetEntryFromText((*aIter)->GetData()->GetDestFieldName());
- if (pDestEntry)
- {
- pDestBox->Select(pDestEntry);
- pDestBox->MakeVisible(pDestEntry);
- }
+ SvTreeListEntry* pFirstSourceVisible = pSourceBox->GetFirstEntryInView();
+ SvTreeListEntry* pFirstDestVisible = pDestBox->GetFirstEntryInView();
- }
+ const std::vector<std::unique_ptr<OConnectionLine>>& rLines = pConn->GetConnLineList();
+ auto aIter = rLines.rbegin();
+ for(;aIter != rLines.rend();++aIter)
+ {
+ if ((*aIter)->IsValid())
+ {
+ SvTreeListEntry* pSourceEntry = pSourceBox->GetEntryFromText((*aIter)->GetData()->GetSourceFieldName());
+ if (pSourceEntry)
+ {
+ pSourceBox->Select(pSourceEntry);
+ pSourceBox->MakeVisible(pSourceEntry);
+ }
+
+ SvTreeListEntry* pDestEntry = pDestBox->GetEntryFromText((*aIter)->GetData()->GetDestFieldName());
+ if (pDestEntry)
+ {
+ pDestBox->Select(pDestEntry);
+ pDestBox->MakeVisible(pDestEntry);
}
- if ((pFirstSourceVisible != pSourceBox->GetFirstEntryInView())
- || (pFirstDestVisible != pDestBox->GetFirstEntryInView()))
- // scrolling was done -> redraw
- Invalidate(InvalidateFlags::NoChildren);
}
}
+
+ if ((pFirstSourceVisible != pSourceBox->GetFirstEntryInView())
+ || (pFirstDestVisible != pDestBox->GetFirstEntryInView()))
+ // scrolling was done -> redraw
+ Invalidate(InvalidateFlags::NoChildren);
}
void OJoinTableView::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
@@ -1424,23 +1424,23 @@ void OJoinTableView::StateChanged( StateChangedType nType )
Window::StateChanged( nType );
// FIXME RenderContext
- if ( nType == StateChangedType::Zoom )
- {
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ if ( nType != StateChangedType::Zoom )
+ return;
- vcl::Font aFont = rStyleSettings.GetGroupFont();
- if ( IsControlFont() )
- aFont.Merge( GetControlFont() );
- SetZoomedPointFont(*this, aFont);
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- for (auto const& elem : m_aTableMap)
- {
- elem.second->SetZoom(GetZoom());
- Size aSize(CalcZoom(elem.second->GetSizePixel().Width()),CalcZoom(elem.second->GetSizePixel().Height()));
- elem.second->SetSizePixel(aSize);
- }
- Resize();
+ vcl::Font aFont = rStyleSettings.GetGroupFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont(*this, aFont);
+
+ for (auto const& elem : m_aTableMap)
+ {
+ elem.second->SetZoom(GetZoom());
+ Size aSize(CalcZoom(elem.second->GetSizePixel().Width()),CalcZoom(elem.second->GetSizePixel().Height()));
+ elem.second->SetSizePixel(aSize);
}
+ Resize();
}
void OJoinTableView::HideTabWins()
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index a3bf5ede4e66..ddcc18049ba0 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -328,19 +328,19 @@ namespace
OSL_ENSURE(_pEntryConn,"TableConnection can not be null!");
OQueryTableConnectionData* pData = static_cast< OQueryTableConnectionData*>(_pEntryConn->GetData().get());
- if ( pData->GetJoinType() != INNER_JOIN && _pEntryTabTo->ExistsAVisitedConn() )
+ if ( !(pData->GetJoinType() != INNER_JOIN && _pEntryTabTo->ExistsAVisitedConn()) )
+ return;
+
+ bool bBrace = false;
+ if(_rJoin.endsWith(")"))
{
- bool bBrace = false;
- if(_rJoin.endsWith(")"))
- {
- bBrace = true;
- _rJoin = _rJoin.replaceAt(_rJoin.getLength()-1,1,OUString(' '));
- }
- _rJoin += C_AND + BuildJoinCriteria(_xConnection,&pData->GetConnLineDataList(),pData);
- if(bBrace)
- _rJoin += ")";
- _pEntryConn->SetVisited(true);
+ bBrace = true;
+ _rJoin = _rJoin.replaceAt(_rJoin.getLength()-1,1,OUString(' '));
}
+ _rJoin += C_AND + BuildJoinCriteria(_xConnection,&pData->GetConnLineDataList(),pData);
+ if(bBrace)
+ _rJoin += ")";
+ _pEntryConn->SetVisited(true);
}
OUString BuildTable( const Reference< XConnection>& _xConnection,
const OQueryTableWindow* pEntryTab,
@@ -514,20 +514,20 @@ namespace
}
// when nothing found look for the "from" window
- if(!bFound)
+ if(bFound)
+ return;
+
+ OQueryTableWindow* pEntryTabFrom = static_cast<OQueryTableWindow*>(pEntryConn->GetSourceWin());
+ for (auto const& connection : rConnections)
{
- OQueryTableWindow* pEntryTabFrom = static_cast<OQueryTableWindow*>(pEntryConn->GetSourceWin());
- for (auto const& connection : rConnections)
+ OQueryTableConnection* pNext = static_cast<OQueryTableConnection*>(connection.get());
+ if(!pNext->IsVisited() && (pNext->GetSourceWin() == pEntryTabFrom || pNext->GetDestWin() == pEntryTabFrom))
{
- OQueryTableConnection* pNext = static_cast<OQueryTableConnection*>(connection.get());
- if(!pNext->IsVisited() && (pNext->GetSourceWin() == pEntryTabFrom || pNext->GetDestWin() == pEntryTabFrom))
- {
- OQueryTableWindow* pEntryTab = pNext->GetSourceWin() == pEntryTabFrom ? static_cast<OQueryTableWindow*>(pNext->GetDestWin()) : static_cast<OQueryTableWindow*>(pNext->GetSourceWin());
- // exists there a connection to a OQueryTableWindow that holds a connection that has been already visited
- JoinCycle(_xConnection,pNext,pEntryTab,aJoin);
- if(!pNext->IsVisited())
- GetNextJoin(_xConnection, pNext, pEntryTab, aJoin, _rTableNames);
- }
+ OQueryTableWindow* pEntryTab = pNext->GetSourceWin() == pEntryTabFrom ? static_cast<OQueryTableWindow*>(pNext->GetDestWin()) : static_cast<OQueryTableWindow*>(pNext->GetSourceWin());
+ // exists there a connection to a OQueryTableWindow that holds a connection that has been already visited
+ JoinCycle(_xConnection,pNext,pEntryTab,aJoin);
+ if(!pNext->IsVisited())
+ GetNextJoin(_xConnection, pNext, pEntryTab, aJoin, _rTableNames);
}
}
}
diff --git a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx
index 329b0cfff4ab..dee5538ff8dd 100644
--- a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx
@@ -48,24 +48,24 @@ OQueryTabWinUndoAct::OQueryTabWinUndoAct(OQueryTableView* pOwner, const char* pC
OQueryTabWinUndoAct::~OQueryTabWinUndoAct()
{
- if (m_bOwnerOfObjects)
- {
- // I should take care to delete the window if I am the only owner
- OSL_ENSURE(m_pTabWin != nullptr, "OQueryTabWinUndoAct::~OQueryTabWinUndoAct() : m_pTabWin must not be NULL");
- OSL_ENSURE(!m_pTabWin->IsVisible(), "OQueryTabWinUndoAct::~OQueryTabWinUndoAct() : *m_pTabWin must not be visible");
+ if (!m_bOwnerOfObjects)
+ return;
+
+ // I should take care to delete the window if I am the only owner
+ OSL_ENSURE(m_pTabWin != nullptr, "OQueryTabWinUndoAct::~OQueryTabWinUndoAct() : m_pTabWin must not be NULL");
+ OSL_ENSURE(!m_pTabWin->IsVisible(), "OQueryTabWinUndoAct::~OQueryTabWinUndoAct() : *m_pTabWin must not be visible");
- if ( m_pTabWin )
- m_pTabWin->clearListBox();
- m_pTabWin.disposeAndClear();
+ if ( m_pTabWin )
+ m_pTabWin->clearListBox();
+ m_pTabWin.disposeAndClear();
- // and of course the corresponding connections
- for (auto & connection : m_vTableConnection)
- {
- m_pOwner->DeselectConn(connection);
- connection.disposeAndClear();
- }
- m_vTableConnection.clear();
+ // and of course the corresponding connections
+ for (auto & connection : m_vTableConnection)
+ {
+ m_pOwner->DeselectConn(connection);
+ connection.disposeAndClear();
}
+ m_vTableConnection.clear();
}
void OTabFieldCellModifiedUndoAct::Undo()
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index ab002e616915..67d2c8e3df31 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -592,30 +592,30 @@ void OQueryTableView::ConnDoubleClicked(VclPtr<OTableConnection>& rConnection)
void OQueryTableView::createNewConnection()
{
TTableConnectionData::value_type pData = std::make_shared<OQueryTableConnectionData>();
- if( openJoinDialog(this,pData,true) )
+ if( !openJoinDialog(this,pData,true) )
+ return;
+
+ OTableWindowMap& rMap = GetTabWinMap();
+ OQueryTableWindow* pSourceWin = static_cast< OQueryTableWindow*>(rMap[pData->getReferencingTable()->GetWinName()].get());
+ OQueryTableWindow* pDestWin = static_cast< OQueryTableWindow*>(rMap[pData->getReferencedTable()->GetWinName()].get());
+ // first we have to look if the this connection already exists
+ OTableConnection* pConn = GetTabConn(pSourceWin,pDestWin,true);
+ bool bNew = true;
+ if ( pConn )
{
- OTableWindowMap& rMap = GetTabWinMap();
- OQueryTableWindow* pSourceWin = static_cast< OQueryTableWindow*>(rMap[pData->getReferencingTable()->GetWinName()].get());
- OQueryTableWindow* pDestWin = static_cast< OQueryTableWindow*>(rMap[pData->getReferencedTable()->GetWinName()].get());
- // first we have to look if the this connection already exists
- OTableConnection* pConn = GetTabConn(pSourceWin,pDestWin,true);
- bool bNew = true;
- if ( pConn )
- {
- pConn->GetData()->CopyFrom( *pData );
- bNew = false;
- }
- else
- {
- // create a new connection and append it
- VclPtrInstance<OQueryTableConnection> pQConn(this, pData);
- GetConnection(pQConn);
- pConn = pQConn;
- }
- connectionModified(this,pConn,bNew);
- if ( !bNew && pConn == GetSelectedConn() ) // our connection was selected before so we have to reselect it
- SelectConn( pConn );
+ pConn->GetData()->CopyFrom( *pData );
+ bNew = false;
}
+ else
+ {
+ // create a new connection and append it
+ VclPtrInstance<OQueryTableConnection> pQConn(this, pData);
+ GetConnection(pQConn);
+ pConn = pQConn;
+ }
+ connectionModified(this,pConn,bNew);
+ if ( !bNew && pConn == GetSelectedConn() ) // our connection was selected before so we have to reselect it
+ SelectConn( pConn );
}
bool OQueryTableView::RemoveConnection(VclPtr<OTableConnection>& rConnection, bool /*_bDelete*/)
@@ -675,34 +675,34 @@ void OQueryTableView::RemoveTabWin(OTableWindow* pTabWin)
{
OSL_ENSURE(pTabWin != nullptr, "OQueryTableView::RemoveTabWin : Window should not be NULL !");
- if(pTabWin && ContainsTabWin(*pTabWin)) // #i122589# check if registered before deleting
- {
- // I need my parent so it can be informed about the deletion
- OQueryDesignView* pParent = static_cast<OQueryDesignView*>(getDesignView());
+ if(!(pTabWin && ContainsTabWin(*pTabWin))) // #i122589# check if registered before deleting
+ return;
- SfxUndoManager& rUndoMgr = m_pView->getController().GetUndoManager();
- rUndoMgr.EnterListAction(DBA_RES(STR_QUERY_UNDO_TABWINDELETE) , OUString(), 0, ViewShellId(-1));
+ // I need my parent so it can be informed about the deletion
+ OQueryDesignView* pParent = static_cast<OQueryDesignView*>(getDesignView());
- // add the Undo-Action
- std::unique_ptr<OQueryTabWinDelUndoAct> pUndoAction(new OQueryTabWinDelUndoAct(this));
- pUndoAction->SetTabWin(static_cast< OQueryTableWindow*>(pTabWin));
+ SfxUndoManager& rUndoMgr = m_pView->getController().GetUndoManager();
+ rUndoMgr.EnterListAction(DBA_RES(STR_QUERY_UNDO_TABWINDELETE) , OUString(), 0, ViewShellId(-1));
- // and hide the window
- HideTabWin(static_cast< OQueryTableWindow*>(pTabWin), pUndoAction.get());
+ // add the Undo-Action
+ std::unique_ptr<OQueryTabWinDelUndoAct> pUndoAction(new OQueryTabWinDelUndoAct(this));
+ pUndoAction->SetTabWin(static_cast< OQueryTableWindow*>(pTabWin));
- // Undo Actions and delete the fields in SelectionBrowseBox
- pParent->TableDeleted( static_cast< OQueryTableWindowData*>(pTabWin->GetData().get())->GetAliasName() );
+ // and hide the window
+ HideTabWin(static_cast< OQueryTableWindow*>(pTabWin), pUndoAction.get());
- m_pView->getController().addUndoActionAndInvalidate( std::move(pUndoAction) );
- rUndoMgr.LeaveListAction();
+ // Undo Actions and delete the fields in SelectionBrowseBox
+ pParent->TableDeleted( static_cast< OQueryTableWindowData*>(pTabWin->GetData().get())->GetAliasName() );
- modified();
- if ( m_pAccessible )
- m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
- makeAny(pTabWin->GetAccessible()),
- Any()
- );
- }
+ m_pView->getController().addUndoActionAndInvalidate( std::move(pUndoAction) );
+ rUndoMgr.LeaveListAction();
+
+ modified();
+ if ( m_pAccessible )
+ m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
+ makeAny(pTabWin->GetAccessible()),
+ Any()
+ );
}
void OQueryTableView::EnsureVisible(const OTableWindow* pWin)
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 2ffac3d5203a..9b127f16681b 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -568,19 +568,19 @@ void OSelectionBrowseBox::notifyFunctionFieldChanged(const OUString& _sOldFuncti
void OSelectionBrowseBox::clearEntryFunctionField(const OUString& _sFieldName,OTableFieldDescRef const & _pEntry, bool& _bListAction,sal_uInt16 _nColumnId)
{
- if ( isFieldNameAsterisk( _sFieldName ) && (!_pEntry->isNoneFunction() || _pEntry->IsGroupBy()) )
+ if ( !(isFieldNameAsterisk( _sFieldName ) && (!_pEntry->isNoneFunction() || _pEntry->IsGroupBy())) )
+ return;
+
+ OUString sFunctionName;
+ GetFunctionName(SQL_TOKEN_COUNT,sFunctionName);
+ OUString sOldLocalizedFunctionName = _pEntry->GetFunction();
+ if ( sOldLocalizedFunctionName != sFunctionName || _pEntry->IsGroupBy() )
{
- OUString sFunctionName;
- GetFunctionName(SQL_TOKEN_COUNT,sFunctionName);
- OUString sOldLocalizedFunctionName = _pEntry->GetFunction();
- if ( sOldLocalizedFunctionName != sFunctionName || _pEntry->IsGroupBy() )
- {
- // append undo action for the function field
- _pEntry->SetFunctionType(FKT_NONE);
- _pEntry->SetFunction(OUString());
- _pEntry->SetGroupBy(false);
- notifyFunctionFieldChanged(sOldLocalizedFunctionName,_pEntry->GetFunction(),_bListAction,_nColumnId);
- }
+ // append undo action for the function field
+ _pEntry->SetFunctionType(FKT_NONE);
+ _pEntry->SetFunction(OUString());
+ _pEntry->SetGroupBy(false);
+ notifyFunctionFieldChanged(sOldLocalizedFunctionName,_pEntry->GetFunction(),_bListAction,_nColumnId);
}
}
@@ -1417,26 +1417,26 @@ OTableFieldDescRef const & OSelectionBrowseBox::AppendNewCol( sal_uInt16 nCnt)
void OSelectionBrowseBox::DeleteFields(const OUString& rAliasName)
{
- if (!getFields().empty())
- {
- sal_uInt16 nColId = GetCurColumnId();
- sal_uInt32 nRow = GetCurRow();
+ if (getFields().empty())
+ return;
- bool bWasEditing = IsEditing();
- if (bWasEditing)
- DeactivateCell();
+ sal_uInt16 nColId = GetCurColumnId();
+ sal_uInt32 nRow = GetCurRow();
- auto aIter = std::find_if(getFields().rbegin(), getFields().rend(),
- [&rAliasName](const OTableFieldDescRef pEntry) { return pEntry->GetAlias() == rAliasName; });
- if (aIter != getFields().rend())
- {
- sal_uInt16 nPos = sal::static_int_cast<sal_uInt16>(std::distance(aIter, getFields().rend()));
- RemoveField( GetColumnId( nPos ) );
- }
+ bool bWasEditing = IsEditing();
+ if (bWasEditing)
+ DeactivateCell();
- if (bWasEditing)
- ActivateCell(nRow , nColId);
+ auto aIter = std::find_if(getFields().rbegin(), getFields().rend(),
+ [&rAliasName](const OTableFieldDescRef pEntry) { return pEntry->GetAlias() == rAliasName; });
+ if (aIter != getFields().rend())
+ {
+ sal_uInt16 nPos = sal::static_int_cast<sal_uInt16>(std::distance(aIter, getFields().rend()));
+ RemoveField( GetColumnId( nPos ) );
}
+
+ if (bWasEditing)
+ ActivateCell(nRow , nColId);
}
void OSelectionBrowseBox::SetColWidth(sal_uInt16 nColId, long nNewWidth)
@@ -2589,56 +2589,56 @@ bool OSelectionBrowseBox::fillEntryTable(OTableFieldDescRef const & _pEntry,cons
void OSelectionBrowseBox::setFunctionCell(OTableFieldDescRef const & _pEntry)
{
Reference< XConnection> xConnection = static_cast<OQueryController&>(getDesignView()->getController()).getConnection();
- if ( xConnection.is() )
+ if ( !xConnection.is() )
+ return;
+
+ // Aggregate functions in general only available with Core SQL
+ if ( lcl_SupportsCoreSQLGrammar(xConnection) )
{
- // Aggregate functions in general only available with Core SQL
- if ( lcl_SupportsCoreSQLGrammar(xConnection) )
+ sal_Int32 nIdx {0};
+ // if we have an asterisk, no other function than count is allowed
+ m_pFunctionCell->Clear();
+ m_pFunctionCell->InsertEntry(m_aFunctionStrings.getToken(0, ';', nIdx));
+ if ( isFieldNameAsterisk(_pEntry->GetField()) )
+ m_pFunctionCell->InsertEntry(m_aFunctionStrings.getToken(1, ';', nIdx)); // 2nd token: COUNT
+ else
{
- sal_Int32 nIdx {0};
- // if we have an asterisk, no other function than count is allowed
- m_pFunctionCell->Clear();
- m_pFunctionCell->InsertEntry(m_aFunctionStrings.getToken(0, ';', nIdx));
- if ( isFieldNameAsterisk(_pEntry->GetField()) )
- m_pFunctionCell->InsertEntry(m_aFunctionStrings.getToken(1, ';', nIdx)); // 2nd token: COUNT
- else
- {
- const bool bSkipLastToken {_pEntry->isNumeric()};
- while (nIdx>0)
- {
- const OUString sTok {m_aFunctionStrings.getToken(0, ';', nIdx)};
- if (bSkipLastToken && nIdx<0)
- break;
- m_pFunctionCell->InsertEntry(sTok);
- }
- }
-
- if ( _pEntry->IsGroupBy() )
+ const bool bSkipLastToken {_pEntry->isNumeric()};
+ while (nIdx>0)
{
- OSL_ENSURE(!_pEntry->isNumeric(),"Not allowed to combine group by and numeric values!");
- m_pFunctionCell->SelectEntry(m_pFunctionCell->GetEntry(m_pFunctionCell->GetEntryCount() - 1));
+ const OUString sTok {m_aFunctionStrings.getToken(0, ';', nIdx)};
+ if (bSkipLastToken && nIdx<0)
+ break;
+ m_pFunctionCell->InsertEntry(sTok);
}
- else if ( m_pFunctionCell->GetEntryPos(_pEntry->GetFunction()) != COMBOBOX_ENTRY_NOTFOUND )
- m_pFunctionCell->SelectEntry(_pEntry->GetFunction());
- else
- m_pFunctionCell->SelectEntryPos(0);
+ }
- enableControl(_pEntry,m_pFunctionCell);
+ if ( _pEntry->IsGroupBy() )
+ {
+ OSL_ENSURE(!_pEntry->isNumeric(),"Not allowed to combine group by and numeric values!");
+ m_pFunctionCell->SelectEntry(m_pFunctionCell->GetEntry(m_pFunctionCell->GetEntryCount() - 1));
}
+ else if ( m_pFunctionCell->GetEntryPos(_pEntry->GetFunction()) != COMBOBOX_ENTRY_NOTFOUND )
+ m_pFunctionCell->SelectEntry(_pEntry->GetFunction());
else
- {
- // only COUNT(*) and COUNT("table".*) allowed
- bool bCountRemoved = !isFieldNameAsterisk(_pEntry->GetField());
- if ( bCountRemoved )
- m_pFunctionCell->RemoveEntry(1);
+ m_pFunctionCell->SelectEntryPos(0);
- if ( !bCountRemoved && m_pFunctionCell->GetEntryCount() < 2)
- m_pFunctionCell->InsertEntry(m_aFunctionStrings.getToken(2, ';')); // 2 -> COUNT
+ enableControl(_pEntry,m_pFunctionCell);
+ }
+ else
+ {
+ // only COUNT(*) and COUNT("table".*) allowed
+ bool bCountRemoved = !isFieldNameAsterisk(_pEntry->GetField());
+ if ( bCountRemoved )
+ m_pFunctionCell->RemoveEntry(1);
- if(m_pFunctionCell->GetEntryPos(_pEntry->GetFunction()) != COMBOBOX_ENTRY_NOTFOUND)
- m_pFunctionCell->SelectEntry(_pEntry->GetFunction());
- else
- m_pFunctionCell->SelectEntryPos(0);
- }
+ if ( !bCountRemoved && m_pFunctionCell->GetEntryCount() < 2)
+ m_pFunctionCell->InsertEntry(m_aFunctionStrings.getToken(2, ';')); // 2 -> COUNT
+
+ if(m_pFunctionCell->GetEntryPos(_pEntry->GetFunction()) != COMBOBOX_ENTRY_NOTFOUND)
+ m_pFunctionCell->SelectEntry(_pEntry->GetFunction());
+ else
+ m_pFunctionCell->SelectEntryPos(0);
}
}
diff --git a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
index ca4c89ac81df..95476cafd51e 100644
--- a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
+++ b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
@@ -175,22 +175,22 @@ void OTableFieldDesc::Save( ::comphelper::NamedValueCollection& o_rSettings, con
o_rSettings.put( "GroupBy", m_bGroupBy );
o_rSettings.put( "Visible", m_bVisible );
- if ( i_bIncludingCriteria )
+ if ( !i_bIncludingCriteria )
+ return;
+
+ if ( m_aCriteria.empty() )
+ return;
+
+ sal_Int32 c = 0;
+ Sequence< PropertyValue > aCriteria( m_aCriteria.size() );
+ for (auto const& criteria : m_aCriteria)
{
- if ( !m_aCriteria.empty() )
- {
- sal_Int32 c = 0;
- Sequence< PropertyValue > aCriteria( m_aCriteria.size() );
- for (auto const& criteria : m_aCriteria)
- {
- aCriteria[c].Name = "Criterion_" + OUString::number( c );
- aCriteria[c].Value <<= criteria;
- ++c;
- }
-
- o_rSettings.put( "Criteria", aCriteria );
- }
+ aCriteria[c].Name = "Criterion_" + OUString::number( c );
+ aCriteria[c].Value <<= criteria;
+ ++c;
}
+
+ o_rSettings.put( "Criteria", aCriteria );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx
index cf76c4b2cf9c..61d09a8aaac0 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -255,18 +255,18 @@ void OTableWindow::deleteUserData(void*& _pUserData)
void OTableWindow::clearListBox()
{
- if ( m_xListBox )
- {
- SvTreeListEntry* pEntry = m_xListBox->First();
+ if ( !m_xListBox )
+ return;
- while(pEntry)
- {
- void* pUserData = pEntry->GetUserData();
- deleteUserData(pUserData);
- SvTreeListEntry* pNextEntry = m_xListBox->Next(pEntry);
- m_xListBox->GetModel()->Remove(pEntry);
- pEntry = pNextEntry;
- }
+ SvTreeListEntry* pEntry = m_xListBox->First();
+
+ while(pEntry)
+ {
+ void* pUserData = pEntry->GetUserData();
+ deleteUserData(pUserData);
+ SvTreeListEntry* pNextEntry = m_xListBox->Next(pEntry);
+ m_xListBox->GetModel()->Remove(pEntry);
+ pEntry = pNextEntry;
}
}
@@ -538,20 +538,20 @@ void OTableWindow::StateChanged( StateChangedType nType )
// FIXME RenderContext
- if ( nType == StateChangedType::Zoom )
- {
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ if ( nType != StateChangedType::Zoom )
+ return;
- vcl::Font aFont = rStyleSettings.GetGroupFont();
- if ( IsControlFont() )
- aFont.Merge( GetControlFont() );
- SetZoomedPointFont(*this, aFont);
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- m_xTitle->SetZoom(GetZoom());
- m_xListBox->SetZoom(GetZoom());
- Resize();
- Invalidate();
- }
+ vcl::Font aFont = rStyleSettings.GetGroupFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont(*this, aFont);
+
+ m_xTitle->SetZoom(GetZoom());
+ m_xListBox->SetZoom(GetZoom());
+ Resize();
+ Invalidate();
}
Reference< XAccessible > OTableWindow::CreateAccessible()
diff --git a/dbaccess/source/ui/querydesign/TableWindowData.cxx b/dbaccess/source/ui/querydesign/TableWindowData.cxx
index be75baf7fbce..d07c8214a17c 100644
--- a/dbaccess/source/ui/querydesign/TableWindowData.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowData.cxx
@@ -114,22 +114,22 @@ bool OTableWindowData::init(const Reference< XConnection >& _xConnection,bool _
void OTableWindowData::listen()
{
- if ( m_xTable.is() )
- {
- // listen for the object being disposed
- Reference<XComponent> xComponent( m_xTable, UNO_QUERY );
- if ( xComponent.is() )
- startComponentListening( xComponent );
-
- // obtain the columns
- Reference< XColumnsSupplier > xColumnsSups( m_xTable, UNO_QUERY);
- if ( xColumnsSups.is() )
- m_xColumns = xColumnsSups->getColumns();
-
- Reference<XKeysSupplier> xKeySup(m_xTable,UNO_QUERY);
- if ( xKeySup.is() )
- m_xKeys = xKeySup->getKeys();
- }
+ if ( !m_xTable.is() )
+ return;
+
+ // listen for the object being disposed
+ Reference<XComponent> xComponent( m_xTable, UNO_QUERY );
+ if ( xComponent.is() )
+ startComponentListening( xComponent );
+
+ // obtain the columns
+ Reference< XColumnsSupplier > xColumnsSups( m_xTable, UNO_QUERY);
+ if ( xColumnsSups.is() )
+ m_xColumns = xColumnsSups->getColumns();
+
+ Reference<XKeysSupplier> xKeySup(m_xTable,UNO_QUERY);
+ if ( xKeySup.is() )
+ m_xKeys = xKeySup->getKeys();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
index 31af42beb652..6ac8e0967b93 100644
--- a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
@@ -80,26 +80,26 @@ void OTableWindowTitle::LoseFocus()
void OTableWindowTitle::RequestHelp( const HelpEvent& rHEvt )
{
- if(m_pTabWin)
- {
- OUString aHelpText = m_pTabWin->GetComposedName();
- if( !aHelpText.isEmpty())
- {
- // show help
- tools::Rectangle aItemRect(Point(0,0),GetSizePixel());
- aItemRect = LogicToPixel( aItemRect );
- Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
- aItemRect.SetLeft( aPt.X() );
- aItemRect.SetTop( aPt.Y() );
- aPt = OutputToScreenPixel( aItemRect.BottomRight() );
- aItemRect.SetRight( aPt.X() );
- aItemRect.SetBottom( aPt.Y() );
- if( rHEvt.GetMode() == HelpEventMode::BALLOON )
- Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aHelpText);
- else
- Help::ShowQuickHelp( this, aItemRect, aHelpText );
- }
- }
+ if(!m_pTabWin)
+ return;
+
+ OUString aHelpText = m_pTabWin->GetComposedName();
+ if( aHelpText.isEmpty())
+ return;
+
+ // show help
+ tools::Rectangle aItemRect(Point(0,0),GetSizePixel());
+ aItemRect = LogicToPixel( aItemRect );
+ Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
+ aItemRect.SetLeft( aPt.X() );
+ aItemRect.SetTop( aPt.Y() );
+ aPt = OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.SetRight( aPt.X() );
+ aItemRect.SetBottom( aPt.Y() );
+ if( rHEvt.GetMode() == HelpEventMode::BALLOON )
+ Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aHelpText);
+ else
+ Help::ShowQuickHelp( this, aItemRect, aHelpText );
}
void OTableWindowTitle::Command( const CommandEvent& rEvt )
diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
index baaca8b8e5c8..99c5ca2373d7 100644
--- a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
+++ b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
@@ -240,21 +240,21 @@ void SAL_CALL LimitBoxController::dispose()
void SAL_CALL LimitBoxController::statusChanged(
const frame::FeatureStateEvent& rEvent )
{
- if ( m_xLimitBox )
+ if ( !m_xLimitBox )
+ return;
+
+ SolarMutexGuard aSolarMutexGuard;
+ if ( rEvent.FeatureURL.Path == "DBLimit" )
{
- SolarMutexGuard aSolarMutexGuard;
- if ( rEvent.FeatureURL.Path == "DBLimit" )
+ if ( rEvent.IsEnabled )
{
- if ( rEvent.IsEnabled )
- {
- m_xLimitBox->set_sensitive(true);
- sal_Int64 nLimit = 0;
- if (rEvent.State >>= nLimit)
- m_xLimitBox->set_value(nLimit);
- }
- else
- m_xLimitBox->set_sensitive(false);
+ m_xLimitBox->set_sensitive(true);
+ sal_Int64 nLimit = 0;
+ if (rEvent.State >>= nLimit)
+ m_xLimitBox->set_value(nLimit);
}
+ else
+ m_xLimitBox->set_sensitive(false);
}
}
diff --git a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx
index 7361421378a4..819c4c55a0a7 100644
--- a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx
+++ b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx
@@ -171,54 +171,54 @@ namespace dbaui
}
void OQueryContainerWindow::showPreview(const Reference<XFrame>& _xFrame)
{
- if(!m_pBeamer)
- {
- m_pBeamer = VclPtr<OBeamer>::Create(this);
+ if(m_pBeamer)
+ return;
- ::dbaui::notifySystemWindow(this,m_pBeamer,::comphelper::mem_fun(&TaskPaneList::AddWindow));
+ m_pBeamer = VclPtr<OBeamer>::Create(this);
- m_xBeamer = Frame::create( m_pViewSwitch->getORB() );
- m_xBeamer->initialize( VCLUnoHelper::GetInterface ( m_pBeamer ) );
+ ::dbaui::notifySystemWindow(this,m_pBeamer,::comphelper::mem_fun(&TaskPaneList::AddWindow));
- // notify layout manager to not create internal toolbars
- try
- {
- Reference < XPropertySet > xLMPropSet(m_xBeamer->getLayoutManager(), UNO_QUERY);
- if ( xLMPropSet.is() )
- {
- const OUString aAutomaticToolbars( "AutomaticToolbars" );
- xLMPropSet->setPropertyValue( aAutomaticToolbars, Any( false ));
- }
- }
- catch( Exception& )
+ m_xBeamer = Frame::create( m_pViewSwitch->getORB() );
+ m_xBeamer->initialize( VCLUnoHelper::GetInterface ( m_pBeamer ) );
+
+ // notify layout manager to not create internal toolbars
+ try
+ {
+ Reference < XPropertySet > xLMPropSet(m_xBeamer->getLayoutManager(), UNO_QUERY);
+ if ( xLMPropSet.is() )
{
+ const OUString aAutomaticToolbars( "AutomaticToolbars" );
+ xLMPropSet->setPropertyValue( aAutomaticToolbars, Any( false ));
}
+ }
+ catch( Exception& )
+ {
+ }
- m_xBeamer->setName(FRAME_NAME_QUERY_PREVIEW);
+ m_xBeamer->setName(FRAME_NAME_QUERY_PREVIEW);
- // append our frame
- Reference < XFramesSupplier > xSup(_xFrame,UNO_QUERY);
- Reference < XFrames > xFrames = xSup->getFrames();
- xFrames->append( Reference<XFrame>(m_xBeamer,UNO_QUERY_THROW) );
+ // append our frame
+ Reference < XFramesSupplier > xSup(_xFrame,UNO_QUERY);
+ Reference < XFrames > xFrames = xSup->getFrames();
+ xFrames->append( Reference<XFrame>(m_xBeamer,UNO_QUERY_THROW) );
- Size aSize = GetOutputSizePixel();
- Size aBeamer(aSize.Width(),sal_Int32(aSize.Height()*0.33));
+ Size aSize = GetOutputSizePixel();
+ Size aBeamer(aSize.Width(),sal_Int32(aSize.Height()*0.33));
- const long nFrameHeight = LogicToPixel(Size(0, 3), MapMode(MapUnit::MapAppFont)).Height();
- Point aPos(0,aBeamer.Height()+nFrameHeight);
+ const long nFrameHeight = LogicToPixel(Size(0, 3), MapMode(MapUnit::MapAppFont)).Height();
+ Point aPos(0,aBeamer.Height()+nFrameHeight);
- m_pBeamer->SetPosSizePixel(Point(0,0),aBeamer);
- m_pBeamer->Show();
+ m_pBeamer->SetPosSizePixel(Point(0,0),aBeamer);
+ m_pBeamer->Show();
- m_pSplitter->SetPosSizePixel( Point(0,aBeamer.Height()), Size(aSize.Width(),nFrameHeight) );
- // a default pos for the splitter, so that the listbox is about 80 (logical) pixels wide
- m_pSplitter->SetSplitPosPixel( aBeamer.Height() );
- m_pViewSwitch->SetPosSizePixel(aPos,Size(aBeamer.Width(),aSize.Height() - aBeamer.Height()-nFrameHeight));
+ m_pSplitter->SetPosSizePixel( Point(0,aBeamer.Height()), Size(aSize.Width(),nFrameHeight) );
+ // a default pos for the splitter, so that the listbox is about 80 (logical) pixels wide
+ m_pSplitter->SetSplitPosPixel( aBeamer.Height() );
+ m_pViewSwitch->SetPosSizePixel(aPos,Size(aBeamer.Width(),aSize.Height() - aBeamer.Height()-nFrameHeight));
- m_pSplitter->Show();
+ m_pSplitter->Show();
- Resize();
- }
+ Resize();
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index fd6ccbdf0528..79ce00b02c4d 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -172,24 +172,24 @@ namespace
void ensureToolbars( OQueryController& _rController, bool _bDesign )
{
Reference< css::frame::XLayoutManager > xLayoutManager = OGenericUnoController::getLayoutManager( _rController.getFrame() );
- if ( xLayoutManager.is() )
+ if ( !xLayoutManager.is() )
+ return;
+
+ xLayoutManager->lock();
+ static const char s_sDesignToolbar[] = "private:resource/toolbar/designobjectbar";
+ static const char s_sSqlToolbar[] = "private:resource/toolbar/sqlobjectbar";
+ if ( _bDesign )
{
- xLayoutManager->lock();
- static const char s_sDesignToolbar[] = "private:resource/toolbar/designobjectbar";
- static const char s_sSqlToolbar[] = "private:resource/toolbar/sqlobjectbar";
- if ( _bDesign )
- {
- xLayoutManager->destroyElement( s_sSqlToolbar );
- xLayoutManager->createElement( s_sDesignToolbar );
- }
- else
- {
- xLayoutManager->destroyElement( s_sDesignToolbar );
- xLayoutManager->createElement( s_sSqlToolbar );
- }
- xLayoutManager->unlock();
- xLayoutManager->doLayout();
+ xLayoutManager->destroyElement( s_sSqlToolbar );
+ xLayoutManager->createElement( s_sDesignToolbar );
}
+ else
+ {
+ xLayoutManager->destroyElement( s_sDesignToolbar );
+ xLayoutManager->createElement( s_sSqlToolbar );
+ }
+ xLayoutManager->unlock();
+ xLayoutManager->doLayout();
}
/**
@@ -924,27 +924,27 @@ OUString OQueryController::getPrivateTitle( ) const
void OQueryController::setQueryComposer()
{
- if(isConnected())
+ if(!isConnected())
+ return;
+
+ Reference< XSQLQueryComposerFactory > xFactory(getConnection(), UNO_QUERY);
+ OSL_ENSURE(xFactory.is(),"Connection doesn't support a querycomposer");
+ if ( !(xFactory.is() && getContainer()) )
+ return;
+
+ try
{
- Reference< XSQLQueryComposerFactory > xFactory(getConnection(), UNO_QUERY);
- OSL_ENSURE(xFactory.is(),"Connection doesn't support a querycomposer");
- if ( xFactory.is() && getContainer() )
- {
- try
- {
- m_xComposer = xFactory->createQueryComposer();
- getContainer()->setStatement(m_sStatement);
- }
- catch(const Exception&)
- {
- m_xComposer = nullptr;
- }
- OSL_ENSURE(m_xComposer.is(),"No querycomposer available!");
- Reference<XTablesSupplier> xTablesSup(getConnection(), UNO_QUERY);
- deleteIterator();
- m_pSqlIterator.reset(new ::connectivity::OSQLParseTreeIterator( getConnection(), xTablesSup->getTables(), m_aSqlParser ));
- }
+ m_xComposer = xFactory->createQueryComposer();
+ getContainer()->setStatement(m_sStatement);
+ }
+ catch(const Exception&)
+ {
+ m_xComposer = nullptr;
}
+ OSL_ENSURE(m_xComposer.is(),"No querycomposer available!");
+ Reference<XTablesSupplier> xTablesSup(getConnection(), UNO_QUERY);
+ deleteIterator();
+ m_pSqlIterator.reset(new ::connectivity::OSQLParseTreeIterator( getConnection(), xTablesSup->getTables(), m_aSqlParser ));
}
bool OQueryController::Construct(vcl::Window* pParent)
@@ -1126,68 +1126,68 @@ void OQueryController::executeQuery()
OUString sTranslatedStmt = translateStatement( false );
OUString sDataSourceName = getDataSourceName();
- if ( !(sDataSourceName.isEmpty() || sTranslatedStmt.isEmpty()) )
+ if ( sDataSourceName.isEmpty() || sTranslatedStmt.isEmpty() )
+ return;
+
+ try
{
- try
- {
- getContainer()->showPreview( getFrame() );
- InvalidateFeature(SID_DB_QUERY_PREVIEW);
+ getContainer()->showPreview( getFrame() );
+ InvalidateFeature(SID_DB_QUERY_PREVIEW);
- URL aWantToDispatch;
- aWantToDispatch.Complete = ".component:DB/DataSourceBrowser";
+ URL aWantToDispatch;
+ aWantToDispatch.Complete = ".component:DB/DataSourceBrowser";
- OUString sFrameName( FRAME_NAME_QUERY_PREVIEW );
- sal_Int32 nSearchFlags = FrameSearchFlag::CHILDREN;
+ OUString sFrameName( FRAME_NAME_QUERY_PREVIEW );
+ sal_Int32 nSearchFlags = FrameSearchFlag::CHILDREN;
- Reference< XDispatch> xDisp;
- Reference< XDispatchProvider> xProv( getFrame()->findFrame( sFrameName, nSearchFlags ), UNO_QUERY );
- if(!xProv.is())
- {
- xProv.set( getFrame(), UNO_QUERY );
- if (xProv.is())
- xDisp = xProv->queryDispatch(aWantToDispatch, sFrameName, nSearchFlags);
- }
- else
- {
- xDisp = xProv->queryDispatch(aWantToDispatch, sFrameName, FrameSearchFlag::SELF);
- }
- if (xDisp.is())
- {
- auto aProps(::comphelper::InitPropertySequence(
- {
- { PROPERTY_DATASOURCENAME, makeAny(sDataSourceName) },
- { PROPERTY_COMMAND_TYPE, makeAny(CommandType::COMMAND) },
- { PROPERTY_COMMAND, makeAny(sTranslatedStmt) },
- { PROPERTY_ENABLE_BROWSER, makeAny(false) },
- { PROPERTY_ACTIVE_CONNECTION, makeAny(getConnection()) },
- { PROPERTY_UPDATE_CATALOGNAME, makeAny(m_sUpdateCatalogName) },
- { PROPERTY_UPDATE_SCHEMANAME, makeAny(m_sUpdateSchemaName) },
- { PROPERTY_UPDATE_TABLENAME, makeAny(OUString()) },
- { PROPERTY_ESCAPE_PROCESSING, makeAny(m_bEscapeProcessing) }
- }));
-
- xDisp->dispatch(aWantToDispatch, aProps);
- // check the state of the beamer
- // be notified when the beamer frame is closed
- Reference< XComponent > xComponent = getFrame()->findFrame( sFrameName, nSearchFlags );
- if (xComponent.is())
+ Reference< XDispatch> xDisp;
+ Reference< XDispatchProvider> xProv( getFrame()->findFrame( sFrameName, nSearchFlags ), UNO_QUERY );
+ if(!xProv.is())
+ {
+ xProv.set( getFrame(), UNO_QUERY );
+ if (xProv.is())
+ xDisp = xProv->queryDispatch(aWantToDispatch, sFrameName, nSearchFlags);
+ }
+ else
+ {
+ xDisp = xProv->queryDispatch(aWantToDispatch, sFrameName, FrameSearchFlag::SELF);
+ }
+ if (xDisp.is())
+ {
+ auto aProps(::comphelper::InitPropertySequence(
{
- OSL_ENSURE(Reference< XFrame >(xComponent, UNO_QUERY).get() == getContainer()->getPreviewFrame().get(),
- "OQueryController::executeQuery: oops ... which window do I have here?");
- Reference< XEventListener> xEvtL(static_cast<cppu::OWeakObject*>(this),UNO_QUERY);
- xComponent->addEventListener(xEvtL);
- }
- }
- else
+ { PROPERTY_DATASOURCENAME, makeAny(sDataSourceName) },
+ { PROPERTY_COMMAND_TYPE, makeAny(CommandType::COMMAND) },
+ { PROPERTY_COMMAND, makeAny(sTranslatedStmt) },
+ { PROPERTY_ENABLE_BROWSER, makeAny(false) },
+ { PROPERTY_ACTIVE_CONNECTION, makeAny(getConnection()) },
+ { PROPERTY_UPDATE_CATALOGNAME, makeAny(m_sUpdateCatalogName) },
+ { PROPERTY_UPDATE_SCHEMANAME, makeAny(m_sUpdateSchemaName) },
+ { PROPERTY_UPDATE_TABLENAME, makeAny(OUString()) },
+ { PROPERTY_ESCAPE_PROCESSING, makeAny(m_bEscapeProcessing) }
+ }));
+
+ xDisp->dispatch(aWantToDispatch, aProps);
+ // check the state of the beamer
+ // be notified when the beamer frame is closed
+ Reference< XComponent > xComponent = getFrame()->findFrame( sFrameName, nSearchFlags );
+ if (xComponent.is())
{
- OSL_FAIL("Couldn't create a beamer window!");
+ OSL_ENSURE(Reference< XFrame >(xComponent, UNO_QUERY).get() == getContainer()->getPreviewFrame().get(),
+ "OQueryController::executeQuery: oops ... which window do I have here?");
+ Reference< XEventListener> xEvtL(static_cast<cppu::OWeakObject*>(this),UNO_QUERY);
+ xComponent->addEventListener(xEvtL);
}
}
- catch(const Exception&)
+ else
{
OSL_FAIL("Couldn't create a beamer window!");
}
}
+ catch(const Exception&)
+ {
+ OSL_FAIL("Couldn't create a beamer window!");
+ }
}
bool OQueryController::askForNewName(const Reference<XNameAccess>& _xElements, bool _bSaveAs)
diff --git a/dbaccess/source/ui/querydesign/querydlg.cxx b/dbaccess/source/ui/querydesign/querydlg.cxx
index 72b1edb27006..0ff7a526d783 100644
--- a/dbaccess/source/ui/querydesign/querydlg.cxx
+++ b/dbaccess/source/ui/querydesign/querydlg.cxx
@@ -236,28 +236,28 @@ IMPL_LINK_NOARG(DlgQryJoin, NaturalToggleHdl, weld::ToggleButton&, void)
bool bChecked = m_xCBNatural->get_active();
static_cast<OQueryTableConnectionData*>(m_pConnData.get())->setNatural(bChecked);
m_xTableControl->enableRelation(!bChecked);
- if ( bChecked )
+ if ( !bChecked )
+ return;
+
+ m_pConnData->ResetConnLines();
+ try
{
- m_pConnData->ResetConnLines();
- try
- {
- Reference<XNameAccess> xReferencedTableColumns(m_pConnData->getReferencedTable()->getColumns());
- Sequence< OUString> aSeq = m_pConnData->getReferencingTable()->getColumns()->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
- for(;pIter != pEnd;++pIter)
- {
- if ( xReferencedTableColumns->hasByName(*pIter) )
- m_pConnData->AppendConnLine(*pIter,*pIter);
- }
- }
- catch( const Exception& )
+ Reference<XNameAccess> xReferencedTableColumns(m_pConnData->getReferencedTable()->getColumns());
+ Sequence< OUString> aSeq = m_pConnData->getReferencingTable()->getColumns()->getElementNames();
+ const OUString* pIter = aSeq.getConstArray();
+ const OUString* pEnd = pIter + aSeq.getLength();
+ for(;pIter != pEnd;++pIter)
{
- DBG_UNHANDLED_EXCEPTION("dbaccess");
+ if ( xReferencedTableColumns->hasByName(*pIter) )
+ m_pConnData->AppendConnLine(*pIter,*pIter);
}
- m_xTableControl->NotifyCellChange();
- m_xTableControl->Invalidate();
}
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
+ }
+ m_xTableControl->NotifyCellChange();
+ m_xTableControl->Invalidate();
}
void DlgQryJoin::setValid(bool _bValid)
diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
index 80c2faef464f..4fce4c13a415 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
@@ -80,25 +80,25 @@ void ORelationTableConnectionData::DropRelation()
::osl::MutexGuard aGuard( m_aMutex );
// delete relation
Reference< XIndexAccess> xKeys = getReferencingTable()->getKeys();
- if( !m_aConnName.isEmpty() && xKeys.is() )
+ if( !(!m_aConnName.isEmpty() && xKeys.is()) )
+ return;
+
+ const sal_Int32 nCount = xKeys->getCount();
+ for(sal_Int32 i = 0;i < nCount;++i)
{
- const sal_Int32 nCount = xKeys->getCount();
- for(sal_Int32 i = 0;i < nCount;++i)
+ Reference< XPropertySet> xKey(xKeys->getByIndex(i),UNO_QUERY);
+ OSL_ENSURE(xKey.is(),"Key is not valid!");
+ if(xKey.is())
{
- Reference< XPropertySet> xKey(xKeys->getByIndex(i),UNO_QUERY);
- OSL_ENSURE(xKey.is(),"Key is not valid!");
- if(xKey.is())
+ OUString sName;
+ xKey->getPropertyValue(PROPERTY_NAME) >>= sName;
+ if(sName == m_aConnName)
{
- OUString sName;
- xKey->getPropertyValue(PROPERTY_NAME) >>= sName;
- if(sName == m_aConnName)
- {
- Reference< XDrop> xDrop(xKeys,UNO_QUERY);
- OSL_ENSURE(xDrop.is(),"can't drop key because we haven't a drop interface!");
- if(xDrop.is())
- xDrop->dropByIndex(i);
- break;
- }
+ Reference< XDrop> xDrop(xKeys,UNO_QUERY);
+ OSL_ENSURE(xDrop.is(),"can't drop key because we haven't a drop interface!");
+ if(xDrop.is())
+ xDrop->dropByIndex(i);
+ break;
}
}
}
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx
index 530598ad09f5..788acc9108b8 100644
--- a/dbaccess/source/ui/relationdesign/RelationController.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -365,69 +365,69 @@ namespace
xKeys = xKeySup->getKeys();
}
- if ( xKeys.is() )
+ if ( !xKeys.is() )
+ return;
+
+ Reference<XPropertySet> xKey;
+ const sal_Int32 nCount = xKeys->getCount();
+ for(sal_Int32 i = 0 ; i < nCount ; ++i)
{
- Reference<XPropertySet> xKey;
- const sal_Int32 nCount = xKeys->getCount();
- for(sal_Int32 i = 0 ; i < nCount ; ++i)
+ xKeys->getByIndex(i) >>= xKey;
+ sal_Int32 nKeyType = 0;
+ xKey->getPropertyValue(PROPERTY_TYPE) >>= nKeyType;
+ if ( KeyType::FOREIGN == nKeyType )
{
- xKeys->getByIndex(i) >>= xKey;
- sal_Int32 nKeyType = 0;
- xKey->getPropertyValue(PROPERTY_TYPE) >>= nKeyType;
- if ( KeyType::FOREIGN == nKeyType )
- {
- OUString sReferencedTable;
- xKey->getPropertyValue(PROPERTY_REFERENCEDTABLE) >>= sReferencedTable;
+ OUString sReferencedTable;
+ xKey->getPropertyValue(PROPERTY_REFERENCEDTABLE) >>= sReferencedTable;
- // insert windows
- TTableDataHelper::const_iterator aRefFind = m_aTableData.find(sReferencedTable);
- if ( aRefFind == m_aTableData.end() )
+ // insert windows
+ TTableDataHelper::const_iterator aRefFind = m_aTableData.find(sReferencedTable);
+ if ( aRefFind == m_aTableData.end() )
+ {
+ if ( m_xTables->hasByName(sReferencedTable) )
{
- if ( m_xTables->hasByName(sReferencedTable) )
- {
- Reference<XPropertySet> xReferencedTable(m_xTables->getByName(sReferencedTable),UNO_QUERY);
- aRefFind = m_aTableData.emplace(sReferencedTable,std::make_shared<OTableWindowData>(xReferencedTable,sReferencedTable, sReferencedTable, OUString())).first;
- aRefFind->second->ShowAll(false);
- }
- else
- continue; // table name could not be found so we do not show this table relation
+ Reference<XPropertySet> xReferencedTable(m_xTables->getByName(sReferencedTable),UNO_QUERY);
+ aRefFind = m_aTableData.emplace(sReferencedTable,std::make_shared<OTableWindowData>(xReferencedTable,sReferencedTable, sReferencedTable, OUString())).first;
+ aRefFind->second->ShowAll(false);
}
- TTableWindowData::value_type pReferencedTable = aRefFind->second;
-
- OUString sKeyName;
- xKey->getPropertyValue(PROPERTY_NAME) >>= sKeyName;
- // insert connection
- ORelationTableConnectionData* pTabConnData = new ORelationTableConnectionData( pReferencingTable, pReferencedTable, sKeyName );
- m_vTableConnectionData.push_back(TTableConnectionData::value_type(pTabConnData));
- // insert columns
- const Reference<XColumnsSupplier> xColsSup(xKey,UNO_QUERY);
- OSL_ENSURE(xColsSup.is(),"Key is no XColumnsSupplier!");
- const Reference<XNameAccess> xColumns = xColsSup->getColumns();
- const Sequence< OUString> aNames = xColumns->getElementNames();
- OUString sColumnName,sRelatedName;
- for(sal_Int32 j=0;j<aNames.getLength();++j)
+ else
+ continue; // table name could not be found so we do not show this table relation
+ }
+ TTableWindowData::value_type pReferencedTable = aRefFind->second;
+
+ OUString sKeyName;
+ xKey->getPropertyValue(PROPERTY_NAME) >>= sKeyName;
+ // insert connection
+ ORelationTableConnectionData* pTabConnData = new ORelationTableConnectionData( pReferencingTable, pReferencedTable, sKeyName );
+ m_vTableConnectionData.push_back(TTableConnectionData::value_type(pTabConnData));
+ // insert columns
+ const Reference<XColumnsSupplier> xColsSup(xKey,UNO_QUERY);
+ OSL_ENSURE(xColsSup.is(),"Key is no XColumnsSupplier!");
+ const Reference<XNameAccess> xColumns = xColsSup->getColumns();
+ const Sequence< OUString> aNames = xColumns->getElementNames();
+ OUString sColumnName,sRelatedName;
+ for(sal_Int32 j=0;j<aNames.getLength();++j)
+ {
+ const Reference<XPropertySet> xPropSet(xColumns->getByName(aNames[j]),UNO_QUERY);
+ OSL_ENSURE(xPropSet.is(),"Invalid column found in KeyColumns!");
+ if ( xPropSet.is() )
{
- const Reference<XPropertySet> xPropSet(xColumns->getByName(aNames[j]),UNO_QUERY);
- OSL_ENSURE(xPropSet.is(),"Invalid column found in KeyColumns!");
- if ( xPropSet.is() )
- {
- xPropSet->getPropertyValue(PROPERTY_NAME) >>= sColumnName;
- xPropSet->getPropertyValue(PROPERTY_RELATEDCOLUMN) >>= sRelatedName;
- }
- pTabConnData->SetConnLine( j, sColumnName, sRelatedName );
+ xPropSet->getPropertyValue(PROPERTY_NAME) >>= sColumnName;
+ xPropSet->getPropertyValue(PROPERTY_RELATEDCOLUMN) >>= sRelatedName;
}
- // set update/del flags
- sal_Int32 nUpdateRule = 0;
- sal_Int32 nDeleteRule = 0;
- xKey->getPropertyValue(PROPERTY_UPDATERULE) >>= nUpdateRule;
- xKey->getPropertyValue(PROPERTY_DELETERULE) >>= nDeleteRule;
+ pTabConnData->SetConnLine( j, sColumnName, sRelatedName );
+ }
+ // set update/del flags
+ sal_Int32 nUpdateRule = 0;
+ sal_Int32 nDeleteRule = 0;
+ xKey->getPropertyValue(PROPERTY_UPDATERULE) >>= nUpdateRule;
+ xKey->getPropertyValue(PROPERTY_DELETERULE) >>= nDeleteRule;
- pTabConnData->SetUpdateRules( nUpdateRule );
- pTabConnData->SetDeleteRules( nDeleteRule );
+ pTabConnData->SetUpdateRules( nUpdateRule );
+ pTabConnData->SetDeleteRules( nDeleteRule );
- // set cardinality
- pTabConnData->SetCardinality();
- }
+ // set cardinality
+ pTabConnData->SetCardinality();
}
}
}
diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
index e178cd17d8c2..961522453661 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
@@ -96,71 +96,71 @@ OFieldDescription::OFieldDescription(const Reference< XPropertySet >& xAffectedC
,m_bHidden(false)
{
OSL_ENSURE(xAffectedCol.is(),"PropertySet can not be null!");
- if ( xAffectedCol.is() )
+ if ( !xAffectedCol.is() )
+ return;
+
+ if ( _bUseAsDest )
{
- if ( _bUseAsDest )
- {
- m_xDest = xAffectedCol;
- m_xDestInfo = xAffectedCol->getPropertySetInfo();
- }
- else
+ m_xDest = xAffectedCol;
+ m_xDestInfo = xAffectedCol->getPropertySetInfo();
+ }
+ else
+ {
+ try
{
- try
+ Reference<XPropertySetInfo> xPropSetInfo = xAffectedCol->getPropertySetInfo();
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_NAME))
+ SetName(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_NAME)));
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_DESCRIPTION))
+ SetDescription(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_DESCRIPTION)));
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_HELPTEXT))
{
- Reference<XPropertySetInfo> xPropSetInfo = xAffectedCol->getPropertySetInfo();
- if(xPropSetInfo->hasPropertyByName(PROPERTY_NAME))
- SetName(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_NAME)));
- if(xPropSetInfo->hasPropertyByName(PROPERTY_DESCRIPTION))
- SetDescription(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_DESCRIPTION)));
- if(xPropSetInfo->hasPropertyByName(PROPERTY_HELPTEXT))
- {
- OUString sHelpText;
- xAffectedCol->getPropertyValue(PROPERTY_HELPTEXT) >>= sHelpText;
- SetHelpText(sHelpText);
- }
- if(xPropSetInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE))
- SetDefaultValue( xAffectedCol->getPropertyValue(PROPERTY_DEFAULTVALUE) );
-
- if(xPropSetInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
- SetControlDefault( xAffectedCol->getPropertyValue(PROPERTY_CONTROLDEFAULT) );
-
- if(xPropSetInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION))
- SetAutoIncrementValue(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_AUTOINCREMENTCREATION)));
- if(xPropSetInfo->hasPropertyByName(PROPERTY_TYPE))
- SetTypeValue(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_TYPE)));
- if (xPropSetInfo->hasPropertyByName(PROPERTY_TYPENAME))
- SetTypeName(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_TYPENAME)));
- if(xPropSetInfo->hasPropertyByName(PROPERTY_PRECISION))
- SetPrecision(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_PRECISION)));
- if(xPropSetInfo->hasPropertyByName(PROPERTY_SCALE))
- SetScale(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_SCALE)));
- if(xPropSetInfo->hasPropertyByName(PROPERTY_ISNULLABLE))
- SetIsNullable(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_ISNULLABLE)));
- if(xPropSetInfo->hasPropertyByName(PROPERTY_FORMATKEY))
- {
- const Any aValue = xAffectedCol->getPropertyValue(PROPERTY_FORMATKEY);
- if ( aValue.hasValue() )
- SetFormatKey(::comphelper::getINT32(aValue));
- }
- if(xPropSetInfo->hasPropertyByName(PROPERTY_RELATIVEPOSITION))
- m_aRelativePosition = xAffectedCol->getPropertyValue(PROPERTY_RELATIVEPOSITION);
- if(xPropSetInfo->hasPropertyByName(PROPERTY_WIDTH))
- m_aWidth = xAffectedCol->getPropertyValue(PROPERTY_WIDTH);
- if(xPropSetInfo->hasPropertyByName(PROPERTY_HIDDEN))
- xAffectedCol->getPropertyValue(PROPERTY_HIDDEN) >>= m_bHidden;
- if(xPropSetInfo->hasPropertyByName(PROPERTY_ALIGN))
- {
- const Any aValue = xAffectedCol->getPropertyValue(PROPERTY_ALIGN);
- if ( aValue.hasValue() )
- SetHorJustify( ::dbaui::mapTextJustify(::comphelper::getINT32(aValue)));
- }
- if(xPropSetInfo->hasPropertyByName(PROPERTY_ISAUTOINCREMENT))
- SetAutoIncrement(::cppu::any2bool(xAffectedCol->getPropertyValue(PROPERTY_ISAUTOINCREMENT)));
+ OUString sHelpText;
+ xAffectedCol->getPropertyValue(PROPERTY_HELPTEXT) >>= sHelpText;
+ SetHelpText(sHelpText);
+ }
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE))
+ SetDefaultValue( xAffectedCol->getPropertyValue(PROPERTY_DEFAULTVALUE) );
+
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
+ SetControlDefault( xAffectedCol->getPropertyValue(PROPERTY_CONTROLDEFAULT) );
+
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION))
+ SetAutoIncrementValue(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_AUTOINCREMENTCREATION)));
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_TYPE))
+ SetTypeValue(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_TYPE)));
+ if (xPropSetInfo->hasPropertyByName(PROPERTY_TYPENAME))
+ SetTypeName(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_TYPENAME)));
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_PRECISION))
+ SetPrecision(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_PRECISION)));
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_SCALE))
+ SetScale(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_SCALE)));
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_ISNULLABLE))
+ SetIsNullable(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_ISNULLABLE)));
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_FORMATKEY))
+ {
+ const Any aValue = xAffectedCol->getPropertyValue(PROPERTY_FORMATKEY);
+ if ( aValue.hasValue() )
+ SetFormatKey(::comphelper::getINT32(aValue));
}
- catch(const Exception&)
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_RELATIVEPOSITION))
+ m_aRelativePosition = xAffectedCol->getPropertyValue(PROPERTY_RELATIVEPOSITION);
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_WIDTH))
+ m_aWidth = xAffectedCol->getPropertyValue(PROPERTY_WIDTH);
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_HIDDEN))
+ xAffectedCol->getPropertyValue(PROPERTY_HIDDEN) >>= m_bHidden;
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_ALIGN))
{
- DBG_UNHANDLED_EXCEPTION("dbaccess");
+ const Any aValue = xAffectedCol->getPropertyValue(PROPERTY_ALIGN);
+ if ( aValue.hasValue() )
+ SetHorJustify( ::dbaui::mapTextJustify(::comphelper::getINT32(aValue)));
}
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_ISAUTOINCREMENT))
+ SetAutoIncrement(::cppu::any2bool(xAffectedCol->getPropertyValue(PROPERTY_ISAUTOINCREMENT)));
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
}
}
}
@@ -168,70 +168,70 @@ OFieldDescription::OFieldDescription(const Reference< XPropertySet >& xAffectedC
void OFieldDescription::FillFromTypeInfo(const TOTypeInfoSP& _pType,bool _bForce,bool _bReset)
{
TOTypeInfoSP pOldType = getTypeInfo();
- if ( _pType != pOldType )
+ if ( _pType == pOldType )
+ return;
+
+ // reset type depending information
+ if ( _bReset )
{
- // reset type depending information
- if ( _bReset )
- {
- SetFormatKey(0);
- SetControlDefault(Any());
- }
+ SetFormatKey(0);
+ SetControlDefault(Any());
+ }
- bool bForce = _bForce || pOldType.get() == nullptr || pOldType->nType != _pType->nType;
- switch ( _pType->nType )
- {
- case DataType::CHAR:
- case DataType::VARCHAR:
- if ( bForce )
+ bool bForce = _bForce || pOldType.get() == nullptr || pOldType->nType != _pType->nType;
+ switch ( _pType->nType )
+ {
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ if ( bForce )
+ {
+ sal_Int32 nPrec = DEFAULT_VARCHAR_PRECISION;
+ if ( GetPrecision() )
+ nPrec = GetPrecision();
+ SetPrecision(std::min<sal_Int32>(nPrec,_pType->nPrecision));
+ }
+ break;
+ case DataType::TIMESTAMP:
+ if ( bForce && _pType->nMaximumScale)
+ {
+ SetScale(std::min<sal_Int32>(GetScale() ? GetScale() : DEFAULT_NUMERIC_SCALE,_pType->nMaximumScale));
+ }
+ break;
+ default:
+ if ( bForce )
+ {
+ sal_Int32 nPrec = DEFAULT_OTHER_PRECISION;
+ switch ( _pType->nType )
{
- sal_Int32 nPrec = DEFAULT_VARCHAR_PRECISION;
- if ( GetPrecision() )
- nPrec = GetPrecision();
- SetPrecision(std::min<sal_Int32>(nPrec,_pType->nPrecision));
+ case DataType::BIT:
+ case DataType::BLOB:
+ case DataType::CLOB:
+ nPrec = _pType->nPrecision;
+ break;
+ default:
+ if ( GetPrecision() )
+ nPrec = GetPrecision();
+ break;
}
- break;
- case DataType::TIMESTAMP:
- if ( bForce && _pType->nMaximumScale)
- {
+
+ if ( _pType->nPrecision )
+ SetPrecision(std::min<sal_Int32>(nPrec ? nPrec : DEFAULT_NUMERIC_PRECISION,_pType->nPrecision));
+ if ( _pType->nMaximumScale )
SetScale(std::min<sal_Int32>(GetScale() ? GetScale() : DEFAULT_NUMERIC_SCALE,_pType->nMaximumScale));
- }
- break;
- default:
- if ( bForce )
- {
- sal_Int32 nPrec = DEFAULT_OTHER_PRECISION;
- switch ( _pType->nType )
- {
- case DataType::BIT:
- case DataType::BLOB:
- case DataType::CLOB:
- nPrec = _pType->nPrecision;
- break;
- default:
- if ( GetPrecision() )
- nPrec = GetPrecision();
- break;
- }
-
- if ( _pType->nPrecision )
- SetPrecision(std::min<sal_Int32>(nPrec ? nPrec : DEFAULT_NUMERIC_PRECISION,_pType->nPrecision));
- if ( _pType->nMaximumScale )
- SetScale(std::min<sal_Int32>(GetScale() ? GetScale() : DEFAULT_NUMERIC_SCALE,_pType->nMaximumScale));
- }
- }
- if ( _pType->aCreateParams.isEmpty() )
- {
- SetPrecision(_pType->nPrecision);
- SetScale(_pType->nMinimumScale);
- }
- if ( !_pType->bNullable && IsNullable() )
- SetIsNullable(ColumnValue::NO_NULLS);
- if ( !_pType->bAutoIncrement && IsAutoIncrement() )
- SetAutoIncrement(false);
- SetCurrency( _pType->bCurrency );
- SetType(_pType);
- SetTypeName(_pType->aTypeName);
+ }
+ }
+ if ( _pType->aCreateParams.isEmpty() )
+ {
+ SetPrecision(_pType->nPrecision);
+ SetScale(_pType->nMinimumScale);
}
+ if ( !_pType->bNullable && IsNullable() )
+ SetIsNullable(ColumnValue::NO_NULLS);
+ if ( !_pType->bAutoIncrement && IsAutoIncrement() )
+ SetAutoIncrement(false);
+ SetCurrency( _pType->bCurrency );
+ SetType(_pType);
+ SetTypeName(_pType->aTypeName);
}
void OFieldDescription::SetName(const OUString& _rName)
@@ -325,19 +325,19 @@ void OFieldDescription::SetAutoIncrementValue(const OUString& _sAutoIncValue)
void OFieldDescription::SetType(const TOTypeInfoSP& _pType)
{
m_pType = _pType;
- if ( m_pType.get() )
+ if ( !m_pType.get() )
+ return;
+
+ try
{
- try
- {
- if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPE) )
- m_xDest->setPropertyValue(PROPERTY_TYPE,makeAny(m_pType->nType));
- else
- m_nType = m_pType->nType;
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- }
+ if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPE) )
+ m_xDest->setPropertyValue(PROPERTY_TYPE,makeAny(m_pType->nType));
+ else
+ m_nType = m_pType->nType;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION("dbaccess");
}
}
@@ -618,26 +618,26 @@ void OFieldDescription::SetTypeName(const OUString& _sTypeName)
void OFieldDescription::copyColumnSettingsTo(const Reference< XPropertySet >& _rxColumn)
{
- if ( _rxColumn.is() )
- {
- Reference<XPropertySetInfo> xInfo = _rxColumn->getPropertySetInfo();
-
- if ( GetFormatKey() != NumberFormat::ALL && xInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
- _rxColumn->setPropertyValue(PROPERTY_FORMATKEY,makeAny(GetFormatKey()));
- if ( GetHorJustify() != SvxCellHorJustify::Standard && xInfo->hasPropertyByName(PROPERTY_ALIGN) )
- _rxColumn->setPropertyValue(PROPERTY_ALIGN,makeAny(dbaui::mapTextAllign(GetHorJustify())));
- if ( !GetHelpText().isEmpty() && xInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
- _rxColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(GetHelpText()));
- if ( GetControlDefault().hasValue() && xInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT) )
- _rxColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,GetControlDefault());
-
- if(xInfo->hasPropertyByName(PROPERTY_RELATIVEPOSITION))
- _rxColumn->setPropertyValue(PROPERTY_RELATIVEPOSITION,m_aRelativePosition);
- if(xInfo->hasPropertyByName(PROPERTY_WIDTH))
- _rxColumn->setPropertyValue(PROPERTY_WIDTH,m_aWidth);
- if(xInfo->hasPropertyByName(PROPERTY_HIDDEN))
- _rxColumn->setPropertyValue(PROPERTY_HIDDEN,makeAny(m_bHidden));
- }
+ if ( !_rxColumn.is() )
+ return;
+
+ Reference<XPropertySetInfo> xInfo = _rxColumn->getPropertySetInfo();
+
+ if ( GetFormatKey() != NumberFormat::ALL && xInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
+ _rxColumn->setPropertyValue(PROPERTY_FORMATKEY,makeAny(GetFormatKey()));
+ if ( GetHorJustify() != SvxCellHorJustify::Standard && xInfo->hasPropertyByName(PROPERTY_ALIGN) )
+ _rxColumn->setPropertyValue(PROPERTY_ALIGN,makeAny(dbaui::mapTextAllign(GetHorJustify())));
+ if ( !GetHelpText().isEmpty() && xInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
+ _rxColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(GetHelpText()));
+ if ( GetControlDefault().hasValue() && xInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT) )
+ _rxColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,GetControlDefault());
+
+ if(xInfo->hasPropertyByName(PROPERTY_RELATIVEPOSITION))
+ _rxColumn->setPropertyValue(PROPERTY_RELATIVEPOSITION,m_aRelativePosition);
+ if(xInfo->hasPropertyByName(PROPERTY_WIDTH))
+ _rxColumn->setPropertyValue(PROPERTY_WIDTH,m_aWidth);
+ if(xInfo->hasPropertyByName(PROPERTY_HIDDEN))
+ _rxColumn->setPropertyValue(PROPERTY_HIDDEN,makeAny(m_bHidden));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index 3e63f4c0c8d8..d5372574a61a 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -1334,40 +1334,40 @@ void OTableController::dropPrimaryKey()
void OTableController::assignTable()
{
// get the table
- if(!m_sName.isEmpty())
- {
- Reference<XNameAccess> xNameAccess;
- Reference<XTablesSupplier> xSup(getConnection(),UNO_QUERY);
- if(xSup.is())
- {
- xNameAccess = xSup->getTables();
- OSL_ENSURE(xNameAccess.is(),"no nameaccess for the queries!");
+ if(m_sName.isEmpty())
+ return;
- if(xNameAccess->hasByName(m_sName))
- {
- Reference<XPropertySet> xProp(xNameAccess->getByName(m_sName), css::uno::UNO_QUERY);
- if (xProp.is())
- {
- m_xTable = xProp;
- startTableListening();
+ Reference<XNameAccess> xNameAccess;
+ Reference<XTablesSupplier> xSup(getConnection(),UNO_QUERY);
+ if(!xSup.is())
+ return;
- // check if we set the table editable
- Reference<XDatabaseMetaData> xMeta = getConnection()->getMetaData();
- setEditable( xMeta.is() && !xMeta->isReadOnly() && (isAlterAllowed() || isDropAllowed() || isAddAllowed()) );
- if(!isEditable())
- {
- for( const auto& rTableRow : m_vRowList )
- {
- rTableRow->SetReadOnly();
- }
- }
- m_bNew = false;
- // be notified when the table is in disposing
- InvalidateAll();
- }
- }
+ xNameAccess = xSup->getTables();
+ OSL_ENSURE(xNameAccess.is(),"no nameaccess for the queries!");
+
+ if(!xNameAccess->hasByName(m_sName))
+ return;
+
+ Reference<XPropertySet> xProp(xNameAccess->getByName(m_sName), css::uno::UNO_QUERY);
+ if (!xProp.is())
+ return;
+
+ m_xTable = xProp;
+ startTableListening();
+
+ // check if we set the table editable
+ Reference<XDatabaseMetaData> xMeta = getConnection()->getMetaData();
+ setEditable( xMeta.is() && !xMeta->isReadOnly() && (isAlterAllowed() || isDropAllowed() || isAddAllowed()) );
+ if(!isEditable())
+ {
+ for( const auto& rTableRow : m_vRowList )
+ {
+ rTableRow->SetReadOnly();
}
}
+ m_bNew = false;
+ // be notified when the table is in disposing
+ InvalidateAll();
}
bool OTableController::isAddAllowed() const
diff --git a/dbaccess/source/ui/uno/ColumnControl.cxx b/dbaccess/source/ui/uno/ColumnControl.cxx
index 851773c78693..c1a1572f78a6 100644
--- a/dbaccess/source/ui/uno/ColumnControl.cxx
+++ b/dbaccess/source/ui/uno/ColumnControl.cxx
@@ -61,76 +61,76 @@ OUString OColumnControl::GetComponentServiceName()
void SAL_CALL OColumnControl::createPeer(const Reference< XToolkit >& /*rToolkit*/, const Reference< XWindowPeer >& rParentPeer)
{
::osl::ClearableMutexGuard aGuard( GetMutex() );
- if ( !getPeer().is() )
- {
- mbCreatingPeer = true;
+ if ( getPeer().is() )
+ return;
- vcl::Window* pParentWin = nullptr;
- if (rParentPeer.is())
- {
- VCLXWindow* pParent = comphelper::getUnoTunnelImplementation<VCLXWindow>(rParentPeer);
- if (pParent)
- pParentWin = pParent->GetWindow().get();
- }
+ mbCreatingPeer = true;
- OColumnPeer* pPeer = new OColumnPeer( pParentWin, m_xContext );
- OSL_ENSURE(pPeer != nullptr, "FmXGridControl::createPeer : imp_CreatePeer didn't return a peer !");
- setPeer( pPeer );
+ vcl::Window* pParentWin = nullptr;
+ if (rParentPeer.is())
+ {
+ VCLXWindow* pParent = comphelper::getUnoTunnelImplementation<VCLXWindow>(rParentPeer);
+ if (pParent)
+ pParentWin = pParent->GetWindow().get();
+ }
- UnoControlComponentInfos aComponentInfos(maComponentInfos);
- Reference< XGraphics > xGraphics( mxGraphics );
- Reference< XView > xV(getPeer(), UNO_QUERY);
- Reference< XWindow > xW(getPeer(), UNO_QUERY);
+ OColumnPeer* pPeer = new OColumnPeer( pParentWin, m_xContext );
+ OSL_ENSURE(pPeer != nullptr, "FmXGridControl::createPeer : imp_CreatePeer didn't return a peer !");
+ setPeer( pPeer );
- aGuard.clear();
+ UnoControlComponentInfos aComponentInfos(maComponentInfos);
+ Reference< XGraphics > xGraphics( mxGraphics );
+ Reference< XView > xV(getPeer(), UNO_QUERY);
+ Reference< XWindow > xW(getPeer(), UNO_QUERY);
- updateFromModel();
+ aGuard.clear();
- xV->setZoom( aComponentInfos.nZoomX, aComponentInfos.nZoomY );
- setPosSize( aComponentInfos.nX, aComponentInfos.nY, aComponentInfos.nWidth, aComponentInfos.nHeight, css::awt::PosSize::POSSIZE );
+ updateFromModel();
- Reference<XPropertySet> xProp(getModel(), UNO_QUERY);
- if ( xProp.is() )
- {
- Reference<XConnection> xCon(xProp->getPropertyValue(PROPERTY_ACTIVE_CONNECTION),UNO_QUERY);
- pPeer->setConnection(xCon);
- Reference<XPropertySet> xColumn(xProp->getPropertyValue(PROPERTY_COLUMN),UNO_QUERY);
- pPeer->setColumn(xColumn);
- sal_Int32 nWidth = 50;
- xProp->getPropertyValue(PROPERTY_EDIT_WIDTH) >>= nWidth;
- pPeer->setEditWidth(nWidth);
- }
+ xV->setZoom( aComponentInfos.nZoomX, aComponentInfos.nZoomY );
+ setPosSize( aComponentInfos.nX, aComponentInfos.nY, aComponentInfos.nWidth, aComponentInfos.nHeight, css::awt::PosSize::POSSIZE );
- if (aComponentInfos.bVisible)
- xW->setVisible(true);
+ Reference<XPropertySet> xProp(getModel(), UNO_QUERY);
+ if ( xProp.is() )
+ {
+ Reference<XConnection> xCon(xProp->getPropertyValue(PROPERTY_ACTIVE_CONNECTION),UNO_QUERY);
+ pPeer->setConnection(xCon);
+ Reference<XPropertySet> xColumn(xProp->getPropertyValue(PROPERTY_COLUMN),UNO_QUERY);
+ pPeer->setColumn(xColumn);
+ sal_Int32 nWidth = 50;
+ xProp->getPropertyValue(PROPERTY_EDIT_WIDTH) >>= nWidth;
+ pPeer->setEditWidth(nWidth);
+ }
- if (!aComponentInfos.bEnable)
- xW->setEnable(false);
+ if (aComponentInfos.bVisible)
+ xW->setVisible(true);
- if (maWindowListeners.getLength())
- xW->addWindowListener( &maWindowListeners );
+ if (!aComponentInfos.bEnable)
+ xW->setEnable(false);
- if (maFocusListeners.getLength())
- xW->addFocusListener( &maFocusListeners );
+ if (maWindowListeners.getLength())
+ xW->addWindowListener( &maWindowListeners );
- if (maKeyListeners.getLength())
- xW->addKeyListener( &maKeyListeners );
+ if (maFocusListeners.getLength())
+ xW->addFocusListener( &maFocusListeners );
- if (maMouseListeners.getLength())
- xW->addMouseListener( &maMouseListeners );
+ if (maKeyListeners.getLength())
+ xW->addKeyListener( &maKeyListeners );
- if (maMouseMotionListeners.getLength())
- xW->addMouseMotionListener( &maMouseMotionListeners );
+ if (maMouseListeners.getLength())
+ xW->addMouseListener( &maMouseListeners );
- if (maPaintListeners.getLength())
- xW->addPaintListener( &maPaintListeners );
+ if (maMouseMotionListeners.getLength())
+ xW->addMouseMotionListener( &maMouseMotionListeners );
- Reference< css::awt::XView > xPeerView(getPeer(), UNO_QUERY);
- xPeerView->setZoom( maComponentInfos.nZoomX, maComponentInfos.nZoomY );
- xPeerView->setGraphics( xGraphics );
+ if (maPaintListeners.getLength())
+ xW->addPaintListener( &maPaintListeners );
- mbCreatingPeer = false;
- }
+ Reference< css::awt::XView > xPeerView(getPeer(), UNO_QUERY);
+ xPeerView->setZoom( maComponentInfos.nZoomX, maComponentInfos.nZoomY );
+ xPeerView->setGraphics( xGraphics );
+
+ mbCreatingPeer = false;
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/uno/ColumnPeer.cxx b/dbaccess/source/ui/uno/ColumnPeer.cxx
index c3c564ad73cc..008d8f7e37a1 100644
--- a/dbaccess/source/ui/uno/ColumnPeer.cxx
+++ b/dbaccess/source/ui/uno/ColumnPeer.cxx
@@ -57,47 +57,47 @@ void OColumnPeer::setColumn(const Reference< XPropertySet>& _xColumn)
SolarMutexGuard aGuard;
VclPtr<OColumnControlWindow> pFieldControl = GetAs<OColumnControlWindow>();
- if ( pFieldControl )
+ if ( !pFieldControl )
+ return;
+
+ if ( m_pActFieldDescr )
+ {
+ delete m_pActFieldDescr;
+ m_pActFieldDescr = nullptr;
+ }
+ if ( _xColumn.is() )
{
- if ( m_pActFieldDescr )
+ sal_Int32 nType = 0;
+ sal_Int32 nScale = 0;
+ sal_Int32 nPrecision = 0;
+ bool bAutoIncrement = false;
+ OUString sTypeName;
+
+ try
{
- delete m_pActFieldDescr;
- m_pActFieldDescr = nullptr;
+ // get the properties from the column
+ _xColumn->getPropertyValue(PROPERTY_TYPENAME) >>= sTypeName;
+ _xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType;
+ _xColumn->getPropertyValue(PROPERTY_SCALE) >>= nScale;
+ _xColumn->getPropertyValue(PROPERTY_PRECISION) >>= nPrecision;
+ _xColumn->getPropertyValue(PROPERTY_ISAUTOINCREMENT) >>= bAutoIncrement;
}
- if ( _xColumn.is() )
+ catch(const Exception&)
{
- sal_Int32 nType = 0;
- sal_Int32 nScale = 0;
- sal_Int32 nPrecision = 0;
- bool bAutoIncrement = false;
- OUString sTypeName;
-
- try
- {
- // get the properties from the column
- _xColumn->getPropertyValue(PROPERTY_TYPENAME) >>= sTypeName;
- _xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType;
- _xColumn->getPropertyValue(PROPERTY_SCALE) >>= nScale;
- _xColumn->getPropertyValue(PROPERTY_PRECISION) >>= nPrecision;
- _xColumn->getPropertyValue(PROPERTY_ISAUTOINCREMENT) >>= bAutoIncrement;
- }
- catch(const Exception&)
- {
- }
-
- m_pActFieldDescr = new OFieldDescription(_xColumn,true);
- // search for type
- OUString const sCreateParam("x");
- bool bForce;
- TOTypeInfoSP pTypeInfo = ::dbaui::getTypeInfoFromType(*pFieldControl->getTypeInfo(),nType,sTypeName,sCreateParam,nPrecision,nScale,bAutoIncrement,bForce);
- if ( !pTypeInfo.get() )
- pTypeInfo = pFieldControl->getDefaultTyp();
-
- m_pActFieldDescr->FillFromTypeInfo(pTypeInfo,true,false);
- m_xColumn = _xColumn;
}
- pFieldControl->DisplayData(m_pActFieldDescr);
+
+ m_pActFieldDescr = new OFieldDescription(_xColumn,true);
+ // search for type
+ OUString const sCreateParam("x");
+ bool bForce;
+ TOTypeInfoSP pTypeInfo = ::dbaui::getTypeInfoFromType(*pFieldControl->getTypeInfo(),nType,sTypeName,sCreateParam,nPrecision,nScale,bAutoIncrement,bForce);
+ if ( !pTypeInfo.get() )
+ pTypeInfo = pFieldControl->getDefaultTyp();
+
+ m_pActFieldDescr->FillFromTypeInfo(pTypeInfo,true,false);
+ m_xColumn = _xColumn;
}
+ pFieldControl->DisplayData(m_pActFieldDescr);
}
void OColumnPeer::setConnection(const Reference< XConnection>& _xCon)