summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/relationdesign
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/source/ui/relationdesign
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/source/ui/relationdesign')
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnectionData.cxx32
-rw-r--r--dbaccess/source/ui/relationdesign/RelationController.cxx108
2 files changed, 70 insertions, 70 deletions
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();
}
}
}