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