1*96de5490SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*96de5490SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*96de5490SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*96de5490SAndrew Rist * distributed with this work for additional information 6*96de5490SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*96de5490SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*96de5490SAndrew Rist * "License"); you may not use this file except in compliance 9*96de5490SAndrew Rist * with the License. You may obtain a copy of the License at 10*96de5490SAndrew Rist * 11*96de5490SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*96de5490SAndrew Rist * 13*96de5490SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*96de5490SAndrew Rist * software distributed under the License is distributed on an 15*96de5490SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*96de5490SAndrew Rist * KIND, either express or implied. See the License for the 17*96de5490SAndrew Rist * specific language governing permissions and limitations 18*96de5490SAndrew Rist * under the License. 19*96de5490SAndrew Rist * 20*96de5490SAndrew Rist *************************************************************/ 21*96de5490SAndrew Rist 22*96de5490SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_dbaccess.hxx" 26cdf0e10cSrcweir #ifndef DBAUI_QUERYDLG_HXX 27cdf0e10cSrcweir #include "querydlg.hxx" 28cdf0e10cSrcweir #endif 29cdf0e10cSrcweir #ifndef _DBU_QRY_HRC_ 30cdf0e10cSrcweir #include "dbu_qry.hrc" 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir #ifndef DBAUI_QUERYDLG_HRC 33cdf0e10cSrcweir #include "querydlg.hrc" 34cdf0e10cSrcweir #endif 35cdf0e10cSrcweir #ifndef _TOOLS_DEBUG_HXX 36cdf0e10cSrcweir #include <tools/debug.hxx> 37cdf0e10cSrcweir #endif 38cdf0e10cSrcweir #ifndef TOOLS_DIAGNOSE_EX_H 39cdf0e10cSrcweir #include <tools/diagnose_ex.h> 40cdf0e10cSrcweir #endif 41cdf0e10cSrcweir #ifndef DBAUI_QTABLECONNECTIONDATA_HXX 42cdf0e10cSrcweir #include "QTableConnectionData.hxx" 43cdf0e10cSrcweir #endif 44cdf0e10cSrcweir #ifndef DBAUI_QUERYCONTROLLER_HXX 45cdf0e10cSrcweir #include "querycontroller.hxx" 46cdf0e10cSrcweir #endif 47cdf0e10cSrcweir #ifndef DBAUI_QUERYTABLEVIEW_HXX 48cdf0e10cSrcweir #include "QueryTableView.hxx" 49cdf0e10cSrcweir #endif 50cdf0e10cSrcweir #ifndef DBAUI_QUERYDESIGNVIEW_HXX 51cdf0e10cSrcweir #include "QueryDesignView.hxx" 52cdf0e10cSrcweir #endif 53cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ 54cdf0e10cSrcweir #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> 55cdf0e10cSrcweir #endif 56cdf0e10cSrcweir #ifndef DBAUI_RELATIONCONTROL_HXX 57cdf0e10cSrcweir #include "RelationControl.hxx" 58cdf0e10cSrcweir #endif 59cdf0e10cSrcweir #ifndef _SV_MSGBOX_HXX 60cdf0e10cSrcweir #include <vcl/msgbox.hxx> 61cdf0e10cSrcweir #endif 62cdf0e10cSrcweir 63cdf0e10cSrcweir using namespace dbaui; 64cdf0e10cSrcweir using namespace ::com::sun::star::uno; 65cdf0e10cSrcweir using namespace ::com::sun::star::container; 66cdf0e10cSrcweir using namespace ::com::sun::star::sdbc; 67cdf0e10cSrcweir 68cdf0e10cSrcweir namespace dbaui 69cdf0e10cSrcweir { 70cdf0e10cSrcweir class OJoinControl : public Window 71cdf0e10cSrcweir { 72cdf0e10cSrcweir public: 73cdf0e10cSrcweir FixedLine aFL_Join; 74cdf0e10cSrcweir FixedText aFT_Title; 75cdf0e10cSrcweir ListBox aLB_JoinType; 76cdf0e10cSrcweir CheckBox m_aCBNatural; 77cdf0e10cSrcweir 78cdf0e10cSrcweir OJoinControl(Window* _pParent,const ResId& _rResId); 79cdf0e10cSrcweir }; 80cdf0e10cSrcweir OJoinControl::OJoinControl(Window* _pParent,const ResId& _rResId) 81cdf0e10cSrcweir : Window(_pParent,_rResId) 82cdf0e10cSrcweir ,aFL_Join( this, ResId( FL_JOIN,*_rResId.GetResMgr() ) ) 83cdf0e10cSrcweir ,aFT_Title( this, ResId(FT_LISTBOXTITLE,*_rResId.GetResMgr()) ) 84cdf0e10cSrcweir ,aLB_JoinType( this, ResId(LB_JOINTYPE,*_rResId.GetResMgr()) ) 85cdf0e10cSrcweir ,m_aCBNatural( this, ResId(CB_NATURAL,*_rResId.GetResMgr()) ) 86cdf0e10cSrcweir { 87cdf0e10cSrcweir FreeResource(); 88cdf0e10cSrcweir } 89cdf0e10cSrcweir // ----------------------------------------------------------------------------- 90cdf0e10cSrcweir } // dbaui 91cdf0e10cSrcweir // ----------------------------------------------------------------------------- 92cdf0e10cSrcweir DBG_NAME(DlgQryJoin) 93cdf0e10cSrcweir DlgQryJoin::DlgQryJoin( OQueryTableView * pParent, 94cdf0e10cSrcweir const TTableConnectionData::value_type& _pData, 95cdf0e10cSrcweir OJoinTableView::OTableWindowMap* _pTableMap, 96cdf0e10cSrcweir const Reference< XConnection >& _xConnection, 97cdf0e10cSrcweir sal_Bool _bAllowTableSelect) 98cdf0e10cSrcweir :ModalDialog( pParent, ModuleRes(DLG_QRY_JOIN) ) 99cdf0e10cSrcweir ,aML_HelpText( this, ModuleRes(ML_HELPTEXT) ) 100cdf0e10cSrcweir ,aPB_OK( this, ModuleRes( PB_OK ) ) 101cdf0e10cSrcweir ,aPB_CANCEL( this, ModuleRes( PB_CANCEL ) ) 102cdf0e10cSrcweir ,aPB_HELP( this, ModuleRes( PB_HELP ) ) 103cdf0e10cSrcweir ,m_pJoinControl( NULL ) 104cdf0e10cSrcweir ,m_pTableControl( NULL ) 105cdf0e10cSrcweir ,m_pTableMap(_pTableMap) 106cdf0e10cSrcweir ,m_pTableView(pParent) 107cdf0e10cSrcweir ,eJoinType(static_cast<OQueryTableConnectionData*>(_pData.get())->GetJoinType()) 108cdf0e10cSrcweir ,m_pOrigConnData(_pData) 109cdf0e10cSrcweir ,m_xConnection(_xConnection) 110cdf0e10cSrcweir { 111cdf0e10cSrcweir DBG_CTOR(DlgQryJoin,NULL); 112cdf0e10cSrcweir 113cdf0e10cSrcweir aML_HelpText.SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() ); 114cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 115cdf0e10cSrcweir // Connection kopieren 116cdf0e10cSrcweir m_pConnData.reset(_pData->NewInstance()); 117cdf0e10cSrcweir m_pConnData->CopyFrom(*_pData); 118cdf0e10cSrcweir 119cdf0e10cSrcweir m_pTableControl = new OTableListBoxControl(this,ModuleRes(WND_CONTROL),m_pTableMap,this); 120cdf0e10cSrcweir 121cdf0e10cSrcweir m_pJoinControl = new OJoinControl(m_pTableControl,ModuleRes(WND_JOIN_CONTROL)); 122cdf0e10cSrcweir 123cdf0e10cSrcweir m_pJoinControl->Show(); 124cdf0e10cSrcweir m_pJoinControl->m_aCBNatural.Check(static_cast<OQueryTableConnectionData*>(m_pConnData.get())->isNatural()); 125cdf0e10cSrcweir m_pTableControl->Show(); 126cdf0e10cSrcweir 127cdf0e10cSrcweir if( _bAllowTableSelect ) 128cdf0e10cSrcweir { 129cdf0e10cSrcweir m_pTableControl->Init( m_pConnData ); 130cdf0e10cSrcweir m_pTableControl->fillListBoxes(); 131cdf0e10cSrcweir } 132cdf0e10cSrcweir else 133cdf0e10cSrcweir { 134cdf0e10cSrcweir m_pTableControl->fillAndDisable(m_pConnData); 135cdf0e10cSrcweir m_pTableControl->Init( m_pConnData ); 136cdf0e10cSrcweir } 137cdf0e10cSrcweir 138cdf0e10cSrcweir m_pTableControl->lateUIInit(m_pJoinControl); 139cdf0e10cSrcweir 140cdf0e10cSrcweir sal_Bool bSupportFullJoin = sal_False; 141cdf0e10cSrcweir Reference<XDatabaseMetaData> xMeta; 142cdf0e10cSrcweir try 143cdf0e10cSrcweir { 144cdf0e10cSrcweir xMeta = m_xConnection->getMetaData(); 145cdf0e10cSrcweir if ( xMeta.is() ) 146cdf0e10cSrcweir bSupportFullJoin = xMeta->supportsFullOuterJoins(); 147cdf0e10cSrcweir } 148cdf0e10cSrcweir catch(SQLException&) 149cdf0e10cSrcweir { 150cdf0e10cSrcweir } 151cdf0e10cSrcweir sal_Bool bSupportOuterJoin = sal_False; 152cdf0e10cSrcweir try 153cdf0e10cSrcweir { 154cdf0e10cSrcweir if ( xMeta.is() ) 155cdf0e10cSrcweir bSupportOuterJoin= xMeta->supportsOuterJoins(); 156cdf0e10cSrcweir } 157cdf0e10cSrcweir catch(SQLException&) 158cdf0e10cSrcweir { 159cdf0e10cSrcweir } 160cdf0e10cSrcweir 161cdf0e10cSrcweir setJoinType(eJoinType); 162cdf0e10cSrcweir 163cdf0e10cSrcweir aPB_OK.SetClickHdl( LINK(this, DlgQryJoin, OKClickHdl) ); 164cdf0e10cSrcweir 165cdf0e10cSrcweir m_pJoinControl->aLB_JoinType.SetSelectHdl(LINK(this,DlgQryJoin,LBChangeHdl)); 166cdf0e10cSrcweir m_pJoinControl->m_aCBNatural.SetToggleHdl(LINK(this,DlgQryJoin,NaturalToggleHdl)); 167cdf0e10cSrcweir 168cdf0e10cSrcweir if ( static_cast<OQueryTableView*>(pParent)->getDesignView()->getController().isReadOnly() ) 169cdf0e10cSrcweir { 170cdf0e10cSrcweir m_pJoinControl->aLB_JoinType.Disable(); 171cdf0e10cSrcweir m_pJoinControl->m_aCBNatural.Disable(); 172cdf0e10cSrcweir m_pTableControl->Disable(); 173cdf0e10cSrcweir } 174cdf0e10cSrcweir else 175cdf0e10cSrcweir { 176cdf0e10cSrcweir const sal_uInt16 nCount = m_pJoinControl->aLB_JoinType.GetEntryCount(); 177cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nCount; ++i) 178cdf0e10cSrcweir { 179cdf0e10cSrcweir const long nJoinTyp = reinterpret_cast<long>(m_pJoinControl->aLB_JoinType.GetEntryData(i)); 180cdf0e10cSrcweir if ( !bSupportFullJoin && nJoinTyp == ID_FULL_JOIN ) 181cdf0e10cSrcweir m_pJoinControl->aLB_JoinType.RemoveEntry(i); 182cdf0e10cSrcweir else if ( !bSupportOuterJoin && (nJoinTyp == ID_LEFT_JOIN || nJoinTyp == ID_RIGHT_JOIN) ) 183cdf0e10cSrcweir m_pJoinControl->aLB_JoinType.RemoveEntry(i); 184cdf0e10cSrcweir } 185cdf0e10cSrcweir 186cdf0e10cSrcweir m_pTableControl->NotifyCellChange(); 187cdf0e10cSrcweir m_pTableControl->enableRelation(!static_cast<OQueryTableConnectionData*>(m_pConnData.get())->isNatural() && eJoinType != CROSS_JOIN ); 188cdf0e10cSrcweir } 189cdf0e10cSrcweir 190cdf0e10cSrcweir FreeResource(); 191cdf0e10cSrcweir } 192cdf0e10cSrcweir 193cdf0e10cSrcweir //------------------------------------------------------------------------ 194cdf0e10cSrcweir DlgQryJoin::~DlgQryJoin() 195cdf0e10cSrcweir { 196cdf0e10cSrcweir DBG_DTOR(DlgQryJoin,NULL); 197cdf0e10cSrcweir delete m_pJoinControl; 198cdf0e10cSrcweir delete m_pTableControl; 199cdf0e10cSrcweir } 200cdf0e10cSrcweir // ----------------------------------------------------------------------------- 201cdf0e10cSrcweir IMPL_LINK( DlgQryJoin, LBChangeHdl, ListBox*, /*pListBox*/ ) 202cdf0e10cSrcweir { 203cdf0e10cSrcweir DBG_CHKTHIS(DlgQryJoin,NULL); 204cdf0e10cSrcweir if (m_pJoinControl->aLB_JoinType.GetSelectEntryPos() == m_pJoinControl->aLB_JoinType.GetSavedValue() ) 205cdf0e10cSrcweir return 1; 206cdf0e10cSrcweir 207cdf0e10cSrcweir m_pJoinControl->aLB_JoinType.SaveValue(); 208cdf0e10cSrcweir aML_HelpText.SetText(String()); 209cdf0e10cSrcweir 210cdf0e10cSrcweir m_pTableControl->enableRelation(true); 211cdf0e10cSrcweir 212cdf0e10cSrcweir String sFirstWinName = m_pConnData->getReferencingTable()->GetWinName(); 213cdf0e10cSrcweir String sSecondWinName = m_pConnData->getReferencedTable()->GetWinName(); 214cdf0e10cSrcweir const EJoinType eOldJoinType = eJoinType; 215cdf0e10cSrcweir sal_uInt16 nResId = 0; 216cdf0e10cSrcweir const sal_uInt16 nPos = m_pJoinControl->aLB_JoinType.GetSelectEntryPos(); 217cdf0e10cSrcweir const long nJoinType = reinterpret_cast<long>(m_pJoinControl->aLB_JoinType.GetEntryData(nPos)); 218cdf0e10cSrcweir sal_Bool bAddHint = sal_True; 219cdf0e10cSrcweir switch ( nJoinType ) 220cdf0e10cSrcweir { 221cdf0e10cSrcweir default: 222cdf0e10cSrcweir case ID_INNER_JOIN: 223cdf0e10cSrcweir nResId = STR_QUERY_INNER_JOIN; 224cdf0e10cSrcweir bAddHint = sal_False; 225cdf0e10cSrcweir eJoinType = INNER_JOIN; 226cdf0e10cSrcweir break; 227cdf0e10cSrcweir case ID_LEFT_JOIN: 228cdf0e10cSrcweir nResId = STR_QUERY_LEFTRIGHT_JOIN; 229cdf0e10cSrcweir eJoinType = LEFT_JOIN; 230cdf0e10cSrcweir break; 231cdf0e10cSrcweir case ID_RIGHT_JOIN: 232cdf0e10cSrcweir { 233cdf0e10cSrcweir nResId = STR_QUERY_LEFTRIGHT_JOIN; 234cdf0e10cSrcweir eJoinType = RIGHT_JOIN; 235cdf0e10cSrcweir String sTemp = sFirstWinName; 236cdf0e10cSrcweir sFirstWinName = sSecondWinName; 237cdf0e10cSrcweir sSecondWinName = sTemp; 238cdf0e10cSrcweir } 239cdf0e10cSrcweir break; 240cdf0e10cSrcweir case ID_FULL_JOIN: 241cdf0e10cSrcweir nResId = STR_QUERY_FULL_JOIN; 242cdf0e10cSrcweir eJoinType = FULL_JOIN; 243cdf0e10cSrcweir break; 244cdf0e10cSrcweir case ID_CROSS_JOIN: 245cdf0e10cSrcweir { 246cdf0e10cSrcweir nResId = STR_QUERY_CROSS_JOIN; 247cdf0e10cSrcweir eJoinType = CROSS_JOIN; 248cdf0e10cSrcweir 249cdf0e10cSrcweir m_pConnData->ResetConnLines(); 250cdf0e10cSrcweir m_pTableControl->lateInit(); 251cdf0e10cSrcweir m_pJoinControl->m_aCBNatural.Check(sal_False); 252cdf0e10cSrcweir m_pTableControl->enableRelation(false); 253cdf0e10cSrcweir ::rtl::OUString sEmpty; 254cdf0e10cSrcweir m_pConnData->AppendConnLine(sEmpty,sEmpty); 255cdf0e10cSrcweir aPB_OK.Enable(sal_True); 256cdf0e10cSrcweir } 257cdf0e10cSrcweir break; 258cdf0e10cSrcweir } 259cdf0e10cSrcweir 260cdf0e10cSrcweir m_pJoinControl->m_aCBNatural.Enable(eJoinType != CROSS_JOIN); 261cdf0e10cSrcweir 262cdf0e10cSrcweir if ( eJoinType != eOldJoinType && eOldJoinType == CROSS_JOIN ) 263cdf0e10cSrcweir { 264cdf0e10cSrcweir m_pConnData->ResetConnLines(); 265cdf0e10cSrcweir } 266cdf0e10cSrcweir if ( eJoinType != CROSS_JOIN ) 267cdf0e10cSrcweir { 268cdf0e10cSrcweir m_pTableControl->NotifyCellChange(); 269cdf0e10cSrcweir NaturalToggleHdl(&m_pJoinControl->m_aCBNatural); 270cdf0e10cSrcweir } 271cdf0e10cSrcweir 272cdf0e10cSrcweir m_pTableControl->Invalidate(); 273cdf0e10cSrcweir 274cdf0e10cSrcweir String sHelpText = String( ModuleRes( nResId ) ); 275cdf0e10cSrcweir if( nPos ) 276cdf0e10cSrcweir { 277cdf0e10cSrcweir sHelpText.SearchAndReplace( String( RTL_CONSTASCII_STRINGPARAM( "%1" ) ), sFirstWinName ); 278cdf0e10cSrcweir sHelpText.SearchAndReplace( String( RTL_CONSTASCII_STRINGPARAM( "%2" ) ), sSecondWinName ); 279cdf0e10cSrcweir } 280cdf0e10cSrcweir if ( bAddHint ) 281cdf0e10cSrcweir { 282cdf0e10cSrcweir sHelpText += String( RTL_CONSTASCII_STRINGPARAM( "\n" ) ); 283cdf0e10cSrcweir sHelpText += String( ModuleRes( STR_JOIN_TYPE_HINT ) ); 284cdf0e10cSrcweir } 285cdf0e10cSrcweir 286cdf0e10cSrcweir aML_HelpText.SetText( sHelpText ); 287cdf0e10cSrcweir return 1; 288cdf0e10cSrcweir } 289cdf0e10cSrcweir // ----------------------------------------------------------------------------- 290cdf0e10cSrcweir 291cdf0e10cSrcweir IMPL_LINK( DlgQryJoin, OKClickHdl, Button*, /*pButton*/ ) 292cdf0e10cSrcweir { 293cdf0e10cSrcweir DBG_CHKTHIS(DlgQryJoin,NULL); 294cdf0e10cSrcweir 295cdf0e10cSrcweir m_pConnData->Update(); 296cdf0e10cSrcweir m_pOrigConnData->CopyFrom( *m_pConnData ); 297cdf0e10cSrcweir 298cdf0e10cSrcweir EndDialog(RET_OK); 299cdf0e10cSrcweir return 1; 300cdf0e10cSrcweir } 301cdf0e10cSrcweir // ----------------------------------------------------------------------------- 302cdf0e10cSrcweir 303cdf0e10cSrcweir IMPL_LINK( DlgQryJoin, NaturalToggleHdl, CheckBox*, /*pButton*/ ) 304cdf0e10cSrcweir { 305cdf0e10cSrcweir DBG_CHKTHIS(DlgQryJoin,NULL); 306cdf0e10cSrcweir sal_Bool bChecked = m_pJoinControl->m_aCBNatural.IsChecked(); 307cdf0e10cSrcweir static_cast<OQueryTableConnectionData*>(m_pConnData.get())->setNatural(bChecked); 308cdf0e10cSrcweir m_pTableControl->enableRelation(!bChecked); 309cdf0e10cSrcweir if ( bChecked ) 310cdf0e10cSrcweir { 311cdf0e10cSrcweir m_pConnData->ResetConnLines(); 312cdf0e10cSrcweir try 313cdf0e10cSrcweir { 314cdf0e10cSrcweir Reference<XNameAccess> xReferencedTableColumns(m_pConnData->getReferencedTable()->getColumns()); 315cdf0e10cSrcweir Sequence< ::rtl::OUString> aSeq = m_pConnData->getReferencingTable()->getColumns()->getElementNames(); 316cdf0e10cSrcweir const ::rtl::OUString* pIter = aSeq.getConstArray(); 317cdf0e10cSrcweir const ::rtl::OUString* pEnd = pIter + aSeq.getLength(); 318cdf0e10cSrcweir for(;pIter != pEnd;++pIter) 319cdf0e10cSrcweir { 320cdf0e10cSrcweir if ( xReferencedTableColumns->hasByName(*pIter) ) 321cdf0e10cSrcweir m_pConnData->AppendConnLine(*pIter,*pIter); 322cdf0e10cSrcweir } 323cdf0e10cSrcweir } 324cdf0e10cSrcweir catch( const Exception& ) 325cdf0e10cSrcweir { 326cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 327cdf0e10cSrcweir } 328cdf0e10cSrcweir m_pTableControl->NotifyCellChange(); 329cdf0e10cSrcweir m_pTableControl->Invalidate(); 330cdf0e10cSrcweir } 331cdf0e10cSrcweir 332cdf0e10cSrcweir return 1; 333cdf0e10cSrcweir } 334cdf0e10cSrcweir // ----------------------------------------------------------------------------- 335cdf0e10cSrcweir TTableConnectionData::value_type DlgQryJoin::getConnectionData() const 336cdf0e10cSrcweir { 337cdf0e10cSrcweir return m_pConnData; 338cdf0e10cSrcweir } 339cdf0e10cSrcweir // ----------------------------------------------------------------------------- 340cdf0e10cSrcweir void DlgQryJoin::setValid(sal_Bool _bValid) 341cdf0e10cSrcweir { 342cdf0e10cSrcweir //LBChangeHdl(&aLB_JoinType); 343cdf0e10cSrcweir 344cdf0e10cSrcweir aPB_OK.Enable(_bValid || eJoinType == CROSS_JOIN ); 345cdf0e10cSrcweir } 346cdf0e10cSrcweir // ----------------------------------------------------------------------------- 347cdf0e10cSrcweir void DlgQryJoin::notifyConnectionChange( ) 348cdf0e10cSrcweir { 349cdf0e10cSrcweir setJoinType( static_cast<OQueryTableConnectionData*>(m_pConnData.get())->GetJoinType() ); 350cdf0e10cSrcweir m_pJoinControl->m_aCBNatural.Check(static_cast<OQueryTableConnectionData*>(m_pConnData.get())->isNatural()); 351cdf0e10cSrcweir NaturalToggleHdl(&m_pJoinControl->m_aCBNatural); 352cdf0e10cSrcweir } 353cdf0e10cSrcweir // ----------------------------------------------------------------------------- 354cdf0e10cSrcweir void DlgQryJoin::setJoinType(EJoinType _eNewJoinType) 355cdf0e10cSrcweir { 356cdf0e10cSrcweir eJoinType = _eNewJoinType; 357cdf0e10cSrcweir m_pJoinControl->m_aCBNatural.Enable(eJoinType != CROSS_JOIN); 358cdf0e10cSrcweir 359cdf0e10cSrcweir long nJoinType = 0; 360cdf0e10cSrcweir switch ( eJoinType ) 361cdf0e10cSrcweir { 362cdf0e10cSrcweir default: 363cdf0e10cSrcweir case INNER_JOIN: 364cdf0e10cSrcweir nJoinType = ID_INNER_JOIN; 365cdf0e10cSrcweir break; 366cdf0e10cSrcweir case LEFT_JOIN: 367cdf0e10cSrcweir nJoinType = ID_LEFT_JOIN; 368cdf0e10cSrcweir break; 369cdf0e10cSrcweir case RIGHT_JOIN: 370cdf0e10cSrcweir nJoinType = ID_RIGHT_JOIN; 371cdf0e10cSrcweir break; 372cdf0e10cSrcweir case FULL_JOIN: 373cdf0e10cSrcweir nJoinType = ID_FULL_JOIN; 374cdf0e10cSrcweir break; 375cdf0e10cSrcweir case CROSS_JOIN: 376cdf0e10cSrcweir nJoinType = ID_CROSS_JOIN; 377cdf0e10cSrcweir break; 378cdf0e10cSrcweir } 379cdf0e10cSrcweir 380cdf0e10cSrcweir const sal_uInt16 nCount = m_pJoinControl->aLB_JoinType.GetEntryCount(); 381cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nCount; ++i) 382cdf0e10cSrcweir { 383cdf0e10cSrcweir if ( nJoinType == reinterpret_cast<long>(m_pJoinControl->aLB_JoinType.GetEntryData(i)) ) 384cdf0e10cSrcweir { 385cdf0e10cSrcweir m_pJoinControl->aLB_JoinType.SelectEntryPos(i); 386cdf0e10cSrcweir break; 387cdf0e10cSrcweir } 388cdf0e10cSrcweir } 389cdf0e10cSrcweir 390cdf0e10cSrcweir LBChangeHdl(&m_pJoinControl->aLB_JoinType); 391cdf0e10cSrcweir } 392cdf0e10cSrcweir // ----------------------------------------------------------------------------- 393cdf0e10cSrcweir 394cdf0e10cSrcweir 395cdf0e10cSrcweir 396