User: kz      
Date: 2008-06-25 12:52:21+0000
Modified:
   dba/dbaccess/source/ui/querydesign/JoinTableView.cxx

Log:
 INTEGRATION: CWS dba30d (1.59.30); FILE MERGED
 2008/06/10 06:41:27 fs 1.59.30.4: RESYNC: (1.59-1.60); FILE MERGED
 2008/05/30 10:56:22 oj 1.59.30.3: resolve merge conflict
 2008/05/29 15:13:41 oj 1.59.30.2: #i86168# delete connections
 2008/05/29 11:30:21 fs 1.59.30.1: during #i80943#: refactoring: IController 
now passed around as reference, not as pointer

File Changes:

Directory: /dba/dbaccess/source/ui/querydesign/
===============================================

File [changed]: JoinTableView.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/querydesign/JoinTableView.cxx?r1=1.60&r2=1.61
Delta lines:  +57 -61
---------------------
--- JoinTableView.cxx   2008-06-06 14:12:53+0000        1.60
+++ JoinTableView.cxx   2008-06-25 12:52:18+0000        1.61
@@ -306,7 +306,7 @@
 }
 
 
//------------------------------------------------------------------------------
-::std::vector<OTableConnection*>::const_iterator 
OJoinTableView::RemoveConnection( OTableConnection* _pConn,sal_Bool _bDelete )
+bool OJoinTableView::RemoveConnection( OTableConnection* _pConn,sal_Bool 
_bDelete )
 {
        DBG_CHKTHIS(OJoinTableView,NULL);
        DeselectConn(_pConn);
@@ -314,9 +314,9 @@
        // to force a redraw
        _pConn->InvalidateConnection();
 
-       m_pView->getController()->removeConnectionData( _pConn->GetData() );
+       m_pView->getController().removeConnectionData( _pConn->GetData() );
 
-       ::std::vector<OTableConnection*>::const_iterator aNextPos = 
m_vTableConnection.erase(
+       m_vTableConnection.erase(
                                                
::std::find(m_vTableConnection.begin(),m_vTableConnection.end(),_pConn) );
 
        modified();
@@ -329,7 +329,7 @@
                delete _pConn;
        }
 
-       return aNextPos;
+       return true;
 }
 
 //------------------------------------------------------------------------
@@ -349,7 +349,7 @@
     OJoinDesignView* pParent = getDesignView();
     try
     {
-        if ( 
!pData->init(pParent->getController()->getConnection(),allowQueries()) )
+        if ( 
!pData->init(pParent->getController().getConnection(),allowQueries()) )
         {
             if ( pData->isValid() )
                 onNoColumns_throw();
@@ -360,13 +360,13 @@
        catch ( const SQLException& )
        {
         ::dbaui::showError( ::dbtools::SQLExceptionInfo( 
::cppu::getCaughtException() ),
-            pParent, pParent->getController()->getORB() );
+            pParent, pParent->getController().getORB() );
        }
        catch( const WrappedTargetException& e )
        {
                SQLException aSql;
                if ( e.TargetException >>= aSql )
-                       ::dbaui::showError( ::dbtools::SQLExceptionInfo( aSql 
), pParent, pParent->getController()->getORB() );
+                       ::dbaui::showError( ::dbtools::SQLExceptionInfo( aSql 
), pParent, pParent->getController().getORB() );
        }
     catch( const Exception& )
     {
@@ -394,7 +394,7 @@
        OTableWindow* pNewTabWin = createWindow( pNewTabWinData );
        if ( pNewTabWin->Init() )
        {
-               m_pView->getController()->getTableWindowData()->push_back( 
pNewTabWinData);
+               m_pView->getController().getTableWindowData()->push_back( 
pNewTabWinData);
                // when we already have a table with this name insert the full 
qualified one instead
                if(m_aTableMap.find(rWinName) != m_aTableMap.end())
                        m_aTableMap[_rComposedName] = pNewTabWin;
@@ -423,19 +423,23 @@
        DBG_CHKTHIS(OJoinTableView,NULL);
        //////////////////////////////////////////////////////////////////////
        // first delete all connections of this window to others
-       BOOL bRemove = TRUE;
-
+    bool bRemove = true;
     TTableWindowData::value_type pData = pTabWin->GetData();
        sal_Int32 nCount = m_vTableConnection.size();
        ::std::vector<OTableConnection*>::reverse_iterator aIter = 
m_vTableConnection.rbegin();
-       for(;aIter != m_vTableConnection.rend() && bRemove;++aIter)
+       while(aIter != m_vTableConnection.rend() && bRemove)
        {
                OTableConnection* pTabConn = (*aIter);
                if(
                        ( pData == pTabConn->GetData()->getReferencingTable())  
        ||
                        ( pData == pTabConn->GetData()->getReferencedTable())
                  )
-                 bRemove = RemoveConnection( pTabConn ,sal_True) != 
m_vTableConnection.end(); // every remove must work
+        {
+                 bRemove = RemoveConnection( pTabConn ,sal_True);
+          aIter = m_vTableConnection.rbegin();
+        }
+        else
+            ++aIter;
        }
 
        //////////////////////////////////////////////////////////////////////
@@ -448,11 +452,12 @@
                                                                                
                        );
 
                pTabWin->Hide();
-               TTableWindowData::iterator aFind = 
::std::find(m_pView->getController()->getTableWindowData()->begin(),m_pView->getController()->getTableWindowData()->end(),pData);
-               if(aFind != 
m_pView->getController()->getTableWindowData()->end())
+        OJoinController& rController = m_pView->getController();
+           TTableWindowData::iterator aFind = 
::std::find(rController.getTableWindowData()->begin(),rController.getTableWindowData()->end(),pData);
+           if(aFind != rController.getTableWindowData()->end())
                {
-                       
m_pView->getController()->getTableWindowData()->erase(aFind);
-                       m_pView->getController()->setModified(sal_True);
+                   rController.getTableWindowData()->erase(aFind);
+                   rController.setModified(sal_True);
                }
 
         String aWinName = pTabWin->GetWinName();
@@ -466,9 +471,9 @@
 
                pTabWin->clearListBox();
                delete pTabWin;
-       }
 
-       if ( bRemove && (sal_Int32)m_aTableMap.size() < (nCount-1) ) // if some 
connections could be removed
+    }
+       if ( (sal_Int32)m_vTableConnection.size() < (nCount-1) ) // if some 
connections could be removed
                modified();
 }
 namespace
