diff options
Diffstat (limited to 'dbaccess/source/ui/querydesign')
29 files changed, 154 insertions, 160 deletions
diff --git a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx index 2b6b3a42db34..af7ef4ec89a0 100644 --- a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx +++ b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx @@ -82,10 +82,10 @@ namespace dbaui { // search the position of our table window in the table window map nIndex = m_pLine->GetParent()->GetTabWinMap().size(); - const ::std::vector<OTableConnection*>& rVec = m_pLine->GetParent()->getTableConnections(); - ::std::vector<OTableConnection*>::const_iterator aIter = rVec.begin(); - ::std::vector<OTableConnection*>::const_iterator aEnd = rVec.end(); - for (; aIter != aEnd && (*aIter) != m_pLine; ++nIndex,++aIter) + const auto& rVec = m_pLine->GetParent()->getTableConnections(); + auto aIter = rVec.begin(); + auto aEnd = rVec.end(); + for (; aIter != aEnd && (*aIter).get() != m_pLine; ++nIndex,++aIter) ; nIndex = ( aIter != aEnd ) ? nIndex : -1; } @@ -186,6 +186,7 @@ namespace dbaui { // clear vector clearLineData(); + m_pParent.clear(); vcl::Window::dispose(); } bool OConnectionLineAccess::isEditable() const diff --git a/dbaccess/source/ui/querydesign/JoinController.cxx b/dbaccess/source/ui/querydesign/JoinController.cxx index 9e192e66b3ab..9aab0ceccfbf 100644 --- a/dbaccess/source/ui/querydesign/JoinController.cxx +++ b/dbaccess/source/ui/querydesign/JoinController.cxx @@ -225,7 +225,7 @@ FeatureState OJoinController::GetState(sal_uInt16 _nId) const case ID_BROWSER_ADDTABLE: aReturn.bEnabled = ( getView() != NULL ) && const_cast< OJoinController* >( this )->getJoinView()->getTableView()->IsAddAllowed(); - aReturn.bChecked = aReturn.bEnabled && m_pAddTableDialog != NULL && m_pAddTableDialog->IsVisible() ; + aReturn.bChecked = aReturn.bEnabled && m_pAddTableDialog != nullptr && m_pAddTableDialog->IsVisible() ; if ( aReturn.bEnabled ) aReturn.sTitle = OAddTableDlg::getDialogTitleForContext( impl_getDialogContext() ); break; diff --git a/dbaccess/source/ui/querydesign/JoinDesignView.cxx b/dbaccess/source/ui/querydesign/JoinDesignView.cxx index 58399a08f0e8..de5b30488a57 100644 --- a/dbaccess/source/ui/querydesign/JoinDesignView.cxx +++ b/dbaccess/source/ui/querydesign/JoinDesignView.cxx @@ -66,10 +66,8 @@ OJoinDesignView::~OJoinDesignView() void OJoinDesignView::dispose() { - boost::scoped_ptr<vcl::Window> aT3(m_pScrollWindow); - m_pScrollWindow = NULL; - boost::scoped_ptr<vcl::Window> aT2(m_pTableView); - m_pTableView = NULL; + m_pScrollWindow.clear(); + m_pTableView.clear(); ODataView::dispose(); } diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx index be2b0e0bde1e..ad15132b72ef 100644 --- a/dbaccess/source/ui/querydesign/JoinTableView.cxx +++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx @@ -94,11 +94,10 @@ OScrollWindowHelper::~OScrollWindowHelper() void OScrollWindowHelper::dispose() { - boost::scoped_ptr<vcl::Window> aTemp(m_pCornerWindow); - m_pCornerWindow = NULL; - m_pTableView = NULL; m_aHScrollBar.disposeAndClear(); m_aVScrollBar.disposeAndClear(); + m_pCornerWindow.clear(); + m_pTableView.clear(); vcl::Window::dispose(); } @@ -194,6 +193,11 @@ void OJoinTableView::dispose() } // delete lists clearLayoutInformation(); + m_pDragWin.clear(); + m_pSizingWin.clear(); + m_pSelectedConn.clear(); + m_pLastFocusTabWin.clear(); + m_pView.clear(); vcl::Window::dispose(); } @@ -271,7 +275,7 @@ OTableWindow* OJoinTableView::GetTabWindow( const OUString& rName ) { OTableWindowMap::iterator aIter = m_aTableMap.find(rName); - return aIter == m_aTableMap.end() ? NULL : aIter->second; + return aIter == m_aTableMap.end() ? nullptr : aIter->second; } TTableWindowData::value_type OJoinTableView::createTableWindowData(const OUString& _rComposedName @@ -354,7 +358,7 @@ void OJoinTableView::RemoveTabWin( OTableWindow* pTabWin ) bool bRemove = true; TTableWindowData::value_type pData = pTabWin->GetData(); sal_Int32 nCount = m_vTableConnection.size(); - ::std::vector<OTableConnection*>::reverse_iterator aIter = m_vTableConnection.rbegin(); + auto aIter = m_vTableConnection.rbegin(); while(aIter != m_vTableConnection.rend() && bRemove) { OTableConnection* pTabConn = (*aIter); @@ -828,8 +832,8 @@ void OJoinTableView::MouseButtonUp( const MouseEvent& rEvt ) { DeselectConn(GetSelectedConn()); - ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin(); - ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end(); + auto aIter = m_vTableConnection.begin(); + auto aEnd = m_vTableConnection.end(); for(;aIter != aEnd;++aIter) { if( (*aIter)->CheckHit(rEvt.GetPosPixel()) ) @@ -941,20 +945,21 @@ void OJoinTableView::Paint( const Rectangle& rRect ) void OJoinTableView::InvalidateConnections() { // draw Joins - ::std::for_each(m_vTableConnection.begin(),m_vTableConnection.end(), - ::std::mem_fun(& OTableConnection::InvalidateConnection)); + for(auto & conn : m_vTableConnection) + conn->InvalidateConnection(); } void OJoinTableView::DrawConnections( const Rectangle& rRect ) { // draw Joins - ::std::for_each(m_vTableConnection.begin(),m_vTableConnection.end(),boost::bind( &OTableConnection::Draw, _1, boost::cref( rRect ))); + for(auto conn : m_vTableConnection) + conn->Draw(rRect); // finally redraw the selected one above all others if (GetSelectedConn()) GetSelectedConn()->Draw( rRect ); } -::std::vector<OTableConnection*>::const_iterator OJoinTableView::getTableConnections(const OTableWindow* _pFromWin) const +::std::vector<VclPtr<OTableConnection> >::const_iterator OJoinTableView::getTableConnections(const OTableWindow* _pFromWin) const { return ::std::find_if( m_vTableConnection.begin(), m_vTableConnection.end(), @@ -980,8 +985,8 @@ void OJoinTableView::ClearAll() HideTabWins(); // and the same with the Connections - ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin(); - ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end(); + auto aIter = m_vTableConnection.begin(); + auto aEnd = m_vTableConnection.end(); for(;aIter != aEnd;++aIter) RemoveConnection( *aIter ,true); m_vTableConnection.clear(); @@ -997,7 +1002,7 @@ void OJoinTableView::ClearAll() bool OJoinTableView::ScrollWhileDragging() { - OSL_ENSURE(m_pDragWin != NULL, "OJoinTableView::ScrollWhileDragging must not be called when a window is being dragged !"); + OSL_ENSURE(m_pDragWin != nullptr, "OJoinTableView::ScrollWhileDragging must not be called when a window is being dragged !"); // kill the timer if (m_aDragScrollIdle.IsActive()) @@ -1169,8 +1174,8 @@ void OJoinTableView::Command(const CommandEvent& rEvt) DeselectConn(pSelConnection); const Point& aMousePos = rEvt.GetMousePosPixel(); - ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin(); - ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end(); + auto aIter = m_vTableConnection.begin(); + auto aEnd = m_vTableConnection.end(); for(;aIter != aEnd;++aIter) { if( (*aIter)->CheckHit(aMousePos) ) @@ -1199,8 +1204,8 @@ OTableConnection* OJoinTableView::GetTabConn(const OTableWindow* pLhs,const OTab { bool bFoundStart = _rpFirstAfter ? sal_False : sal_True; - ::std::vector<OTableConnection*>::const_iterator aIter = m_vTableConnection.begin(); - ::std::vector<OTableConnection*>::const_iterator aEnd = m_vTableConnection.end(); + auto aIter = m_vTableConnection.begin(); + auto aEnd = m_vTableConnection.end(); for(;aIter != aEnd;++aIter) { OTableConnection* pData = *aIter; @@ -1332,12 +1337,12 @@ bool OJoinTableView::PreNotify(NotifyEvent& rNEvt) { // no active tab win -> travel the connections // find the currently selected conn within the conn list sal_Int32 i(0); - for ( ::std::vector<OTableConnection*>::iterator connectionIter = m_vTableConnection.begin(); + for ( auto connectionIter = m_vTableConnection.begin(); connectionIter != m_vTableConnection.end(); ++connectionIter, ++i ) { - if ( (*connectionIter) == GetSelectedConn() ) + if ( (*connectionIter).get() == GetSelectedConn() ) break; } if (i == sal_Int32(m_vTableConnection.size() - 1) && bForward) @@ -1531,11 +1536,6 @@ void OJoinTableView::clearLayoutInformation() m_aTableMap.clear(); - ::std::vector<OTableConnection*>::const_iterator aIter2 = m_vTableConnection.begin(); - ::std::vector<OTableConnection*>::const_iterator aEnd2 = m_vTableConnection.end(); - for(;aIter2 != aEnd2;++aIter2) - delete *aIter2; - m_vTableConnection.clear(); } diff --git a/dbaccess/source/ui/querydesign/QTableWindow.cxx b/dbaccess/source/ui/querydesign/QTableWindow.cxx index e12ad2990e59..607552ff2389 100644 --- a/dbaccess/source/ui/querydesign/QTableWindow.cxx +++ b/dbaccess/source/ui/querydesign/QTableWindow.cxx @@ -144,7 +144,7 @@ void OQueryTableWindow::OnEntryDoubleClicked(SvTreeListEntry* pEntry) bool OQueryTableWindow::ExistsField(const OUString& strFieldName, OTableFieldDescRef& rInfo) { - OSL_ENSURE(m_pListBox != NULL, "OQueryTableWindow::ExistsField : doesn't have ::com::sun::star::form::ListBox !"); + OSL_ENSURE(m_pListBox != nullptr, "OQueryTableWindow::ExistsField : doesn't have ::com::sun::star::form::ListBox !"); OSL_ENSURE(rInfo.is(),"OQueryTableWindow::ExistsField: invalid argument for OTableFieldDescRef!"); Reference< XConnection> xConnection = getTableView()->getDesignView()->getController().getConnection(); bool bExists = false; diff --git a/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx index 61c7507d63f8..a009832b5624 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx +++ b/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx @@ -30,7 +30,7 @@ namespace dbaui class OQueryDesignFieldUndoAct : public OCommentUndoAction { protected: - OSelectionBrowseBox* pOwner; + VclPtr<OSelectionBrowseBox> pOwner; sal_uInt16 m_nColumnPostion; virtual void Undo() SAL_OVERRIDE = 0; diff --git a/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx b/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx index d74ce27e9fc7..9166a2e782c4 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx +++ b/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx @@ -20,6 +20,7 @@ #define INCLUDED_DBACCESS_SOURCE_UI_QUERYDESIGN_QUERYDESIGNUNDOACTION_HXX #include "GeneralUndo.hxx" +#include <vcl/vclptr.hxx> namespace dbaui { @@ -28,7 +29,7 @@ namespace dbaui class OQueryDesignUndoAction : public OCommentUndoAction { protected: - OJoinTableView* m_pOwner; // in this container it all happens + VclPtr<OJoinTableView> m_pOwner; // in this container it all happens public: OQueryDesignUndoAction(OJoinTableView* pOwner, sal_uInt16 nCommentID) : OCommentUndoAction(nCommentID), m_pOwner(pOwner) { } diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index e3c3ea24c014..378afe667f74 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -508,12 +508,12 @@ namespace pEntryConn->SetVisited(true); // first search for the "to" window - const ::std::vector<OTableConnection*>& rConnections = pEntryConn->GetParent()->getTableConnections(); - ::std::vector<OTableConnection*>::const_iterator aIter = rConnections.begin(); - ::std::vector<OTableConnection*>::const_iterator aEnd = rConnections.end(); + const auto& rConnections = pEntryConn->GetParent()->getTableConnections(); + auto aIter = rConnections.begin(); + auto aEnd = rConnections.end(); for(;aIter != aEnd;++aIter) { - OQueryTableConnection* pNext = static_cast<OQueryTableConnection*>(*aIter); + OQueryTableConnection* pNext = static_cast<OQueryTableConnection*>((*aIter).get()); if(!pNext->IsVisited() && (pNext->GetSourceWin() == pEntryTabTo || pNext->GetDestWin() == pEntryTabTo)) { OQueryTableWindow* pEntryTab = pNext->GetSourceWin() == pEntryTabTo ? static_cast<OQueryTableWindow*>(pNext->GetDestWin()) : static_cast<OQueryTableWindow*>(pNext->GetSourceWin()); @@ -531,7 +531,7 @@ namespace aIter = rConnections.begin(); for(;aIter != aEnd;++aIter) { - OQueryTableConnection* pNext = static_cast<OQueryTableConnection*>(*aIter); + OQueryTableConnection* pNext = static_cast<OQueryTableConnection*>((*aIter).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()); @@ -665,7 +665,7 @@ namespace bool bFound = false; for(;!bFound && tableIter != tableEnd ;++tableIter) { - OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(tableIter->second); + OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(tableIter->second.get()); bFound = pTabWin->ExistsField( rFieldName, aInfo ); if ( bFound ) @@ -984,13 +984,13 @@ namespace void GenerateInnerJoinCriterias(const Reference< XConnection>& _xConnection, OUString& _rJoinCrit, - const ::std::vector<OTableConnection*>* _pConnList) + const ::std::vector<VclPtr<OTableConnection> >& _rConnList) { - ::std::vector<OTableConnection*>::const_iterator aIter = _pConnList->begin(); - ::std::vector<OTableConnection*>::const_iterator aEnd = _pConnList->end(); + auto aIter = _rConnList.begin(); + auto aEnd = _rConnList.end(); for(;aIter != aEnd;++aIter) { - const OQueryTableConnection* pEntryConn = static_cast<const OQueryTableConnection*>(*aIter); + const OQueryTableConnection* pEntryConn = static_cast<const OQueryTableConnection*>((*aIter).get()); OQueryTableConnectionData* pEntryConnData = static_cast<OQueryTableConnectionData*>(pEntryConn->GetData().get()); if ( pEntryConnData->GetJoinType() == INNER_JOIN && !pEntryConnData->isNatural() ) { @@ -1017,7 +1017,7 @@ namespace } OUString GenerateFromClause( const Reference< XConnection>& _xConnection, const OQueryTableView::OTableWindowMap* pTabList, - const ::std::vector<OTableConnection*>* pConnList + const ::std::vector<VclPtr<OTableConnection> >& rConnList ) { @@ -1026,14 +1026,14 @@ namespace tableNames_t aTableNames; // generate outer join clause in from - if(!pConnList->empty()) + if(!rConnList.empty()) { - ::std::vector<OTableConnection*>::const_iterator aIter = pConnList->begin(); - ::std::vector<OTableConnection*>::const_iterator aEnd = pConnList->end(); + auto aIter = rConnList.begin(); + auto aEnd = rConnList.end(); ::std::map<OTableWindow*,sal_Int32> aConnectionCount; for(;aIter != aEnd;++aIter) { - static_cast<OQueryTableConnection*>(*aIter)->SetVisited(false); + static_cast<OQueryTableConnection*>((*aIter).get())->SetVisited(false); ++aConnectionCount[(*aIter)->GetSourceWin()]; ++aConnectionCount[(*aIter)->GetDestWin()]; } @@ -1050,10 +1050,10 @@ namespace ::std::multimap<sal_Int32 , OTableWindow*>::reverse_iterator aREnd = aMulti.rend(); for(;aRIter != aREnd;++aRIter) { - ::std::vector<OTableConnection*>::const_iterator aConIter = aRIter->second->getTableView()->getTableConnections(aRIter->second); + auto aConIter = aRIter->second->getTableView()->getTableConnections(aRIter->second); for(;aConIter != aEnd;++aConIter) { - OQueryTableConnection* pEntryConn = static_cast<OQueryTableConnection*>(*aConIter); + OQueryTableConnection* pEntryConn = static_cast<OQueryTableConnection*>((*aConIter).get()); if(!pEntryConn->IsVisited() && pEntryConn->GetSourceWin() == aRIter->second ) { OUString aJoin; @@ -1096,10 +1096,10 @@ namespace // "FROM tbl1, tbl2 WHERE tbl1.col1=tlb2.col2" // rather than // "FROM tbl1 INNER JOIN tbl2 ON tbl1.col1=tlb2.col2" - aIter = pConnList->begin(); + aIter = rConnList.begin(); for(;aIter != aEnd;++aIter) { - OQueryTableConnection* pEntryConn = static_cast<OQueryTableConnection*>(*aIter); + OQueryTableConnection* pEntryConn = static_cast<OQueryTableConnection*>((*aIter).get()); if(!pEntryConn->IsVisited()) { searchAndAppendName(_xConnection, @@ -1119,7 +1119,7 @@ namespace OQueryTableView::OTableWindowMap::const_iterator aTabEnd = pTabList->end(); for(;aTabIter != aTabEnd;++aTabIter) { - const OQueryTableWindow* pEntryTab = static_cast<const OQueryTableWindow*>(aTabIter->second); + const OQueryTableWindow* pEntryTab = static_cast<const OQueryTableWindow*>(aTabIter->second.get()); if(!pEntryTab->ExistsAConn()) { aTableListStr += BuildTable(_xConnection,pEntryTab); @@ -1540,7 +1540,7 @@ namespace OJoinTableView::OTableWindowMap::iterator aTabEnd = rTabList.end(); for(;aIter != aTabEnd;++aIter) { - OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second); + OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second.get()); if (pTabWin->ExistsField( OUString("*"), aDragLeft )) { aDragLeft->SetAlias(OUString()); @@ -1748,7 +1748,7 @@ namespace OJoinTableView::OTableWindowMap::const_iterator aEnd = _rTabList.end(); for ( ; aIter != aEnd; ++aIter ) { - OQueryTableWindow* pTabWin = static_cast< OQueryTableWindow* >( aIter->second ); + OQueryTableWindow* pTabWin = static_cast< OQueryTableWindow* >( aIter->second.get() ); if ( pTabWin && pTabWin->ExistsField( _rColumName, _rInfo ) ) return pTabWin; } @@ -2104,7 +2104,7 @@ namespace OJoinTableView::OTableWindowMap::iterator aEnd = _pTabList->end(); for(;aIter != aEnd && eOk == eErrorCode ;++aIter) { - OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second); + OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second.get()); OTableFieldDescRef aInfo = new OTableFieldDesc(); if (pTabWin->ExistsField( sAsterisk, aInfo )) { @@ -2201,7 +2201,7 @@ namespace const OJoinTableView::OTableWindowMap::const_iterator aEnd = pTabList->end(); for(;aIter != aEnd;++aIter) { - OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second); + OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second.get()); if (pTabWin->ExistsField( OUString("*"), aInfo )) { aInfo->SetAlias(OUString()); @@ -2524,8 +2524,7 @@ void OQueryDesignView::dispose() { if ( m_pTableView ) ::dbaui::notifySystemWindow(this,m_pTableView,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); - boost::scoped_ptr<vcl::Window> aTemp(m_pSelectionBox); - m_pSelectionBox = NULL; + m_pSelectionBox.clear(); m_aSplitter.disposeAndClear(); OQueryView::dispose(); } @@ -2751,7 +2750,7 @@ void OQueryDesignView::fillValidFields(const OUString& sAliasName, ComboBox* pFi OJoinTableView::OTableWindowMap::iterator aEnd = rTabWins.end(); for(;aIter != aEnd;++aIter) { - OQueryTableWindow* pCurrentWin = static_cast<OQueryTableWindow*>(aIter->second); + OQueryTableWindow* pCurrentWin = static_cast<OQueryTableWindow*>(aIter->second.get()); if (bAllTables || (pCurrentWin->GetAliasName() == sAliasName)) { strCurrentPrefix = pCurrentWin->GetAliasName(); @@ -2851,9 +2850,9 @@ OUString OQueryDesignView::getStatement() // and trigger a error message // ----------------- Build table list ---------------------- - const ::std::vector<OTableConnection*>& rConnList = m_pTableView->getTableConnections(); + const auto& rConnList = m_pTableView->getTableConnections(); Reference< XConnection> xConnection = rController.getConnection(); - OUString aTableListStr(GenerateFromClause(xConnection,&rTabList,&rConnList)); + OUString aTableListStr(GenerateFromClause(xConnection,&rTabList,rConnList)); OSL_ENSURE(!aTableListStr.isEmpty(), "OQueryDesignView::getStatement() : unexpected : have Fields, but no Tables !"); // if fields exist now, these only can be created by inserting from an already existing table; if on the other hand // a table is deleted, also the belonging fields will be deleted -> therefore it CANNOT occur that fields @@ -2865,7 +2864,7 @@ OUString OQueryDesignView::getStatement() return OUString(); OUString aJoinCrit; - GenerateInnerJoinCriterias(xConnection,aJoinCrit,&rConnList); + GenerateInnerJoinCriterias(xConnection,aJoinCrit,rConnList); if(!aJoinCrit.isEmpty()) { OUString aTmp = "( " + aJoinCrit + " )"; diff --git a/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.hxx index 49060c1bc08e..b8c9f52ad0c1 100644 --- a/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.hxx +++ b/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.hxx @@ -31,7 +31,7 @@ namespace dbaui class OJoinMoveTabWinUndoAct : public OQueryDesignUndoAction { Point m_ptNextPosition; - OTableWindow* m_pTabWin; + VclPtr<OTableWindow> m_pTabWin; protected: void TogglePosition(); diff --git a/dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx b/dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx index 4de742deb1d4..bd9381468ca0 100644 --- a/dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx +++ b/dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx @@ -31,7 +31,7 @@ namespace dbaui { Point m_ptNextPosition; Size m_szNextSize; - OTableWindow* m_pTabWin; + VclPtr<OTableWindow> m_pTabWin; protected: inline void ToggleSizePosition(); diff --git a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx index 16f8e0e4b7cd..85f3ff283985 100644 --- a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx +++ b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx @@ -19,6 +19,7 @@ #include "QueryTabConnUndoAction.hxx" #include "QTableConnection.hxx" +#include "QTableWindow.hxx" #include <tools/debug.hxx> #include "QueryTableView.hxx" #include "QueryAddTabConnUndoAction.hxx" @@ -32,7 +33,6 @@ OQueryTabConnUndoAction::~OQueryTabConnUndoAction() if (m_bOwnerOfConn) { // I have the connection -> delete m_pOwner->DeselectConn(m_pConnection); - delete m_pConnection; } } @@ -50,13 +50,13 @@ OQueryAddTabConnUndoAction::OQueryAddTabConnUndoAction(OQueryTableView* pOwner) void OQueryAddTabConnUndoAction::Undo() { - static_cast<OQueryTableView*>(m_pOwner)->DropConnection(m_pConnection); + static_cast<OQueryTableView*>(m_pOwner.get())->DropConnection(m_pConnection); SetOwnership(true); } void OQueryAddTabConnUndoAction::Redo() { - static_cast<OQueryTableView*>(m_pOwner)->GetConnection(m_pConnection); + static_cast<OQueryTableView*>(m_pOwner.get())->GetConnection(m_pConnection); SetOwnership(false); } @@ -67,13 +67,13 @@ OQueryDelTabConnUndoAction::OQueryDelTabConnUndoAction(OQueryTableView* pOwner) void OQueryDelTabConnUndoAction::Undo() { - static_cast<OQueryTableView*>(m_pOwner)->GetConnection(m_pConnection); + static_cast<OQueryTableView*>(m_pOwner.get())->GetConnection(m_pConnection); SetOwnership(false); } void OQueryDelTabConnUndoAction::Redo() { - static_cast<OQueryTableView*>(m_pOwner)->DropConnection(m_pConnection); + static_cast<OQueryTableView*>(m_pOwner.get())->DropConnection(m_pConnection); SetOwnership(true); } @@ -88,13 +88,13 @@ OQueryTabWinShowUndoAct::~OQueryTabWinShowUndoAct() void OQueryTabWinShowUndoAct::Undo() { - static_cast<OQueryTableView*>(m_pOwner)->HideTabWin(m_pTabWin, this); + static_cast<OQueryTableView*>(m_pOwner.get())->HideTabWin(m_pTabWin, this); SetOwnership(true); } void OQueryTabWinShowUndoAct::Redo() { - static_cast<OQueryTableView*>(m_pOwner)->ShowTabWin(m_pTabWin, this,true); + static_cast<OQueryTableView*>(m_pOwner.get())->ShowTabWin(m_pTabWin, this,true); SetOwnership(false); } @@ -109,13 +109,13 @@ OQueryTabWinDelUndoAct::~OQueryTabWinDelUndoAct() void OQueryTabWinDelUndoAct::Undo() { - static_cast<OQueryTableView*>(m_pOwner)->ShowTabWin( m_pTabWin, this,true ); + static_cast<OQueryTableView*>(m_pOwner.get())->ShowTabWin( m_pTabWin, this,true ); SetOwnership(false); } void OQueryTabWinDelUndoAct::Redo() { - static_cast<OQueryTableView*>(m_pOwner)->HideTabWin( m_pTabWin, this ); + static_cast<OQueryTableView*>(m_pOwner.get())->HideTabWin( m_pTabWin, this ); SetOwnership(true); } diff --git a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx index 72b31532213d..6541a4ed5b42 100644 --- a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx +++ b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx @@ -28,7 +28,7 @@ namespace dbaui class OQueryTabConnUndoAction : public OQueryDesignUndoAction { protected: - OQueryTableConnection* m_pConnection; + VclPtr<OQueryTableConnection> m_pConnection; bool m_bOwnerOfConn; // am I the only owner of the connection? (changes with every redo and undo) diff --git a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx index f7bee57ce37a..1745890f1145 100644 --- a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx +++ b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx @@ -51,20 +51,18 @@ OQueryTabWinUndoAct::~OQueryTabWinUndoAct() if (m_bOwnerOfObjects) { // I should take care to delete the window if I am the only owner - OSL_ENSURE(m_pTabWin != NULL, "OQueryTabWinUndoAct::~OQueryTabWinUndoAct() : m_pTabWin sollte nicht NULL sein"); + OSL_ENSURE(m_pTabWin != nullptr, "OQueryTabWinUndoAct::~OQueryTabWinUndoAct() : m_pTabWin sollte nicht NULL sein"); OSL_ENSURE(!m_pTabWin->IsVisible(), "OQueryTabWinUndoAct::~OQueryTabWinUndoAct() : *m_pTabWin sollte nicht sichtbar sein"); if ( m_pTabWin ) m_pTabWin->clearListBox(); - delete m_pTabWin; // and of course the corresponding connections - ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin(); - ::std::vector<OTableConnection*>::iterator aEnd = m_vTableConnection.end(); + auto aIter = m_vTableConnection.begin(); + auto aEnd = m_vTableConnection.end(); for(;aIter != aEnd;++aIter) { m_pOwner->DeselectConn(*aIter); - delete (*aIter); } m_vTableConnection.clear(); } diff --git a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx index 22c9921330a6..af22a64063d2 100644 --- a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx +++ b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx @@ -33,8 +33,8 @@ namespace dbaui class OQueryTabWinUndoAct : public OQueryDesignUndoAction { protected: - ::std::vector<OTableConnection*> m_vTableConnection; - OQueryTableWindow* m_pTabWin; + ::std::vector<VclPtr<OTableConnection> > m_vTableConnection; + VclPtr<OQueryTableWindow> m_pTabWin; bool m_bOwnerOfObjects; // am I the only owner of the managed objects? (changes with every redo or undo) @@ -54,7 +54,7 @@ namespace dbaui // access to the managed connections sal_uInt16 ConnCount() { return (sal_uInt16)m_vTableConnection.size(); } - ::std::vector<OTableConnection*>& GetTabConnList() { return m_vTableConnection; } + ::std::vector<VclPtr<OTableConnection> >& GetTabConnList() { return m_vTableConnection; } void InsertConnection( OTableConnection* pConnection ) { m_vTableConnection.push_back(pConnection); } void RemoveConnection( OTableConnection* pConnection ) diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx index 573eba4608a4..18d0fd583bb7 100644 --- a/dbaccess/source/ui/querydesign/QueryTableView.cxx +++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx @@ -327,26 +327,26 @@ void OQueryTableView::NotifyTabConnection(const OQueryTableConnection& rNewConn, { // let's first check if I have the connection already OQueryTableConnection* pTabConn = NULL; - const ::std::vector<OTableConnection*>& rConnections = getTableConnections(); - ::std::vector<OTableConnection*>::const_iterator aEnd = rConnections.end(); - ::std::vector<OTableConnection*>::const_iterator aIter = ::std::find( rConnections.begin(), - aEnd, - static_cast<const OTableConnection*>(&rNewConn) - ); + const auto& rConnections = getTableConnections(); + auto aEnd = rConnections.end(); + auto aIter = ::std::find( rConnections.begin(), + aEnd, + VclPtr<OTableConnection>(const_cast<OTableConnection*>(static_cast<const OTableConnection*>(&rNewConn))) + ); if(aIter == aEnd ) { aIter = rConnections.begin(); for(;aIter != aEnd;++aIter) { - if(*static_cast<OQueryTableConnection*>(*aIter) == rNewConn) + if(*static_cast<OQueryTableConnection*>((*aIter).get()) == rNewConn) { - pTabConn = static_cast<OQueryTableConnection*>(*aIter); + pTabConn = static_cast<OQueryTableConnection*>((*aIter).get()); break; } } } else - pTabConn = static_cast<OQueryTableConnection*>(*aIter); + pTabConn = static_cast<OQueryTableConnection*>((*aIter).get()); // no -> insert if (pTabConn == NULL) @@ -525,14 +525,14 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString& { for(aIter = rTabWins.begin();aIter != aEnd;++aIter) { - OQueryTableWindow* pTabWinTmp = static_cast<OQueryTableWindow*>(aIter->second); + OQueryTableWindow* pTabWinTmp = static_cast<OQueryTableWindow*>(aIter->second.get()); OSL_ENSURE( pTabWinTmp,"TableWindow is null!" ); if ( pTabWinTmp != pNewTabWin && pTabWinTmp->GetComposedName() == aReferencedTable ) break; } } if ( aIter != aEnd && pNewTabWin != aIter->second ) - addConnections( this, *pNewTabWin, *static_cast<OQueryTableWindow*>(aIter->second), xFKeyColumns ); + addConnections( this, *pNewTabWin, *static_cast<OQueryTableWindow*>(aIter->second.get()), xFKeyColumns ); } break; @@ -543,7 +543,7 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString& OTableWindowMap::const_iterator aEnd = rTabWins.end(); for(;aIter != aEnd;++aIter) { - OQueryTableWindow* pTabWinTmp = static_cast<OQueryTableWindow*>(aIter->second); + OQueryTableWindow* pTabWinTmp = static_cast<OQueryTableWindow*>(aIter->second.get()); if ( pTabWinTmp == pNewTabWin ) continue; @@ -656,8 +656,8 @@ void OQueryTableView::createNewConnection() if( openJoinDialog(this,pData,true) ) { OTableWindowMap& rMap = GetTabWinMap(); - OQueryTableWindow* pSourceWin = static_cast< OQueryTableWindow*>(rMap[pData->getReferencingTable()->GetWinName()]); - OQueryTableWindow* pDestWin = static_cast< OQueryTableWindow*>(rMap[pData->getReferencedTable()->GetWinName()]); + 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; @@ -704,7 +704,7 @@ OQueryTableWindow* OQueryTableView::FindTable(const OUString& rAliasName) // (it is harmless but does not make sense and indicates that there is probably an error in the caller) OTableWindowMap::const_iterator aIter = GetTabWinMap().find(rAliasName); if(aIter != GetTabWinMap().end()) - return static_cast<OQueryTableWindow*>(aIter->second); + return static_cast<OQueryTableWindow*>(aIter->second.get()); return NULL; } @@ -715,7 +715,7 @@ bool OQueryTableView::FindTableFromField(const OUString& rFieldName, OTableField OTableWindowMap::const_iterator aEnd = GetTabWinMap().end(); for(;aIter != aEnd;++aIter) { - if(static_cast<OQueryTableWindow*>(aIter->second)->ExistsField(rFieldName, rInfo)) + if(static_cast<OQueryTableWindow*>(aIter->second.get())->ExistsField(rFieldName, rInfo)) ++rCnt; } @@ -834,11 +834,11 @@ void OQueryTableView::HideTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAc // collect connections belonging to the window and pass to UndoAction sal_Int16 nCnt = 0; - const ::std::vector<OTableConnection*>& rTabConList = getTableConnections(); - ::std::vector<OTableConnection*>::const_iterator aIter2 = rTabConList.begin(); + const auto& rTabConList = getTableConnections(); + auto aIter2 = rTabConList.begin(); for(;aIter2 != rTabConList.end();)// the end may change { - OQueryTableConnection* pTmpEntry = static_cast<OQueryTableConnection*>(*aIter2); + OQueryTableConnection* pTmpEntry = static_cast<OQueryTableConnection*>((*aIter2).get()); OSL_ENSURE(pTmpEntry,"OQueryTableConnection is null!"); if( pTmpEntry->GetAliasName(JTCS_FROM) == pTabWin->GetAliasName() || pTmpEntry->GetAliasName(JTCS_TO) == pTabWin->GetAliasName() ) @@ -904,12 +904,9 @@ bool OQueryTableView::ShowTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAc // GetEntryPos, and then in turn by the Connection, when its starting point to the window must be determined. // the Connections - ::std::vector<OTableConnection*>& rTableCon = pUndoAction->GetTabConnList(); - ::std::vector<OTableConnection*>::iterator aIter = rTableCon.begin(); - ::std::vector<OTableConnection*>::iterator aEnd = rTableCon.end(); - - for(;aIter != aEnd;++aIter) - addConnection(*aIter); // add all connections from the undo action + auto rTableCon = pUndoAction->GetTabConnList(); + for(auto conn : rTableCon) + addConnection(conn); // add all connections from the undo action rTableCon.clear(); @@ -950,12 +947,9 @@ void OQueryTableView::InsertField(const OTableFieldDescRef& rInfo) bool OQueryTableView::ExistsAVisitedConn(const OQueryTableWindow* pFrom) const { - const ::std::vector<OTableConnection*>& rList = getTableConnections(); - ::std::vector<OTableConnection*>::const_iterator aIter = rList.begin(); - ::std::vector<OTableConnection*>::const_iterator aEnd = rList.end(); - for(;aIter != aEnd;++aIter) + for(auto conn : getTableConnections()) { - OQueryTableConnection* pTemp = static_cast<OQueryTableConnection*>(*aIter); + OQueryTableConnection* pTemp = static_cast<OQueryTableConnection*>(conn.get()); if (pTemp->IsVisited() && (pFrom == static_cast< OQueryTableWindow*>(pTemp->GetSourceWin()) || pFrom == static_cast< OQueryTableWindow*>(pTemp->GetDestWin()))) return true; diff --git a/dbaccess/source/ui/querydesign/QueryTextView.cxx b/dbaccess/source/ui/querydesign/QueryTextView.cxx index 62e282bed659..06f619e34892 100644 --- a/dbaccess/source/ui/querydesign/QueryTextView.cxx +++ b/dbaccess/source/ui/querydesign/QueryTextView.cxx @@ -57,8 +57,7 @@ OQueryTextView::~OQueryTextView() void OQueryTextView::dispose() { - boost::scoped_ptr<vcl::Window> aTemp(m_pEdit); - m_pEdit = NULL; + m_pEdit.clear(); vcl::Window::dispose(); } diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 07c0c2d6b43d..87ea89bda2a0 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -158,12 +158,12 @@ OSelectionBrowseBox::~OSelectionBrowseBox() void OSelectionBrowseBox::dispose() { - delete m_pTextCell; - delete m_pVisibleCell; - delete m_pFieldCell; - delete m_pTableCell; - delete m_pOrderCell; - delete m_pFunctionCell; + m_pTextCell.clear(); + m_pVisibleCell.clear(); + m_pFieldCell.clear(); + m_pTableCell.clear(); + m_pOrderCell.clear(); + m_pFunctionCell.clear(); ::svt::EditBrowseBox::dispose(); } @@ -245,11 +245,13 @@ namespace { class OSelectionBrwBoxHeader : public ::svt::EditBrowserHeader { - OSelectionBrowseBox* m_pBrowseBox; + VclPtr<OSelectionBrowseBox> m_pBrowseBox; protected: virtual void Select() SAL_OVERRIDE; public: OSelectionBrwBoxHeader(OSelectionBrowseBox* pParent); + virtual ~OSelectionBrwBoxHeader() { dispose(); } + virtual void dispose() SAL_OVERRIDE { m_pBrowseBox.clear(); ::svt::EditBrowserHeader::dispose(); } }; OSelectionBrwBoxHeader::OSelectionBrwBoxHeader(OSelectionBrowseBox* pParent) : ::svt::EditBrowserHeader(pParent,WB_BUTTONSTYLE|WB_DRAG) @@ -495,7 +497,7 @@ void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, lon OJoinTableView::OTableWindowMap::iterator aEnd = rTabWinList.end(); for(;aIter != aEnd;++aIter) - m_pTableCell->InsertEntry(static_cast<OQueryTableWindow*>(aIter->second)->GetAliasName()); + m_pTableCell->InsertEntry(static_cast<OQueryTableWindow*>(aIter->second.get())->GetAliasName()); m_pTableCell->InsertEntry(OUString(ModuleRes(STR_QUERY_NOTABLE)), 0); if (!pEntry->GetAlias().isEmpty()) @@ -990,7 +992,7 @@ bool OSelectionBrowseBox::SaveModified() OJoinTableView::OTableWindowMap::iterator aIter = rTabWinList.find(aAliasName); if(aIter != rTabWinList.end()) { - OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(aIter->second); + OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(aIter->second.get()); if (pEntryTab) { pEntry->SetTable(pEntryTab->GetTableName()); @@ -2607,7 +2609,7 @@ bool OSelectionBrowseBox::fillEntryTable(OTableFieldDescRef& _pEntry,const OUStr OJoinTableView::OTableWindowMap::iterator aIter = rTabWinList.find(_sTableName); if(aIter != rTabWinList.end()) { - OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(aIter->second); + OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(aIter->second.get()); if (pEntryTab) { _pEntry->SetTable(pEntryTab->GetTableName()); diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx index 233ddeb1f2b7..8e9033d6398a 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx @@ -56,12 +56,12 @@ namespace dbaui long m_nSeekRow; BrowserMode m_nMode; // remember the BrowseModes - Edit* m_pTextCell; - ::svt::CheckBoxControl* m_pVisibleCell; - ::svt::ComboBoxControl* m_pFieldCell; - ::svt::ListBoxControl* m_pFunctionCell; - ::svt::ListBoxControl* m_pTableCell; - ::svt::ListBoxControl* m_pOrderCell; + VclPtr<Edit> m_pTextCell; + VclPtr<::svt::CheckBoxControl> m_pVisibleCell; + VclPtr<::svt::ComboBoxControl> m_pFieldCell; + VclPtr<::svt::ListBoxControl> m_pFunctionCell; + VclPtr<::svt::ListBoxControl> m_pTableCell; + VclPtr<::svt::ListBoxControl> m_pOrderCell; OTableFieldDescRef m_pEmptyEntry; // default entry in the list may reference more than once diff --git a/dbaccess/source/ui/querydesign/TableConnection.cxx b/dbaccess/source/ui/querydesign/TableConnection.cxx index 6d7864e06db7..457a58481c64 100644 --- a/dbaccess/source/ui/querydesign/TableConnection.cxx +++ b/dbaccess/source/ui/querydesign/TableConnection.cxx @@ -43,7 +43,7 @@ namespace dbaui Show(); } - OTableConnection::OTableConnection( const OTableConnection& _rConn ) : Window(_rConn.m_pParent) + OTableConnection::OTableConnection( const OTableConnection& _rConn ) : Window(_rConn.m_pParent.get()) ,m_pData(_rConn.GetData()->NewInstance()) ,m_pParent(NULL) { diff --git a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx index d27e3dadb494..db44c06a982b 100644 --- a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx +++ b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx @@ -23,6 +23,7 @@ #include <tools/debug.hxx> #include <com/sun/star/sdbc/DataType.hpp> #include <comphelper/namedvaluecollection.hxx> +#include <vcl/window.hxx> #include <functional> diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx index dbc0264df085..e194989f7096 100644 --- a/dbaccess/source/ui/querydesign/TableWindow.cxx +++ b/dbaccess/source/ui/querydesign/TableWindow.cxx @@ -107,9 +107,8 @@ void OTableWindow::dispose() if (m_pListBox) { OSL_ENSURE(m_pListBox->GetEntryCount()==0,"Forgot to call EmptyListbox()!"); - boost::scoped_ptr<vcl::Window> aTemp(m_pListBox); - m_pListBox = NULL; } + m_pListBox.clear(); if ( m_pContainerListener.is() ) m_pContainerListener->dispose(); @@ -280,7 +279,7 @@ bool OTableWindow::Init() if ( !m_pListBox ) { m_pListBox = CreateListBox(); - OSL_ENSURE( m_pListBox != NULL, "OTableWindow::Init() : CreateListBox returned NULL !" ); + OSL_ENSURE( m_pListBox != nullptr, "OTableWindow::Init() : CreateListBox returned NULL !" ); m_pListBox->SetSelectionMode( MULTIPLE_SELECTION ); } diff --git a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx index 433e008e6e68..fb91731c5d5a 100644 --- a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx @@ -192,7 +192,7 @@ namespace dbaui if( m_pTable ) { OJoinTableView* pView = m_pTable->getTableView(); - ::std::vector<OTableConnection*>::const_iterator aIter = pView->getTableConnections(m_pTable) + nIndex; + auto aIter = pView->getTableConnections(m_pTable) + nIndex; aRet.TargetSet.realloc(1); aRet.TargetSet[0] = getParentChild(aIter - pView->getTableConnections().begin()); aRet.RelationType = AccessibleRelationType::CONTROLLER_FOR; @@ -211,10 +211,10 @@ namespace dbaui if( AccessibleRelationType::CONTROLLER_FOR == aRelationType && m_pTable) { OJoinTableView* pView = m_pTable->getTableView(); - const ::std::vector<OTableConnection*>& rConnectionList = pView->getTableConnections(); + const auto& rConnectionList = pView->getTableConnections(); - ::std::vector<OTableConnection*>::const_iterator aIter = pView->getTableConnections(m_pTable); - ::std::vector<OTableConnection*>::const_iterator aEnd = rConnectionList.end(); + auto aIter = pView->getTableConnections(m_pTable); + auto aEnd = rConnectionList.end(); ::std::vector< Reference<XInterface> > aRelations; aRelations.reserve(5); // just guessing for (; aIter != aEnd ; ++aIter ) diff --git a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx index 77a354ca58a8..9e71cdc6776b 100644 --- a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx @@ -79,7 +79,7 @@ void OTableWindowListBox::dispose() Application::RemoveUserEvent(m_nUiEvent); if( m_aScrollTimer.IsActive() ) m_aScrollTimer.Stop(); - m_pTabWin = NULL; + m_pTabWin.clear(); SvTreeListBox::dispose(); } diff --git a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx index 69adb564f4e8..8f7b9b8258a7 100644 --- a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx @@ -60,7 +60,7 @@ OTableWindowTitle::~OTableWindowTitle() void OTableWindowTitle::dispose() { - m_pTabWin = NULL; + m_pTabWin.clear(); FixedText::dispose(); } @@ -136,10 +136,8 @@ void OTableWindowTitle::MouseButtonDown( const MouseEvent& rEvt ) OJoinTableView* pView = static_cast<OJoinTableView*>(m_pTabWin->getTableView()); OSL_ENSURE(pView,"No OJoinTableView!"); - const ::std::vector<OTableConnection*>& rConns = pView->getTableConnections(); - ::std::for_each(rConns.begin(), - rConns.end(), - ::std::mem_fun(&OTableConnection::RecalcLines)); + for (auto conn : pView->getTableConnections()) + conn->RecalcLines(); pView->InvalidateConnections(); pView->getDesignView()->getController().setModified(sal_True); diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx index 29bc0e70eebf..71c037c80e80 100644 --- a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx +++ b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx @@ -139,8 +139,7 @@ throw (uno::RuntimeException, std::exception) svt::ToolboxController::dispose(); SolarMutexGuard aSolarMutexGuard; - delete m_pLimitBox; - m_pLimitBox = 0; + m_pLimitBox.clear(); } /// XStatusListener diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.hxx b/dbaccess/source/ui/querydesign/limitboxcontroller.hxx index 1db59a8e6ebf..93401164eca1 100644 --- a/dbaccess/source/ui/querydesign/limitboxcontroller.hxx +++ b/dbaccess/source/ui/querydesign/limitboxcontroller.hxx @@ -13,6 +13,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <svtools/toolboxcontroller.hxx> #include <rtl/ustring.hxx> +#include <vcl/vclptr.hxx> #include "apitools.hxx" @@ -59,7 +60,7 @@ class LimitBoxController: public svt::ToolboxController, using svt::ToolboxController::dispatchCommand; private: - LimitBoxImpl* m_pLimitBox; + VclPtr<LimitBoxImpl> m_pLimitBox; }; } ///dbaui namespace diff --git a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx index 26f91d004fd2..06255d09d584 100644 --- a/dbaccess/source/ui/querydesign/querycontainerwindow.cxx +++ b/dbaccess/source/ui/querydesign/querycontainerwindow.cxx @@ -66,7 +66,7 @@ namespace dbaui } if ( m_pBeamer ) ::dbaui::notifySystemWindow(this,m_pBeamer,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); - m_pBeamer = NULL; + m_pBeamer.clear(); if ( m_xBeamer.is() ) { Reference< ::com::sun::star::util::XCloseable > xCloseable(m_xBeamer,UNO_QUERY); @@ -75,8 +75,7 @@ namespace dbaui xCloseable->close(sal_False); // false - holds the ownership of this frame } - boost::scoped_ptr<vcl::Window> aTemp(m_pSplitter); - m_pSplitter = NULL; + m_pSplitter.clear(); ODataView::dispose(); } bool OQueryContainerWindow::switchView( ::dbtools::SQLExceptionInfo* _pErrorInfo ) diff --git a/dbaccess/source/ui/querydesign/querydlg.cxx b/dbaccess/source/ui/querydesign/querydlg.cxx index aa1ea5dcc564..b6c6bd651378 100644 --- a/dbaccess/source/ui/querydesign/querydlg.cxx +++ b/dbaccess/source/ui/querydesign/querydlg.cxx @@ -145,6 +145,11 @@ DlgQryJoin::~DlgQryJoin() void DlgQryJoin::dispose() { delete m_pTableControl; + m_pML_HelpText.clear(); + m_pPB_OK.clear(); + m_pLB_JoinType.clear(); + m_pCBNatural.clear(); + m_pTableView.clear(); ModalDialog::dispose(); } diff --git a/dbaccess/source/ui/querydesign/querydlg.hxx b/dbaccess/source/ui/querydesign/querydlg.hxx index 18c2c1bc6775..ec31515d007e 100644 --- a/dbaccess/source/ui/querydesign/querydlg.hxx +++ b/dbaccess/source/ui/querydesign/querydlg.hxx @@ -39,14 +39,14 @@ namespace dbaui ,public IRelationControlInterface { protected: - FixedText* m_pML_HelpText; - OKButton* m_pPB_OK; - ListBox* m_pLB_JoinType; - CheckBox* m_pCBNatural; + VclPtr<FixedText> m_pML_HelpText; + VclPtr<OKButton> m_pPB_OK; + VclPtr<ListBox> m_pLB_JoinType; + VclPtr<CheckBox> m_pCBNatural; OTableListBoxControl* m_pTableControl; OJoinTableView::OTableWindowMap* m_pTableMap; - OQueryTableView* m_pTableView; + VclPtr<OQueryTableView> m_pTableView; EJoinType eJoinType; TTableConnectionData::value_type m_pConnData; // contains left and right table |