diff options
author | Ocke Janssen <oj@openoffice.org> | 2002-02-06 07:43:11 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2002-02-06 07:43:11 +0000 |
commit | 808ce4cfeb7954e2b3abc508e125fafc3071ac7e (patch) | |
tree | 36bdca5dbc3b8be2457ed36ed9c76a881b3768ad /dbaccess/source/ui/dlg/RelationDlg.cxx | |
parent | 943c227ce6ccd423f1d05768c504825395e170a8 (diff) |
#90580# introduce new file for relation control
Diffstat (limited to 'dbaccess/source/ui/dlg/RelationDlg.cxx')
-rw-r--r-- | dbaccess/source/ui/dlg/RelationDlg.cxx | 593 |
1 files changed, 39 insertions, 554 deletions
diff --git a/dbaccess/source/ui/dlg/RelationDlg.cxx b/dbaccess/source/ui/dlg/RelationDlg.cxx index a929408f5c29..f98806659501 100644 --- a/dbaccess/source/ui/dlg/RelationDlg.cxx +++ b/dbaccess/source/ui/dlg/RelationDlg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: RelationDlg.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: hr $ $Date: 2001-10-26 16:36:25 $ + * last change: $Author: oj $ $Date: 2002-02-06 08:43:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -87,24 +87,10 @@ #ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ #include <com/sun/star/sdbc/KeyRule.hpp> #endif -#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ -#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ -#include <com/sun/star/container/XNameAccess.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ -#include <com/sun/star/beans/XPropertySet.hpp> -#endif + #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif -#ifndef DBAUI_JOINTABLEVIEW_HXX -#include "JoinTableView.hxx" -#endif -#ifndef DBAUI_TABLEWINDOW_HXX -#include "TableWindow.hxx" -#endif #ifndef DBAUI_TOOLS_HXX #include "UITools.hxx" #endif @@ -117,377 +103,29 @@ #ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> #endif +#ifndef DBAUI_RTABLECONNECTIONDATA_HXX +#include "RTableConnectionData.hxx" +#endif +#ifndef DBAUI_RELATIONCONTROL_HXX +#include "RelationControl.hxx" +#endif #include <algorithm> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::container; using namespace ::com::sun::star::beans; using namespace ::dbaui; using namespace ::dbtools; -using namespace ::svt; - - -const USHORT SOURCE_COLUMN = 1; -const USHORT DEST_COLUMN = 2; - -//======================================================================== -// class ORelationControl -//======================================================================== -DBG_NAME(ORelationControl); -//------------------------------------------------------------------------ -ORelationControl::ORelationControl( ORelationDialog* pParent ) - :EditBrowseBox( pParent, EBBF_NOROWPICTURE, WB_TABSTOP | WB_3DLOOK | WB_BORDER ) - ,m_pListCell( NULL ) - ,m_pConnData( NULL ) - ,m_xSourceDef( NULL ) - ,m_xDestDef( NULL ) - ,m_nDeActivateEvent(0) -{ - DBG_CTOR(ORelationControl,NULL); -} - -//------------------------------------------------------------------------ -ORelationControl::~ORelationControl() -{ - DBG_DTOR(ORelationControl,NULL); - if (m_nDeActivateEvent) - Application::RemoveUserEvent(m_nDeActivateEvent); - - delete m_pListCell; -} - -//------------------------------------------------------------------------ -void ORelationControl::Init(ORelationTableConnectionData* _pConnData) -{ - DBG_CHKTHIS(ORelationControl,NULL); - - m_pConnData = _pConnData; - m_xSourceDef = m_pConnData->getSource(); - m_xDestDef = m_pConnData->getDest(); - - BOOL bFirstCall = (ColCount() == 0); - - if (bFirstCall) - { - ////////////////////////////////////////////////////////////////////// - // insert columns - ::rtl::OUString sSrcComposedName,sDestComposedName; - try - { - if(m_xSourceDef.is()) - ::dbaui::composeTableName(static_cast<ORelationDialog*>(GetParent())->getConnection()->getMetaData(),m_xSourceDef,sSrcComposedName,sal_False); - if(m_xDestDef.is()) - ::dbaui::composeTableName(static_cast<ORelationDialog*>(GetParent())->getConnection()->getMetaData(),m_xDestDef,sDestComposedName,sal_False); - } - catch(SQLException&) - { - OSL_ASSERT(!"SQLException catched while compose table name!"); - } - InsertDataColumn( 1, sSrcComposedName, 100); - InsertDataColumn( 2, sDestComposedName, 100); - // wenn es die Defs noch nicht gibt, dann muessen sie noch mit SetSource-/-DestDef gesetzt werden ! - - m_pListCell = new ListBoxControl( &GetDataWindow() ); - - ////////////////////////////////////////////////////////////////////// - // Browser Mode setzen - BrowserMode nMode = BROWSER_COLUMNSELECTION | - BROWSER_HLINESFULL | BROWSER_VLINESFULL | - BROWSER_HIDECURSOR | BROWSER_HIDESELECT; - - SetMode(nMode); - } - else - // not the first call - RowRemoved(0, GetRowCount()); - - RowInserted(0, m_pConnData->GetConnLineDataList()->size(), TRUE); - -} - -//------------------------------------------------------------------------------ -void ORelationControl::Resize() -{ - DBG_CHKTHIS(ORelationControl,NULL); - EditBrowseBox::Resize(); - long nOutputWidth = GetOutputSizePixel().Width()-20; - SetColumnWidth(1, (long)(nOutputWidth*0.5)); - SetColumnWidth(2, (long)(nOutputWidth*0.5)); -} - -//------------------------------------------------------------------------------ -long ORelationControl::PreNotify(NotifyEvent& rNEvt) -{ - DBG_CHKTHIS(ORelationControl,NULL); - if (rNEvt.GetType() == EVENT_LOSEFOCUS) - if (!HasChildPathFocus()) - { - if (m_nDeActivateEvent) - Application::RemoveUserEvent(m_nDeActivateEvent); - m_nDeActivateEvent = Application::PostUserEvent(LINK(this, ORelationControl, AsynchDeactivate)); - } - if (rNEvt.GetType() == EVENT_GETFOCUS) - { - if (m_nDeActivateEvent) - Application::RemoveUserEvent(m_nDeActivateEvent); - m_nDeActivateEvent = Application::PostUserEvent(LINK(this, ORelationControl, AsynchActivate)); - } - return EditBrowseBox::PreNotify(rNEvt); -} - -//------------------------------------------------------------------------------ -IMPL_LINK(ORelationControl, AsynchActivate, void*, EMPTYARG) -{ - m_nDeActivateEvent = 0; - ActivateCell(); - return 0L; -} - -//------------------------------------------------------------------------------ -IMPL_LINK(ORelationControl, AsynchDeactivate, void*, EMPTYARG) -{ - m_nDeActivateEvent = 0; - DeactivateCell(); - return 0L; -} - -//------------------------------------------------------------------------------ -BOOL ORelationControl::IsTabAllowed(BOOL bForward) const -{ - DBG_CHKTHIS(ORelationControl,NULL); - long nRow = GetCurRow(); - USHORT nCol = GetCurColumnId(); - - if (bForward && (nCol == 2) && (nRow == GetRowCount() - 1)) - return FALSE; - - if (!bForward && (nCol == 1) && (nRow == 0)) - return FALSE; - - return EditBrowseBox::IsTabAllowed(bForward); -} - -//------------------------------------------------------------------------------ -BOOL ORelationControl::SaveModified() -{ - DBG_CHKTHIS(ORelationControl,NULL); - OSL_ENSURE((sal_Int32)m_pConnData->GetConnLineDataList()->size() > GetCurRow(),"Invalid Index!"); - OConnectionLineDataRef pConnLineData = (*m_pConnData->GetConnLineDataList())[GetCurRow()]; - switch( GetCurColumnId() ) - { - case SOURCE_COLUMN: - pConnLineData->SetSourceFieldName( m_pListCell->GetSelectEntry() ); - break; - - case DEST_COLUMN: - pConnLineData->SetDestFieldName( m_pListCell->GetSelectEntry() ); - break; - } - - return TRUE; -} - -//------------------------------------------------------------------------------ -String ORelationControl::GetCellText( long nRow, USHORT nColId ) -{ - DBG_CHKTHIS(ORelationControl,NULL); - OSL_ENSURE((sal_Int32)m_pConnData->GetConnLineDataList()->size() > nRow,"Invalid Index!"); - OConnectionLineDataRef pConnLineData = (*m_pConnData->GetConnLineDataList())[nRow]; - - if( !pConnLineData.isValid() ) - return String(); - - switch( nColId ) - { - case SOURCE_COLUMN: - return pConnLineData->GetSourceFieldName(); - case DEST_COLUMN: - return pConnLineData->GetDestFieldName(); - } - - return String(); -} - -//------------------------------------------------------------------------------ -void ORelationControl::InitController( CellControllerRef& rController, long nRow, USHORT nColumnId ) -{ - DBG_CHKTHIS(ORelationControl,NULL); - - ULONG nHelpId; - - Reference< XPropertySet> xDef; - switch (nColumnId) - { - case SOURCE_COLUMN: - xDef = m_xSourceDef; - nHelpId = HID_RELATIONDIALOG_LEFTFIELDCELL; - break; - case DEST_COLUMN: - xDef = m_xDestDef; - nHelpId = HID_RELATIONDIALOG_RIGHTFIELDCELL; - break; - } - - if(xDef.is()) - { - fillListBox(xDef,nRow,nColumnId); - String aText = GetCellText( nRow, nColumnId ); - - m_pListCell->SelectEntry(aText); - - m_pListCell->SetHelpId(nHelpId); - m_pListCell->SetHelpText(String()); - } -} - -//------------------------------------------------------------------------------ -CellController* ORelationControl::GetController( long nRow, USHORT nColumnId ) -{ - DBG_CHKTHIS(ORelationControl,NULL); - return new ListBoxCellController( m_pListCell ); -} - - -//------------------------------------------------------------------------------ -BOOL ORelationControl::SeekRow( long nRow ) -{ - DBG_CHKTHIS(ORelationControl,NULL); - m_nDataPos = nRow; - return TRUE; -} - -//------------------------------------------------------------------------------ -void ORelationControl::PaintCell( OutputDevice& rDev, const Rectangle& rRect, USHORT nColumnId ) const -{ - DBG_CHKTHIS(ORelationControl,NULL); - String aText = ((ORelationControl*)this)->GetCellText( m_nDataPos, nColumnId ); - - Point aPos( rRect.TopLeft() ); - Size aTextSize( GetDataWindow().GetTextHeight(),GetDataWindow().GetTextWidth( aText )); - - if( aPos.X() < rRect.Right() || aPos.X() + aTextSize.Width() > rRect.Right() || - aPos.Y() < rRect.Top() || aPos.Y() + aTextSize.Height() > rRect.Bottom() ) - rDev.SetClipRegion( rRect ); - - rDev.DrawText( aPos, aText ); - - if( rDev.IsClipRegion() ) - rDev.SetClipRegion(); -} -// ----------------------------------------------------------------------------- -void ORelationControl::fillListBox(const Reference< XPropertySet>& _xDest,long _nRow,USHORT nColumnId) -{ - m_pListCell->Clear(); - try - { - if( _xDest.is() ) - { - sal_Int32 nRows = GetRowCount(); - Reference<XColumnsSupplier> xSup(_xDest,UNO_QUERY); - Reference<XNameAccess> xColumns = xSup->getColumns(); - Sequence< ::rtl::OUString> aNames = xColumns->getElementNames(); - const ::rtl::OUString* pBegin = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pBegin + aNames.getLength(); - for(;pBegin != pEnd;++pBegin) - { - String sName = *pBegin; - sal_Int32 i = 0; - for (; i< nRows; ++i) - if(i != _nRow && GetCellText(i,nColumnId) == sName) - break; - if(i == nRows) - m_pListCell->InsertEntry( *pBegin ); - } - m_pListCell->InsertEntry(String(), 0); - } - } - catch(SQLException&) - { - OSL_ASSERT(!"Exception catched while compse tablename!"); - } -} -//------------------------------------------------------------------------ -void ORelationControl::SetSourceDef(const Reference< XPropertySet>& xNewSource) -{ - DBG_CHKTHIS(ORelationControl,NULL); - m_xSourceDef = xNewSource; - SetDef(m_xSourceDef,1); -} -// ----------------------------------------------------------------------------- -void ORelationControl::SetDef(const Reference< XPropertySet>& xDest,sal_Int32 _nPos) -{ - // wenn ich hier gerade editiere, ausblenden - BOOL bWasEditing = IsEditing(); - if (bWasEditing) - DeactivateCell(); - - // Spaltenname setzen - ::rtl::OUString sComposedName; - try - { - if(xDest.is()) - ::dbaui::composeTableName(static_cast<ORelationDialog*>(GetParent())->getConnection()->getMetaData(),xDest,sComposedName,sal_False); - - SetColumnTitle((USHORT)_nPos, sComposedName); - } - catch(SQLException&) - { - OSL_ASSERT(!"Exception catched while compse tablename!"); - } - - // beide (!) Spalten loeschen - OConnectionLineDataVec* pLines = m_pConnData->GetConnLineDataList(); - ::std::for_each(pLines->begin(),pLines->end(), - OUnaryRefFunctor<OConnectionLineData>( - _nPos == 1 - ? - ::std::mem_fun(&OConnectionLineData::clearSourceFieldName) - : - ::std::mem_fun(&OConnectionLineData::clearDestFieldName) - ) - ); - // neu zeichnen - Invalidate(); - - if (bWasEditing) - { - GoToRow(0); - ActivateCell(); - } -} -//------------------------------------------------------------------------ -void ORelationControl::SetDestDef(const Reference< XPropertySet>& xNewDest) -{ - DBG_CHKTHIS(ORelationControl,NULL); - m_xDestDef = xNewDest; - SetDef(m_xDestDef,2); -} - -//------------------------------------------------------------------------ -void ORelationControl::CellModified() -{ - DBG_CHKTHIS(ORelationControl,NULL); - EditBrowseBox::CellModified(); - SaveModified(); - ((ORelationDialog*)GetParent())->NotifyCellChange(); -} //======================================================================== // class ORelationDialog //======================================================================== - -//------------------------------------------------------------------------ ORelationDialog::ORelationDialog( OJoinTableView* pParent, ORelationTableConnectionData* pConnectionData, BOOL bAllowTableSelect ) : ModalDialog( pParent, ModuleRes(DLG_REL_PROPERTIES) ) - ,aFL_InvolvedTables( this, ModuleRes(FL_INVOLVED_TABLES)) - ,m_lmbLeftTable( this, ModuleRes(LB_LEFT_TABLE)) - ,m_lmbRightTable( this, ModuleRes(LB_RIGHT_TABLE)) - ,aFL_InvolvedFields( this, ModuleRes(FL_INVOLVED_FIELDS)) ,aFL_CascUpd( this, ModuleRes(FL_CASC_UPD) ) ,aRB_NoCascUpd( this, ModuleRes(RB_NO_CASC_UPD) ) ,aRB_CascUpd( this, ModuleRes(RB_CASC_UPD) ) @@ -504,83 +142,29 @@ ORelationDialog::ORelationDialog( OJoinTableView* pParent, ,aPB_CANCEL( this, ResId( PB_CANCEL ) ) ,aPB_HELP( this, ResId( PB_HELP ) ) ,m_bTriedOneUpdate(FALSE) + ,m_pTableMap(pParent->GetTabWinMap()) + ,m_pConnData(NULL) { m_xConnection = pParent->getDesignView()->getController()->getConnection(); ////////////////////////////////////////////////////////////////////// // Connection kopieren - m_pConnData = new ORelationTableConnectionData( *pConnectionData ); - m_pRC_Tables = new ORelationControl( this ); - m_pRC_Tables->SetHelpId(HID_RELDLG_KEYFIELDS); - m_pRC_Tables->Init( ); - m_pRC_Tables->SetZOrder(&m_lmbRightTable, WINDOW_ZORDER_BEHIND); - - ////////////////////////////////////////////////////////////////////// - // BrowseBox positionieren - Point aDlgPoint = LogicToPixel( Point(12,43), MAP_APPFONT ); - Size aDlgSize = LogicToPixel( Size(162,68), MAP_APPFONT ); - m_pRC_Tables->SetPosSizePixel( aDlgPoint, aDlgSize ); - m_pRC_Tables->Show(); + m_pConnData = static_cast<ORelationTableConnectionData*>(pConnectionData->NewInstance()); + m_pConnData->CopyFrom( *pConnectionData ); + m_pTableControl = new OTableListBoxControl(this,ModuleRes(LB_CONTROL),m_pTableMap,this); Init(m_pConnData); + m_pTableControl->Init( m_pConnData ); aPB_OK.SetClickHdl( LINK(this, ORelationDialog, OKClickHdl) ); if (bAllowTableSelect) - { - OJoinTableView::OTableWindowMap* pTabWins = pParent->GetTabWinMap(); - DBG_ASSERT(pTabWins->size() >= 2, "ORelationDialog::ORelationDialog : brauche mindestens zwei TabWins !"); - OTableWindow* pInitialLeft = NULL; - OTableWindow* pInitialRight = NULL; - - // die Namen aller TabWins einsammeln - OJoinTableView::OTableWindowMap::iterator aIter = pTabWins->begin(); - for(;aIter != pTabWins->end();++aIter) - { - m_lmbLeftTable.InsertEntry(aIter->first); - m_lmbRightTable.InsertEntry(aIter->first); - - if (!pInitialLeft) - pInitialLeft = aIter->second; - else if (!pInitialRight) - pInitialRight = aIter->second; - } - - // links das erste, rechts das zweite selektieren - m_lmbLeftTable.SelectEntryPos(0); - m_lmbRightTable.SelectEntryPos(1); - - // die entsprechenden Defs an mein Controls - m_pRC_Tables->SetSourceDef(pInitialLeft->GetTable()); - m_pRC_Tables->SetDestDef(pInitialRight->GetTable()); - - // die in einer ComboBox ausgewaehlte Tabelle darf nicht in der anderen zur Verfuegung stehen - m_strCurrentLeft = pInitialLeft->GetComposedName(); - m_strCurrentRight = pInitialRight->GetComposedName(); - if (pTabWins->size() > 2) - { - m_lmbLeftTable.RemoveEntry(m_strCurrentRight); - m_lmbRightTable.RemoveEntry(m_strCurrentLeft); - } - - m_lmbLeftTable.SetSelectHdl(LINK(this, ORelationDialog, OnTableChanged)); - m_lmbRightTable.SetSelectHdl(LINK(this, ORelationDialog, OnTableChanged)); - - m_lmbLeftTable.GrabFocus(); - } + m_pTableControl->fillListBoxes(); else - { - m_lmbLeftTable.InsertEntry(pConnectionData->GetSourceWinName()); - m_lmbLeftTable.SelectEntryPos(0); - m_lmbLeftTable.Disable(); - - m_lmbRightTable.InsertEntry(pConnectionData->GetDestWinName()); - m_lmbRightTable.SelectEntryPos(0); - m_lmbRightTable.Disable(); - } + m_pTableControl->fillAndDisable(pConnectionData); - NotifyCellChange(); + m_pTableControl->NotifyCellChange(); FreeResource(); } @@ -627,45 +211,17 @@ void ORelationDialog::Init(ORelationTableConnectionData* _m_pConnData) aRB_CascDelDefault.Check( TRUE ); break; } - - - m_pRC_Tables->Init( _m_pConnData ); } //------------------------------------------------------------------------ ORelationDialog::~ORelationDialog() { + delete m_pTableControl; delete m_pConnData; - delete m_pRC_Tables; } //------------------------------------------------------------------------ -void ORelationDialog::NotifyCellChange() -{ - // den Ok-Button en- oder disablen, je nachdem, ob ich eine gueltige Situation habe - BOOL bValid = TRUE; - USHORT nEmptyRows = 0; - OConnectionLineDataVec* pLines = m_pConnData->GetConnLineDataList(); - OConnectionLineDataVec::iterator aIter = pLines->begin(); - for(;aIter != pLines->end();++aIter) - { - if (((*aIter)->GetDestFieldName().getLength() != 0) != ((*aIter)->GetSourceFieldName().getLength() != 0)) - bValid = FALSE; - // wenn nich beide leer oder beide voll sind -> ungueltig - if (((*aIter)->GetDestFieldName().getLength() == 0) && ((*aIter)->GetSourceFieldName().getLength() == 0)) - ++nEmptyRows; - } - aPB_OK.Enable(bValid && (nEmptyRows != pLines->size())); - // nur leere Zeilen -> ungueltig - if (nEmptyRows == 0) - { - m_pConnData->AppendConnLine(String(), String()); - m_pRC_Tables->DeactivateCell(); - m_pRC_Tables->RowInserted(m_pRC_Tables->GetRowCount(), 1, TRUE); - m_pRC_Tables->ActivateCell(); - } -} //------------------------------------------------------------------------ IMPL_LINK( ORelationDialog, OKClickHdl, Button*, pButton ) @@ -699,35 +255,19 @@ IMPL_LINK( ORelationDialog, OKClickHdl, Button*, pButton ) nAttrib |= KeyRule::SET_DEFAULT; m_pConnData->SetUpdateRules( nAttrib ); - m_pRC_Tables->SaveModified(); + m_pTableControl->SaveModified(); // wenn die ComboBoxen fuer die Tabellenauswahl enabled sind (Constructor mit bAllowTableSelect==TRUE), dann muss ich in die // Connection auch die Tabellennamen stecken - m_pConnData->SetSourceWinName(m_lmbLeftTable.GetSelectEntry()); - m_pConnData->SetDestWinName(m_lmbRightTable.GetSelectEntry()); - - // noch ein wenig Normalisierung auf den LineDatas : leere Lines vom Anfang an das Ende verschieben - OConnectionLineDataVec* pLines = m_pConnData->GetConnLineDataList(); - sal_Int32 nCount = pLines->size(); - for(sal_Int32 i=0;i<nCount;) - { - if(!(*pLines)[i]->GetSourceFieldName().getLength() && !(*pLines)[i]->GetDestFieldName().getLength()) - { - OConnectionLineDataRef pData = (*pLines)[i]; - pLines->erase(pLines->begin()+i); - pLines->push_back(pData); - --nCount; - } - else - ++i; - } + m_pConnData->SetSourceWinName(m_pTableControl->getSourceWinName()); + m_pConnData->SetDestWinName(m_pTableControl->getDestWinName()); // try to create the relation try { if (m_pConnData->Update()) { - *m_pOrigConnData = *m_pConnData; + m_pOrigConnData->CopyFrom( *m_pConnData ); EndDialog( RET_OK ); return 0L; } @@ -749,81 +289,11 @@ IMPL_LINK( ORelationDialog, OKClickHdl, Button*, pButton ) // try again Init(m_pConnData); + m_pTableControl->Init( m_pConnData ); return 0; } -//------------------------------------------------------------------------ -IMPL_LINK( ORelationDialog, OnTableChanged, ListBox*, pListBox ) -{ - String strSelected(pListBox->GetSelectEntry()); - OJoinTableView::OTableWindowMap* pTabWins = static_cast<OJoinTableView*>(GetParent())->GetTabWinMap(); - - // eine Sonderbehandlung : wenn es nur zwei Tabellen gibt, muss ich bei Wechsel in einer LB auch in der anderen umschalten - if (pTabWins->size() == 2) - { - ListBox* pOther; - if (pListBox == &m_lmbLeftTable) - pOther = &m_lmbRightTable; - else - pOther = &m_lmbLeftTable; - pOther->SelectEntryPos(1 - pOther->GetSelectEntryPos()); - - OJoinTableView::OTableWindowMap::const_iterator aIter = pTabWins->begin(); - OTableWindow* pFirst = aIter->second; - ++aIter; - OTableWindow* pSecond = aIter->second; - - Reference< XPropertySet> xLeftTable, xRightTable; - if (m_lmbLeftTable.GetSelectEntry() == String(pFirst->GetComposedName())) - { - xLeftTable = pFirst->GetTable(); - xRightTable = pSecond->GetTable(); - } - else - { - xRightTable = pFirst->GetTable(); - xLeftTable = pSecond->GetTable(); - } - m_pRC_Tables->SetSourceDef(xLeftTable); - m_pRC_Tables->SetDestDef(xRightTable); - } - else - { - // zuerst brauche ich die TableDef zur Tabelle, dazu das TabWin - OTableWindow* pLoop = (*pTabWins)[strSelected]; - DBG_ASSERT(pLoop != NULL, "ORelationDialog::OnTableChanged : ungueltiger Eintrag in ListBox !"); - // da ich die ListBoxen selber mit eben diesen Tabellennamen, mit denen ich sie jetzt vergleiche, gefuellt habe, - // MUSS ich strSelected finden - if (pListBox == &m_lmbLeftTable) - { - m_pRC_Tables->SetSourceDef(pLoop->GetTable()); - - // den vorher links selektierten Eintrag wieder rein rechts - m_lmbRightTable.InsertEntry(m_strCurrentLeft); - // und den jetzt selektierten raus - m_lmbRightTable.RemoveEntry(strSelected); - m_strCurrentLeft = strSelected; - - m_lmbLeftTable.GrabFocus(); - } - else - { - m_pRC_Tables->SetDestDef(pLoop->GetTable()); - - // den vorher rechts selektierten Eintrag wieder rein links - m_lmbLeftTable.InsertEntry(m_strCurrentRight); - // und den jetzt selektierten raus - m_lmbLeftTable.RemoveEntry(strSelected); - m_strCurrentRight = strSelected; - } - } - - pListBox->GrabFocus(); - - NotifyCellChange(); - return 0; -} //------------------------------------------------------------------------ short ORelationDialog::Execute() @@ -835,5 +305,20 @@ short ORelationDialog::Execute() return nResult; } // ----------------------------------------------------------------------------- +OTableConnectionData* ORelationDialog::getConnectionData() const +{ + return m_pConnData; +} +// ----------------------------------------------------------------------------- +void ORelationDialog::setValid(sal_Bool _bValid) +{ + aPB_OK.Enable(_bValid); +} +// ----------------------------------------------------------------------------- +void ORelationDialog::notifyConnectionChange(OTableConnectionData* _pConnectionData) +{ + Init(m_pConnData); +} +// ----------------------------------------------------------------------------- |