@@ -712,7 +717,7 @@
 {
        DBG_CHKTHIS(OJoinTableView,NULL);
 
-       if (m_pView->getController()->isReadOnly())
+       if (m_pView->getController().isReadOnly())
                return;
 
        m_pDragWin = pTabWin;
@@ -736,7 +741,7 @@
 {
        DBG_CHKTHIS(OJoinTableView,NULL);
 
-       if (m_pView->getController()->isReadOnly())
+       if (m_pView->getController().isReadOnly())
                return;
 
        SetPointer( rPointer );
@@ -1220,7 +1225,7 @@
 void OJoinTableView::invalidateAndModify(SfxUndoAction *_pAction)
 {
        Invalidate(INVALIDATE_NOCHILDREN);
-       m_pView->getController()->addUndoActionAndInvalidate(_pAction);
+       m_pView->getController().addUndoActionAndInvalidate(_pAction);
 }
 //------------------------------------------------------------------------
 void OJoinTableView::TabWinMoved(OTableWindow* ptWhich, const Point& 
ptOldPosition)
@@ -1248,12 +1253,12 @@
        DBG_CHKTHIS(OJoinTableView,NULL);
 
        // nicht wenn Db readonly
-       if (m_pView->getController()->isReadOnly())
+       if (m_pView->getController().isReadOnly())
                return FALSE;
 
        try
        {
-               Reference< XConnection> xConnection = 
m_pView->getController()->getConnection();
+               Reference< XConnection> xConnection = 
m_pView->getController().getConnection();
                if(!xConnection.is())
                        return FALSE;
                // nicht wenn schon zuviele Tabellen
@@ -1325,7 +1330,7 @@
                                        if( (*aIter)->CheckHit(aMousePos) )
                                        {
                                                SelectConn(*aIter);
-                                               
if(!getDesignView()->getController()->isReadOnly() && 
getDesignView()->getController()->isConnected())
+                                               
if(!getDesignView()->getController().isReadOnly() && 
getDesignView()->getController().isConnected())
                                                        
executePopup(rEvt.GetMousePosPixel(),*aIter);
                                                break;
                                        }
@@ -1642,7 +1647,7 @@
                        RemoveTabWin(aIter->second);
        }
 
-       m_pView->getController()->setModified(sal_True);
+       m_pView->getController().setModified(sal_True);
 
        SetUpdateMode(sal_True);
 
@@ -1710,25 +1715,16 @@
 // 
-----------------------------------------------------------------------------
 Reference< XAccessible > OJoinTableView::CreateAccessible()
 {
-       Reference< XAccessible > aRet;
-       if (getDesignView()->getController())
-       {
-               // create our VIEWPORT
-               OJoinDesignViewAccess* pAccessible = new 
OJoinDesignViewAccess(this);
-               m_pAccessible = pAccessible;
-               aRet = pAccessible;
-       }
-       else
-               aRet = Window::CreateAccessible();
-       return aRet;
+       m_pAccessible = new OJoinDesignViewAccess(this);
+       return m_pAccessible;
 }
 // 
-----------------------------------------------------------------------------
 void OJoinTableView::modified()
 {
-       OJoinController* pController = m_pView->getController();
-       pController->setModified( sal_True );
-       pController->InvalidateFeature(ID_BROWSER_ADDTABLE);
-       pController->InvalidateFeature(SID_RELATION_ADD_RELATION);
+       OJoinController& rController = m_pView->getController();
+       rController.setModified( sal_True );
+       rController.InvalidateFeature(ID_BROWSER_ADDTABLE);
+       rController.InvalidateFeature(SID_RELATION_ADD_RELATION);
 }
 // 
-----------------------------------------------------------------------------
 void OJoinTableView::addConnection(OTableConnection* _pConnection,sal_Bool 
_bAddData)
@@ -1736,10 +1732,10 @@
        if ( _bAddData )
        {
 #if OSL_DEBUG_LEVEL > 0
-               TTableConnectionData* pTabConnDataList = 
m_pView->getController()->getTableConnectionData();
+               TTableConnectionData* pTabConnDataList = 
m_pView->getController().getTableConnectionData();
                OSL_ENSURE( 
::std::find(pTabConnDataList->begin(),pTabConnDataList->end(),_pConnection->GetData())
 == pTabConnDataList->end(),"Data already in vector!");
 #endif
-               
m_pView->getController()->getTableConnectionData()->push_back(_pConnection->GetData());
+               
m_pView->getController().getTableConnectionData()->push_back(_pConnection->GetData());
        }
        m_vTableConnection.push_back(_pConnection);
        _pConnection->RecalcLines();




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to