summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/querydesign
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui/querydesign')
-rw-r--r--dbaccess/source/ui/querydesign/JoinTableView.cxx57
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx34
2 files changed, 46 insertions, 45 deletions
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 4dd4fff2268d..d12eca785cad 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -242,29 +242,26 @@ sal_uLong OJoinTableView::GetTabWinCount()
return m_aTableMap.size();
}
-bool OJoinTableView::RemoveConnection( OTableConnection* _pConn, bool _bDelete )
+bool OJoinTableView::RemoveConnection(VclPtr<OTableConnection>& rConn, bool _bDelete)
{
- DeselectConn(_pConn);
+ VclPtr<OTableConnection> xConn(rConn);
+
+ DeselectConn(xConn);
// to force a redraw
- _pConn->InvalidateConnection();
+ xConn->InvalidateConnection();
- m_pView->getController().removeConnectionData( _pConn->GetData() );
+ m_pView->getController().removeConnectionData(xConn->GetData());
- auto it = ::std::find(m_vTableConnection.begin(),m_vTableConnection.end(),_pConn);
- if (it != m_vTableConnection.end())
- {
- it->disposeAndClear();
- m_vTableConnection.erase( it );
- }
+ m_vTableConnection.erase(std::find(m_vTableConnection.begin(), m_vTableConnection.end(), xConn));
modified();
if ( m_pAccessible )
m_pAccessible->notifyAccessibleEvent( AccessibleEventId::CHILD,
- makeAny(_pConn->GetAccessible()),
+ makeAny(xConn->GetAccessible()),
Any());
- if ( _bDelete )
- _pConn->disposeOnce();
+ if (_bDelete)
+ xConn->disposeOnce();
return true;
}
@@ -359,14 +356,14 @@ void OJoinTableView::RemoveTabWin( OTableWindow* pTabWin )
auto aIter = m_vTableConnection.rbegin();
while(aIter != m_vTableConnection.rend() && bRemove)
{
- OTableConnection* pTabConn = (*aIter);
- if(
- ( pData == pTabConn->GetData()->getReferencingTable()) ||
- ( pData == pTabConn->GetData()->getReferencedTable())
- )
+ VclPtr<OTableConnection>& rTabConn = (*aIter);
+ if (
+ (pData == rTabConn->GetData()->getReferencingTable()) ||
+ (pData == rTabConn->GetData()->getReferencedTable())
+ )
{
- bRemove = RemoveConnection( pTabConn ,true);
- aIter = m_vTableConnection.rbegin();
+ bRemove = RemoveConnection(rTabConn, true);
+ aIter = m_vTableConnection.rbegin();
}
else
++aIter;
@@ -812,7 +809,7 @@ void OJoinTableView::Tracking( const TrackingEvent& rTEvt )
}
}
-void OJoinTableView::ConnDoubleClicked( OTableConnection* /*pConnection*/ )
+void OJoinTableView::ConnDoubleClicked(VclPtr<OTableConnection>& /*rConnection*/)
{
}
@@ -857,7 +854,7 @@ void OJoinTableView::KeyInput( const KeyEvent& rEvt )
if( !bCtrl && !bShift && (nCode==KEY_DELETE) )
{
if (GetSelectedConn())
- RemoveConnection( GetSelectedConn() ,true);
+ RemoveConnection(GetSelectedConn(), true);
}
else
Window::KeyInput( rEvt );
@@ -1129,16 +1126,16 @@ bool OJoinTableView::IsAddAllowed()
return true;
}
-void OJoinTableView::executePopup(const Point& _aPos,OTableConnection* _pSelConnection)
+void OJoinTableView::executePopup(const Point& _aPos, VclPtr<OTableConnection>& rSelConnection)
{
PopupMenu aContextMenu( ModuleRes( RID_MENU_JOINVIEW_CONNECTION ) );
switch (aContextMenu.Execute(this, _aPos))
{
case SID_DELETE:
- RemoveConnection( _pSelConnection ,true);
+ RemoveConnection(rSelConnection, true);
break;
case ID_QUERY_EDIT_JOINCONNECTION:
- ConnDoubleClicked( _pSelConnection ); // is the same as double clicked
+ ConnDoubleClicked(rSelConnection); // is the same as double clicked
break;
}
}
@@ -1155,21 +1152,21 @@ void OJoinTableView::Command(const CommandEvent& rEvt)
if( m_vTableConnection.empty() )
return;
- OTableConnection* pSelConnection = GetSelectedConn();
+ VclPtr<OTableConnection>& rSelConnection = GetSelectedConn();
// when it wasn't a mouse event use the selected connection
if (!rEvt.IsMouseEvent())
{
- if( pSelConnection )
+ if (rSelConnection)
{
- const ::std::vector<OConnectionLine*>& rLines = pSelConnection->GetConnLineList();
+ const ::std::vector<OConnectionLine*>& rLines = rSelConnection->GetConnLineList();
::std::vector<OConnectionLine*>::const_iterator aIter = ::std::find_if(rLines.begin(), rLines.end(),::std::mem_fun(&OConnectionLine::IsValid));
if( aIter != rLines.end() )
- executePopup((*aIter)->getMidPoint(),pSelConnection);
+ executePopup((*aIter)->getMidPoint(), rSelConnection);
}
}
else
{
- DeselectConn(pSelConnection);
+ DeselectConn(rSelConnection);
const Point& aMousePos = rEvt.GetMousePosPixel();
auto aIter = m_vTableConnection.begin();
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 8a36b91642b4..67bd063ec99d 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -635,12 +635,12 @@ void OQueryTableView::AddConnection(const OJoinExchangeData& jxdSource, const OJ
}
}
-void OQueryTableView::ConnDoubleClicked(OTableConnection* pConnection)
+void OQueryTableView::ConnDoubleClicked(VclPtr<OTableConnection>& rConnection)
{
- if( openJoinDialog(this,pConnection->GetData(),false) )
+ if (openJoinDialog(this, rConnection->GetData(), false))
{
- connectionModified(this,pConnection,false);
- SelectConn( pConnection );
+ connectionModified(this, rConnection, false);
+ SelectConn(rConnection);
}
}
@@ -673,17 +673,19 @@ void OQueryTableView::createNewConnection()
}
}
-bool OQueryTableView::RemoveConnection( OTableConnection* _pConnection,bool /*_bDelete*/ )
+bool OQueryTableView::RemoveConnection(VclPtr<OTableConnection>& rConnection, bool /*_bDelete*/)
{
+ VclPtr<OQueryTableConnection> xConnection(static_cast<OQueryTableConnection*>(rConnection.get()));
// we don't want that our connection will be deleted, we put it in the undo manager
- bool bRet = OJoinTableView::RemoveConnection( _pConnection,false);
+ bool bRet = OJoinTableView::RemoveConnection(rConnection, false);
// add undo action
- addUndoAction( this,
- new OQueryDelTabConnUndoAction(this),
- static_cast< OQueryTableConnection*>(_pConnection),
- true);
+ addUndoAction(this,
+ new OQueryDelTabConnUndoAction(this),
+ xConnection.get(),
+ true);
+
return bRet;
}
@@ -782,11 +784,12 @@ void OQueryTableView::GetConnection(OQueryTableConnection* pConn)
addConnection( pConn );
}
-void OQueryTableView::DropConnection(OQueryTableConnection* pConn)
+void OQueryTableView::DropConnection(VclPtr<OQueryTableConnection>& rConn)
{
// Pay attention to the selection
// remove from me and the document
- RemoveConnection( pConn ,false);
+ VclPtr<OTableConnection> xConn(rConn.get());
+ RemoveConnection(xConn, false);
}
void OQueryTableView::HideTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction )
@@ -826,17 +829,18 @@ void OQueryTableView::HideTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAc
auto aIter2 = rTabConList.begin();
for(;aIter2 != rTabConList.end();)// the end may change
{
- OQueryTableConnection* pTmpEntry = static_cast<OQueryTableConnection*>((*aIter2).get());
+ VclPtr<OTableConnection> xTmpEntry = *aIter2;
+ OQueryTableConnection* pTmpEntry = static_cast<OQueryTableConnection*>(xTmpEntry.get());
OSL_ENSURE(pTmpEntry,"OQueryTableConnection is null!");
if( pTmpEntry->GetAliasName(JTCS_FROM) == pTabWin->GetAliasName() ||
pTmpEntry->GetAliasName(JTCS_TO) == pTabWin->GetAliasName() )
{
// add to undo list
- pUndoAction->InsertConnection(pTmpEntry);
+ pUndoAction->InsertConnection(xTmpEntry);
// call base class because we append an undo action
// but this time we are in a undo action list
- OJoinTableView::RemoveConnection(pTmpEntry,false);
+ OJoinTableView::RemoveConnection(xTmpEntry, false);
aIter2 = rTabConList.begin();
++nCnt;
}