summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-23 11:36:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-23 12:42:19 +0200
commit7bed47db29783677aa69aa2a54ab1f6ca8e810f6 (patch)
tree698729ab62d8fb827541d2309d17bb2b4e7a3d6b /dbaccess
parentff93e4977cb1e23f355d248a77e8d0e56bb0f4b9 (diff)
loplugin:makeshared in dbaccess
Change-Id: If4208532d2905410a07b846afee46fba2fe1e549 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92748 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/inc/JoinTableView.hxx2
-rw-r--r--dbaccess/source/ui/inc/QueryTableView.hxx2
-rw-r--r--dbaccess/source/ui/querydesign/JoinTableView.cxx4
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx21
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx26
-rw-r--r--dbaccess/source/ui/relationdesign/RelationController.cxx12
6 files changed, 32 insertions, 35 deletions
diff --git a/dbaccess/source/ui/inc/JoinTableView.hxx b/dbaccess/source/ui/inc/JoinTableView.hxx
index 4134ebca023f..413cccf32e7d 100644
--- a/dbaccess/source/ui/inc/JoinTableView.hxx
+++ b/dbaccess/source/ui/inc/JoinTableView.hxx
@@ -280,7 +280,7 @@ namespace dbaui
/// resizing) is used, as no scrolling can take place while resizing
virtual void Command(const CommandEvent& rEvt) override;
- virtual OTableWindowData* CreateImpl(const OUString& _rComposedName
+ virtual std::shared_ptr<OTableWindowData> CreateImpl(const OUString& _rComposedName
,const OUString& _sTableName
,const OUString& _rWinName);
diff --git a/dbaccess/source/ui/inc/QueryTableView.hxx b/dbaccess/source/ui/inc/QueryTableView.hxx
index cdcad0e168b0..e1c442704040 100644
--- a/dbaccess/source/ui/inc/QueryTableView.hxx
+++ b/dbaccess/source/ui/inc/QueryTableView.hxx
@@ -102,7 +102,7 @@ namespace dbaui
bool ExistsAVisitedConn(const OQueryTableWindow* pFrom) const;
- virtual OTableWindowData* CreateImpl(const OUString& _rComposedName
+ virtual std::shared_ptr<OTableWindowData> CreateImpl(const OUString& _rComposedName
,const OUString& _sTableName
,const OUString& _rWinName) override;
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 193a1ba51ac5..02562bf49a5d 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -306,11 +306,11 @@ TTableWindowData::value_type OJoinTableView::createTableWindowData(const OUStrin
return pData;
}
-OTableWindowData* OJoinTableView::CreateImpl(const OUString& _rComposedName
+std::shared_ptr<OTableWindowData> OJoinTableView::CreateImpl(const OUString& _rComposedName
,const OUString& _sTableName
,const OUString& _rWinName)
{
- return new OTableWindowData( nullptr,_rComposedName,_sTableName, _rWinName );
+ return std::make_shared<OTableWindowData>( nullptr,_rComposedName,_sTableName, _rWinName );
}
void OJoinTableView::AddTabWin(const OUString& _rComposedName, const OUString& rWinName, bool /*bNewTable*/)
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 748eabb13f55..1ba9ca585e5d 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -132,25 +132,24 @@ namespace
if ( !pConn )
{
- OQueryTableConnectionData* pInfoData = new OQueryTableConnectionData();
- TTableConnectionData::value_type aInfoData(pInfoData);
- pInfoData->InitFromDrag(_aDragLeft, _aDragRight);
- pInfoData->SetJoinType(_eJoinType);
+ auto xInfoData = std::make_shared<OQueryTableConnectionData>();
+ xInfoData->InitFromDrag(_aDragLeft, _aDragRight);
+ xInfoData->SetJoinType(_eJoinType);
if ( _bNatural )
{
- aInfoData->ResetConnLines();
- pInfoData->setNatural(_bNatural);
+ xInfoData->ResetConnLines();
+ xInfoData->setNatural(_bNatural);
try
{
- Reference<XNameAccess> xReferencedTableColumns(aInfoData->getReferencedTable()->getColumns());
- Sequence< OUString> aSeq = aInfoData->getReferencingTable()->getColumns()->getElementNames();
+ Reference<XNameAccess> xReferencedTableColumns(xInfoData->getReferencedTable()->getColumns());
+ Sequence< OUString> aSeq = xInfoData->getReferencingTable()->getColumns()->getElementNames();
const OUString* pIter = aSeq.getConstArray();
const OUString* pEnd = pIter + aSeq.getLength();
for(;pIter != pEnd;++pIter)
{
if ( xReferencedTableColumns->hasByName(*pIter) )
- aInfoData->AppendConnLine(*pIter,*pIter);
+ xInfoData->AppendConnLine(*pIter,*pIter);
}
}
catch( const Exception& )
@@ -159,9 +158,9 @@ namespace
}
}
- ScopedVclPtrInstance< OQueryTableConnection > aInfo(pTableView, aInfoData);
+ ScopedVclPtrInstance< OQueryTableConnection > aInfo(pTableView, xInfoData);
// Because OQueryTableConnection never takes ownership of the data passed to it, but only remembers the pointer,
- // this pointer to a local variable is not critical, as aInfoData and aInfo have the same lifetime
+ // this pointer to a local variable is not critical, as xInfoData and aInfo have the same lifetime
pTableView->NotifyTabConnection( *aInfo );
}
else
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 67d2c8e3df31..79534d2f1ae7 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -130,8 +130,7 @@ namespace
// we found a table in our view where we can insert some connections
// the key columns have a property called RelatedColumn
// build OQueryTableConnectionData
- OQueryTableConnectionData* pNewConnData = new OQueryTableConnectionData( _rSource.GetData(), _rDest.GetData() );
- TTableConnectionData::value_type aNewConnData(pNewConnData);
+ auto xNewConnData = std::make_shared<OQueryTableConnectionData>( _rSource.GetData(), _rDest.GetData() );
OUString sRelatedColumn;
@@ -151,7 +150,7 @@ namespace
{
sal_Int32 nFindIndex = ::comphelper::findValue(_rSource.GetOriginalColumns()->getElementNames(),rElement);
if(nFindIndex != -1)
- pNewConnData->SetFieldIndex(JTCS_FROM,nFindIndex+1);
+ xNewConnData->SetFieldIndex(JTCS_FROM,nFindIndex+1);
else
OSL_FAIL("Column not found!");
}
@@ -161,14 +160,14 @@ namespace
{
sal_Int32 nFindIndex = ::comphelper::findValue(xRefColumns->getElementNames(),sRelatedColumn);
if(nFindIndex != -1)
- pNewConnData->SetFieldIndex(JTCS_TO,nFindIndex+1);
+ xNewConnData->SetFieldIndex(JTCS_TO,nFindIndex+1);
else
OSL_FAIL("Column not found!");
}
- pNewConnData->AppendConnLine(rElement,sRelatedColumn);
+ xNewConnData->AppendConnLine(rElement,sRelatedColumn);
// now add the Conn itself
- ScopedVclPtrInstance< OQueryTableConnection > aNewConn(_pView, aNewConnData);
+ ScopedVclPtrInstance< OQueryTableConnection > aNewConn(_pView, xNewConnData);
// referring to the local variable is not important, as NotifyQueryTabConn creates a new copy
// to add me (if not existent)
_pView->NotifyTabConnection(*aNewConn, false);
@@ -320,11 +319,11 @@ void OQueryTableView::NotifyTabConnection(const OQueryTableConnection& rNewConn,
}
}
-OTableWindowData* OQueryTableView::CreateImpl(const OUString& _rComposedName
+std::shared_ptr<OTableWindowData> OQueryTableView::CreateImpl(const OUString& _rComposedName
,const OUString& _sTableName
,const OUString& _rWinName)
{
- return new OQueryTableWindowData( _rComposedName, _sTableName,_rWinName );
+ return std::make_shared<OQueryTableWindowData>( _rComposedName, _sTableName,_rWinName );
}
void OQueryTableView::AddTabWin(const OUString& _rTableName, const OUString& _rAliasName, bool bNewTable)
@@ -543,8 +542,7 @@ void OQueryTableView::AddConnection(const OJoinExchangeData& jxdSource, const OJ
if ( !pConn )
{
// new data object
- OQueryTableConnectionData* pNewConnectionData = new OQueryTableConnectionData(pSourceWin->GetData(), pDestWin->GetData());
- TTableConnectionData::value_type aNewConnectionData(pNewConnectionData);
+ auto xNewConnectionData = std::make_shared<OQueryTableConnectionData>(pSourceWin->GetData(), pDestWin->GetData());
sal_uInt32 nSourceFieldIndex, nDestFieldIndex;
@@ -555,12 +553,12 @@ void OQueryTableView::AddConnection(const OJoinExchangeData& jxdSource, const OJ
nDestFieldIndex = jxdDest.pListBox->GetModel()->GetAbsPos(jxdDest.pEntry);
// ... and set them
- pNewConnectionData->SetFieldIndex(JTCS_FROM, nSourceFieldIndex);
- pNewConnectionData->SetFieldIndex(JTCS_TO, nDestFieldIndex);
+ xNewConnectionData->SetFieldIndex(JTCS_FROM, nSourceFieldIndex);
+ xNewConnectionData->SetFieldIndex(JTCS_TO, nDestFieldIndex);
- pNewConnectionData->AppendConnLine( aSourceFieldName,aDestFieldName );
+ xNewConnectionData->AppendConnLine( aSourceFieldName,aDestFieldName );
- ScopedVclPtrInstance< OQueryTableConnection > aNewConnection(this, aNewConnectionData);
+ ScopedVclPtrInstance< OQueryTableConnection > aNewConnection(this, xNewConnectionData);
NotifyTabConnection(*aNewConnection);
// As usual with NotifyTabConnection, using a local variable is fine because a copy is made
}
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx
index 788acc9108b8..9f340e89cdd6 100644
--- a/dbaccess/source/ui/relationdesign/RelationController.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -398,8 +398,8 @@ namespace
OUString sKeyName;
xKey->getPropertyValue(PROPERTY_NAME) >>= sKeyName;
// insert connection
- ORelationTableConnectionData* pTabConnData = new ORelationTableConnectionData( pReferencingTable, pReferencedTable, sKeyName );
- m_vTableConnectionData.push_back(TTableConnectionData::value_type(pTabConnData));
+ auto xTabConnData = std::make_shared<ORelationTableConnectionData>( pReferencingTable, pReferencedTable, sKeyName );
+ m_vTableConnectionData.push_back(xTabConnData);
// insert columns
const Reference<XColumnsSupplier> xColsSup(xKey,UNO_QUERY);
OSL_ENSURE(xColsSup.is(),"Key is no XColumnsSupplier!");
@@ -415,7 +415,7 @@ namespace
xPropSet->getPropertyValue(PROPERTY_NAME) >>= sColumnName;
xPropSet->getPropertyValue(PROPERTY_RELATEDCOLUMN) >>= sRelatedName;
}
- pTabConnData->SetConnLine( j, sColumnName, sRelatedName );
+ xTabConnData->SetConnLine( j, sColumnName, sRelatedName );
}
// set update/del flags
sal_Int32 nUpdateRule = 0;
@@ -423,11 +423,11 @@ namespace
xKey->getPropertyValue(PROPERTY_UPDATERULE) >>= nUpdateRule;
xKey->getPropertyValue(PROPERTY_DELETERULE) >>= nDeleteRule;
- pTabConnData->SetUpdateRules( nUpdateRule );
- pTabConnData->SetDeleteRules( nDeleteRule );
+ xTabConnData->SetUpdateRules( nUpdateRule );
+ xTabConnData->SetDeleteRules( nDeleteRule );
// set cardinality
- pTabConnData->SetCardinality();
+ xTabConnData->SetCardinality();
}
}
}