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_RELATIONCONTROL_HXX 31*cdf0e10cSrcweir #include "RelationControl.hxx" 32*cdf0e10cSrcweir #endif 33*cdf0e10cSrcweir #ifndef DBACCESS_SOURCE_UI_INC_RELATIONCONTROL_HRC 34*cdf0e10cSrcweir #include "RelationControl.hrc" 35*cdf0e10cSrcweir #endif 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #ifndef _SVTOOLS_EDITBROWSEBOX_HXX_ 38*cdf0e10cSrcweir #include <svtools/editbrowsebox.hxx> 39*cdf0e10cSrcweir #endif 40*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ 41*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 42*cdf0e10cSrcweir #endif 43*cdf0e10cSrcweir #ifndef _TOOLS_DEBUG_HXX 44*cdf0e10cSrcweir #include <tools/debug.hxx> 45*cdf0e10cSrcweir #endif 46*cdf0e10cSrcweir #ifndef TOOLS_DIAGNOSE_EX_H 47*cdf0e10cSrcweir #include <tools/diagnose_ex.h> 48*cdf0e10cSrcweir #endif 49*cdf0e10cSrcweir #ifndef DBAUI_TABLECONNECTIONDATA_HXX 50*cdf0e10cSrcweir #include "TableConnectionData.hxx" 51*cdf0e10cSrcweir #endif 52*cdf0e10cSrcweir #ifndef DBAUI_TABLECONNECTION_HXX 53*cdf0e10cSrcweir #include "TableConnection.hxx" 54*cdf0e10cSrcweir #endif 55*cdf0e10cSrcweir #ifndef DBAUI_TABLEWINDOW_HXX 56*cdf0e10cSrcweir #include "TableWindow.hxx" 57*cdf0e10cSrcweir #endif 58*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ 59*cdf0e10cSrcweir #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> 60*cdf0e10cSrcweir #endif 61*cdf0e10cSrcweir #ifndef DBAUI_TOOLS_HXX 62*cdf0e10cSrcweir #include "UITools.hxx" 63*cdf0e10cSrcweir #endif 64*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ 65*cdf0e10cSrcweir #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> 66*cdf0e10cSrcweir #endif 67*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ 68*cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 69*cdf0e10cSrcweir #endif 70*cdf0e10cSrcweir #ifndef DBAUI_RELCONTROLIFACE_HXX 71*cdf0e10cSrcweir #include "RelControliFace.hxx" 72*cdf0e10cSrcweir #endif 73*cdf0e10cSrcweir #ifndef _DBU_CONTROL_HRC_ 74*cdf0e10cSrcweir #include "dbu_control.hrc" 75*cdf0e10cSrcweir #endif 76*cdf0e10cSrcweir #ifndef _DBA_DBACCESS_HELPID_HRC_ 77*cdf0e10cSrcweir #include "dbaccess_helpid.hrc" 78*cdf0e10cSrcweir #endif 79*cdf0e10cSrcweir #ifndef _TOOLS_DEBUG_HXX 80*cdf0e10cSrcweir #include <tools/debug.hxx> 81*cdf0e10cSrcweir #endif 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir #include <algorithm> 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir #define SOURCE_COLUMN 1 86*cdf0e10cSrcweir #define DEST_COLUMN 2 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir namespace dbaui 89*cdf0e10cSrcweir { 90*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 91*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 92*cdf0e10cSrcweir using namespace ::com::sun::star::sdbc; 93*cdf0e10cSrcweir using namespace ::com::sun::star::sdbcx; 94*cdf0e10cSrcweir using namespace ::com::sun::star::container; 95*cdf0e10cSrcweir using namespace svt; 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir typedef ::svt::EditBrowseBox ORelationControl_Base; 98*cdf0e10cSrcweir class ORelationControl : public ORelationControl_Base 99*cdf0e10cSrcweir { 100*cdf0e10cSrcweir friend class OTableListBoxControl; 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir ::std::auto_ptr< ::svt::ListBoxControl> m_pListCell; 103*cdf0e10cSrcweir TTableConnectionData::value_type m_pConnData; 104*cdf0e10cSrcweir const OJoinTableView::OTableWindowMap* m_pTableMap; 105*cdf0e10cSrcweir OTableListBoxControl* m_pBoxControl; 106*cdf0e10cSrcweir long m_nDataPos; 107*cdf0e10cSrcweir Reference< XPropertySet> m_xSourceDef; 108*cdf0e10cSrcweir Reference< XPropertySet> m_xDestDef; 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir void fillListBox(const Reference< XPropertySet>& _xDest,long nRow,sal_uInt16 nColumnId); 112*cdf0e10cSrcweir /** returns the column id for the editbrowsebox 113*cdf0e10cSrcweir @param _nColId 114*cdf0e10cSrcweir the column id SOURCE_COLUMN or DEST_COLUMN 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir @return the current column id eihter SOURCE_COLUMN or DEST_COLUMN depends on the connection data 117*cdf0e10cSrcweir */ 118*cdf0e10cSrcweir sal_uInt16 getColumnIdent( sal_uInt16 _nColId ) const; 119*cdf0e10cSrcweir public: 120*cdf0e10cSrcweir ORelationControl( OTableListBoxControl* pParent,const OJoinTableView::OTableWindowMap* _pTableMap ); 121*cdf0e10cSrcweir virtual ~ORelationControl(); 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir /** searches for a connection between these two tables 124*cdf0e10cSrcweir @param _pSource 125*cdf0e10cSrcweir the left table 126*cdf0e10cSrcweir @param _pDest 127*cdf0e10cSrcweir the right window 128*cdf0e10cSrcweir */ 129*cdf0e10cSrcweir void setWindowTables(const OTableWindow* _pSource,const OTableWindow* _pDest); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir /** allows to access the connection data from outside 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir @return rthe connection data 134*cdf0e10cSrcweir */ 135*cdf0e10cSrcweir inline TTableConnectionData::value_type getData() const { return m_pConnData; } 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir void lateInit(); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir protected: 140*cdf0e10cSrcweir virtual void Resize(); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir virtual long PreNotify(NotifyEvent& rNEvt ); 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir virtual sal_Bool IsTabAllowed(sal_Bool bForward) const; 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir virtual void Init(const TTableConnectionData::value_type& _pConnData); 147*cdf0e10cSrcweir virtual void Init() { ORelationControl_Base::Init(); } 148*cdf0e10cSrcweir virtual void InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol ); 149*cdf0e10cSrcweir virtual ::svt::CellController* GetController( long nRow, sal_uInt16 nCol ); 150*cdf0e10cSrcweir virtual void PaintCell( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColId ) const; 151*cdf0e10cSrcweir virtual sal_Bool SeekRow( long nRow ); 152*cdf0e10cSrcweir virtual sal_Bool SaveModified(); 153*cdf0e10cSrcweir virtual String GetCellText( long nRow, sal_uInt16 nColId ) const; 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir virtual void CellModified(); 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir DECL_LINK( AsynchDeactivate, void* ); 158*cdf0e10cSrcweir private: 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir DECL_LINK( AsynchActivate, void* ); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir }; 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir //======================================================================== 165*cdf0e10cSrcweir // class ORelationControl 166*cdf0e10cSrcweir //======================================================================== 167*cdf0e10cSrcweir DBG_NAME(ORelationControl) 168*cdf0e10cSrcweir //------------------------------------------------------------------------ 169*cdf0e10cSrcweir ORelationControl::ORelationControl( OTableListBoxControl* pParent ,const OJoinTableView::OTableWindowMap* _pTableMap) 170*cdf0e10cSrcweir :EditBrowseBox( pParent, EBBF_SMART_TAB_TRAVEL | EBBF_NOROWPICTURE, WB_TABSTOP | /*WB_3DLOOK | */WB_BORDER | BROWSER_AUTOSIZE_LASTCOL) 171*cdf0e10cSrcweir ,m_pTableMap(_pTableMap) 172*cdf0e10cSrcweir ,m_pBoxControl(pParent) 173*cdf0e10cSrcweir ,m_xSourceDef( NULL ) 174*cdf0e10cSrcweir ,m_xDestDef( NULL ) 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir DBG_CTOR(ORelationControl,NULL); 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir //------------------------------------------------------------------------ 180*cdf0e10cSrcweir ORelationControl::~ORelationControl() 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir DBG_DTOR(ORelationControl,NULL); 183*cdf0e10cSrcweir } 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir //------------------------------------------------------------------------ 186*cdf0e10cSrcweir void ORelationControl::Init(const TTableConnectionData::value_type& _pConnData) 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir DBG_CHKTHIS(ORelationControl,NULL); 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir m_pConnData = _pConnData; 191*cdf0e10cSrcweir OSL_ENSURE(m_pConnData, "No data supplied!"); 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir m_pConnData->normalizeLines(); 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir //------------------------------------------------------------------------------ 196*cdf0e10cSrcweir void ORelationControl::lateInit() 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir if ( !m_pConnData.get() ) 199*cdf0e10cSrcweir return; 200*cdf0e10cSrcweir m_xSourceDef = m_pConnData->getReferencingTable()->getTable(); 201*cdf0e10cSrcweir m_xDestDef = m_pConnData->getReferencedTable()->getTable(); 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir if ( ColCount() == 0 ) 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir InsertDataColumn( SOURCE_COLUMN, m_pConnData->getReferencingTable()->GetWinName(), 100); 206*cdf0e10cSrcweir InsertDataColumn( DEST_COLUMN, m_pConnData->getReferencedTable()->GetWinName(), 100); 207*cdf0e10cSrcweir // wenn es die Defs noch nicht gibt, dann muessen sie noch mit SetSource-/-DestDef gesetzt werden ! 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir m_pListCell.reset( new ListBoxControl( &GetDataWindow() ) ); 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 212*cdf0e10cSrcweir // set browse mode 213*cdf0e10cSrcweir SetMode( BROWSER_COLUMNSELECTION | 214*cdf0e10cSrcweir BROWSER_HLINESFULL | 215*cdf0e10cSrcweir BROWSER_VLINESFULL | 216*cdf0e10cSrcweir BROWSER_HIDECURSOR | 217*cdf0e10cSrcweir BROWSER_HIDESELECT | 218*cdf0e10cSrcweir BROWSER_AUTO_HSCROLL | 219*cdf0e10cSrcweir BROWSER_AUTO_VSCROLL); 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir else 222*cdf0e10cSrcweir // not the first call 223*cdf0e10cSrcweir RowRemoved(0, GetRowCount()); 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir RowInserted(0, m_pConnData->GetConnLineDataList()->size() + 1, sal_True); // add one extra row 226*cdf0e10cSrcweir } 227*cdf0e10cSrcweir //------------------------------------------------------------------------------ 228*cdf0e10cSrcweir void ORelationControl::Resize() 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir DBG_CHKTHIS(ORelationControl,NULL); 231*cdf0e10cSrcweir EditBrowseBox::Resize(); 232*cdf0e10cSrcweir long nOutputWidth = GetOutputSizePixel().Width(); 233*cdf0e10cSrcweir SetColumnWidth(1, (nOutputWidth / 2)); 234*cdf0e10cSrcweir SetColumnWidth(2, (nOutputWidth / 2)); 235*cdf0e10cSrcweir } 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir //------------------------------------------------------------------------------ 238*cdf0e10cSrcweir long ORelationControl::PreNotify(NotifyEvent& rNEvt) 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir DBG_CHKTHIS(ORelationControl,NULL); 241*cdf0e10cSrcweir if (rNEvt.GetType() == EVENT_LOSEFOCUS && !HasChildPathFocus() ) 242*cdf0e10cSrcweir PostUserEvent(LINK(this, ORelationControl, AsynchDeactivate)); 243*cdf0e10cSrcweir else if (rNEvt.GetType() == EVENT_GETFOCUS) 244*cdf0e10cSrcweir PostUserEvent(LINK(this, ORelationControl, AsynchActivate)); 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir return EditBrowseBox::PreNotify(rNEvt); 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir //------------------------------------------------------------------------------ 250*cdf0e10cSrcweir IMPL_LINK(ORelationControl, AsynchActivate, void*, EMPTYARG) 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir ActivateCell(); 253*cdf0e10cSrcweir return 0L; 254*cdf0e10cSrcweir } 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir //------------------------------------------------------------------------------ 257*cdf0e10cSrcweir IMPL_LINK(ORelationControl, AsynchDeactivate, void*, EMPTYARG) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir DeactivateCell(); 260*cdf0e10cSrcweir return 0L; 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir //------------------------------------------------------------------------------ 264*cdf0e10cSrcweir sal_Bool ORelationControl::IsTabAllowed(sal_Bool bForward) const 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir DBG_CHKTHIS(ORelationControl,NULL); 267*cdf0e10cSrcweir long nRow = GetCurRow(); 268*cdf0e10cSrcweir sal_uInt16 nCol = GetCurColumnId(); 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir sal_Bool bRet = !(( ( bForward && (nCol == DEST_COLUMN) && (nRow == GetRowCount() - 1))) 271*cdf0e10cSrcweir || (!bForward && (nCol == SOURCE_COLUMN) && (nRow == 0))); 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir return bRet && EditBrowseBox::IsTabAllowed(bForward); 274*cdf0e10cSrcweir } 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir //------------------------------------------------------------------------------ 277*cdf0e10cSrcweir sal_Bool ORelationControl::SaveModified() 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir DBG_CHKTHIS(ORelationControl,NULL); 280*cdf0e10cSrcweir sal_Int32 nRow = GetCurRow(); 281*cdf0e10cSrcweir if ( nRow != BROWSER_ENDOFSELECTION ) 282*cdf0e10cSrcweir { 283*cdf0e10cSrcweir String sFieldName(m_pListCell->GetSelectEntry()); 284*cdf0e10cSrcweir OConnectionLineDataVec* pLines = m_pConnData->GetConnLineDataList(); 285*cdf0e10cSrcweir if ( pLines->size() <= static_cast<sal_uInt32>(nRow) ) 286*cdf0e10cSrcweir { 287*cdf0e10cSrcweir pLines->push_back(new OConnectionLineData()); 288*cdf0e10cSrcweir nRow = pLines->size() - 1; 289*cdf0e10cSrcweir } 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir OConnectionLineDataRef pConnLineData = (*pLines)[nRow]; 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir switch( getColumnIdent( GetCurColumnId() ) ) 294*cdf0e10cSrcweir { 295*cdf0e10cSrcweir case SOURCE_COLUMN: 296*cdf0e10cSrcweir pConnLineData->SetSourceFieldName( sFieldName ); 297*cdf0e10cSrcweir break; 298*cdf0e10cSrcweir case DEST_COLUMN: 299*cdf0e10cSrcweir pConnLineData->SetDestFieldName( sFieldName ); 300*cdf0e10cSrcweir break; 301*cdf0e10cSrcweir } 302*cdf0e10cSrcweir } 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir return sal_True; 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir //------------------------------------------------------------------------------ 307*cdf0e10cSrcweir sal_uInt16 ORelationControl::getColumnIdent( sal_uInt16 _nColId ) const 308*cdf0e10cSrcweir { 309*cdf0e10cSrcweir sal_uInt16 nId = _nColId; 310*cdf0e10cSrcweir if ( m_pConnData->getReferencingTable() != m_pBoxControl->getReferencingTable() ) 311*cdf0e10cSrcweir nId = ( _nColId == SOURCE_COLUMN) ? DEST_COLUMN : SOURCE_COLUMN; 312*cdf0e10cSrcweir return nId; 313*cdf0e10cSrcweir } 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir //------------------------------------------------------------------------------ 316*cdf0e10cSrcweir String ORelationControl::GetCellText( long nRow, sal_uInt16 nColId ) const 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir DBG_CHKTHIS(ORelationControl,NULL); 319*cdf0e10cSrcweir String sText; 320*cdf0e10cSrcweir if ( m_pConnData->GetConnLineDataList()->size() > static_cast<size_t>(nRow) ) 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir OConnectionLineDataRef pConnLineData = (*m_pConnData->GetConnLineDataList())[nRow]; 323*cdf0e10cSrcweir switch( getColumnIdent( nColId ) ) 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir case SOURCE_COLUMN: 326*cdf0e10cSrcweir sText = pConnLineData->GetSourceFieldName(); 327*cdf0e10cSrcweir break; 328*cdf0e10cSrcweir case DEST_COLUMN: 329*cdf0e10cSrcweir sText = pConnLineData->GetDestFieldName(); 330*cdf0e10cSrcweir break; 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir } 333*cdf0e10cSrcweir return sText; 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir //------------------------------------------------------------------------------ 337*cdf0e10cSrcweir void ORelationControl::InitController( CellControllerRef& /*rController*/, long nRow, sal_uInt16 nColumnId ) 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir DBG_CHKTHIS(ORelationControl,NULL); 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir rtl::OString sHelpId( HID_RELATIONDIALOG_LEFTFIELDCELL ); 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir Reference< XPropertySet> xDef; 344*cdf0e10cSrcweir switch ( getColumnIdent(nColumnId) ) 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir case SOURCE_COLUMN: 347*cdf0e10cSrcweir xDef = m_xSourceDef; 348*cdf0e10cSrcweir sHelpId = HID_RELATIONDIALOG_LEFTFIELDCELL; 349*cdf0e10cSrcweir break; 350*cdf0e10cSrcweir case DEST_COLUMN: 351*cdf0e10cSrcweir xDef = m_xDestDef; 352*cdf0e10cSrcweir sHelpId = HID_RELATIONDIALOG_RIGHTFIELDCELL; 353*cdf0e10cSrcweir break; 354*cdf0e10cSrcweir default: 355*cdf0e10cSrcweir // ????????? 356*cdf0e10cSrcweir break; 357*cdf0e10cSrcweir } 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir if ( xDef.is() ) 360*cdf0e10cSrcweir { 361*cdf0e10cSrcweir fillListBox(xDef,nRow,nColumnId); 362*cdf0e10cSrcweir String sName = GetCellText( nRow, nColumnId ); 363*cdf0e10cSrcweir m_pListCell->SelectEntry( sName ); 364*cdf0e10cSrcweir if ( m_pListCell->GetSelectEntry() != sName ) 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir m_pListCell->InsertEntry( sName ); 367*cdf0e10cSrcweir m_pListCell->SelectEntry( sName ); 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir m_pListCell->SetHelpId(sHelpId); 371*cdf0e10cSrcweir } 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir //------------------------------------------------------------------------------ 375*cdf0e10cSrcweir CellController* ORelationControl::GetController( long /*nRow*/, sal_uInt16 /*nColumnId*/ ) 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir DBG_CHKTHIS(ORelationControl,NULL); 378*cdf0e10cSrcweir return new ListBoxCellController( m_pListCell.get() ); 379*cdf0e10cSrcweir } 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir //------------------------------------------------------------------------------ 382*cdf0e10cSrcweir sal_Bool ORelationControl::SeekRow( long nRow ) 383*cdf0e10cSrcweir { 384*cdf0e10cSrcweir DBG_CHKTHIS(ORelationControl,NULL); 385*cdf0e10cSrcweir m_nDataPos = nRow; 386*cdf0e10cSrcweir return sal_True; 387*cdf0e10cSrcweir } 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir //------------------------------------------------------------------------------ 390*cdf0e10cSrcweir void ORelationControl::PaintCell( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const 391*cdf0e10cSrcweir { 392*cdf0e10cSrcweir DBG_CHKTHIS(ORelationControl,NULL); 393*cdf0e10cSrcweir String aText =const_cast< ORelationControl*>(this)->GetCellText( m_nDataPos, nColumnId ); 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir Point aPos( rRect.TopLeft() ); 396*cdf0e10cSrcweir Size aTextSize( GetDataWindow().GetTextHeight(),GetDataWindow().GetTextWidth( aText )); 397*cdf0e10cSrcweir 398*cdf0e10cSrcweir if( aPos.X() < rRect.Right() || aPos.X() + aTextSize.Width() > rRect.Right() || 399*cdf0e10cSrcweir aPos.Y() < rRect.Top() || aPos.Y() + aTextSize.Height() > rRect.Bottom() ) 400*cdf0e10cSrcweir rDev.SetClipRegion( rRect ); 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir rDev.DrawText( aPos, aText ); 403*cdf0e10cSrcweir 404*cdf0e10cSrcweir if( rDev.IsClipRegion() ) 405*cdf0e10cSrcweir rDev.SetClipRegion(); 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 408*cdf0e10cSrcweir void ORelationControl::fillListBox(const Reference< XPropertySet>& _xDest,long /*_nRow*/,sal_uInt16 /*nColumnId*/) 409*cdf0e10cSrcweir { 410*cdf0e10cSrcweir m_pListCell->Clear(); 411*cdf0e10cSrcweir try 412*cdf0e10cSrcweir { 413*cdf0e10cSrcweir if ( _xDest.is() ) 414*cdf0e10cSrcweir { 415*cdf0e10cSrcweir //sal_Int32 nRows = GetRowCount(); 416*cdf0e10cSrcweir Reference<XColumnsSupplier> xSup(_xDest,UNO_QUERY); 417*cdf0e10cSrcweir Reference<XNameAccess> xColumns = xSup->getColumns(); 418*cdf0e10cSrcweir Sequence< ::rtl::OUString> aNames = xColumns->getElementNames(); 419*cdf0e10cSrcweir const ::rtl::OUString* pIter = aNames.getConstArray(); 420*cdf0e10cSrcweir const ::rtl::OUString* pEnd = pIter + aNames.getLength(); 421*cdf0e10cSrcweir for(;pIter != pEnd;++pIter) 422*cdf0e10cSrcweir { 423*cdf0e10cSrcweir m_pListCell->InsertEntry( *pIter ); 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir m_pListCell->InsertEntry(String(), 0); 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir } 428*cdf0e10cSrcweir catch( const Exception& ) 429*cdf0e10cSrcweir { 430*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 431*cdf0e10cSrcweir } 432*cdf0e10cSrcweir } 433*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 434*cdf0e10cSrcweir void ORelationControl::setWindowTables(const OTableWindow* _pSource,const OTableWindow* _pDest) 435*cdf0e10cSrcweir { 436*cdf0e10cSrcweir // wenn ich hier gerade editiere, ausblenden 437*cdf0e10cSrcweir sal_Bool bWasEditing = IsEditing(); 438*cdf0e10cSrcweir if ( bWasEditing ) 439*cdf0e10cSrcweir DeactivateCell(); 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir if ( _pSource && _pDest ) 442*cdf0e10cSrcweir { 443*cdf0e10cSrcweir m_xSourceDef = _pSource->GetTable(); 444*cdf0e10cSrcweir SetColumnTitle(1, _pSource->GetName()); 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir m_xDestDef = _pDest->GetTable(); 448*cdf0e10cSrcweir SetColumnTitle(2, _pDest->GetName()); 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir const OJoinTableView* pView = _pSource->getTableView(); 451*cdf0e10cSrcweir OTableConnection* pConn = pView->GetTabConn(_pSource,_pDest); 452*cdf0e10cSrcweir if ( pConn && !m_pConnData->GetConnLineDataList()->empty() ) 453*cdf0e10cSrcweir { 454*cdf0e10cSrcweir m_pConnData->CopyFrom(*pConn->GetData()); 455*cdf0e10cSrcweir m_pBoxControl->getContainer()->notifyConnectionChange(); 456*cdf0e10cSrcweir } 457*cdf0e10cSrcweir else 458*cdf0e10cSrcweir { 459*cdf0e10cSrcweir // no connection found so we clear our data 460*cdf0e10cSrcweir OConnectionLineDataVec* pLines = m_pConnData->GetConnLineDataList(); 461*cdf0e10cSrcweir ::std::for_each(pLines->begin(), 462*cdf0e10cSrcweir pLines->end(), 463*cdf0e10cSrcweir OUnaryRefFunctor<OConnectionLineData>( ::std::mem_fun(&OConnectionLineData::Reset)) 464*cdf0e10cSrcweir ); 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir m_pConnData->setReferencingTable(_pSource->GetData()); 467*cdf0e10cSrcweir m_pConnData->setReferencedTable(_pDest->GetData()); 468*cdf0e10cSrcweir } 469*cdf0e10cSrcweir m_pConnData->normalizeLines(); 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir } 472*cdf0e10cSrcweir // neu zeichnen 473*cdf0e10cSrcweir Invalidate(); 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir if ( bWasEditing ) 476*cdf0e10cSrcweir { 477*cdf0e10cSrcweir GoToRow(0); 478*cdf0e10cSrcweir ActivateCell(); 479*cdf0e10cSrcweir } 480*cdf0e10cSrcweir } 481*cdf0e10cSrcweir //------------------------------------------------------------------------ 482*cdf0e10cSrcweir void ORelationControl::CellModified() 483*cdf0e10cSrcweir { 484*cdf0e10cSrcweir DBG_CHKTHIS(ORelationControl,NULL); 485*cdf0e10cSrcweir EditBrowseBox::CellModified(); 486*cdf0e10cSrcweir SaveModified(); 487*cdf0e10cSrcweir static_cast<OTableListBoxControl*>(GetParent())->NotifyCellChange(); 488*cdf0e10cSrcweir } 489*cdf0e10cSrcweir //======================================================================== 490*cdf0e10cSrcweir // class OTableListBoxControl 491*cdf0e10cSrcweir DBG_NAME(OTableListBoxControl) 492*cdf0e10cSrcweir 493*cdf0e10cSrcweir //======================================================================== 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir OTableListBoxControl::OTableListBoxControl( Window* _pParent 496*cdf0e10cSrcweir ,const ResId& _rResId 497*cdf0e10cSrcweir ,const OJoinTableView::OTableWindowMap* _pTableMap 498*cdf0e10cSrcweir ,IRelationControlInterface* _pParentDialog) 499*cdf0e10cSrcweir : Window(_pParent,_rResId) 500*cdf0e10cSrcweir , m_aFL_InvolvedTables( this, ResId(FL_INVOLVED_TABLES,*_rResId.GetResMgr())) 501*cdf0e10cSrcweir , m_lmbLeftTable( this, ResId(LB_LEFT_TABLE,*_rResId.GetResMgr())) 502*cdf0e10cSrcweir , m_lmbRightTable( this, ResId(LB_RIGHT_TABLE,*_rResId.GetResMgr())) 503*cdf0e10cSrcweir , m_aFL_InvolvedFields( this, ResId(FL_INVOLVED_FIELDS,*_rResId.GetResMgr())) 504*cdf0e10cSrcweir , m_pTableMap(_pTableMap) 505*cdf0e10cSrcweir , m_pParentDialog(_pParentDialog) 506*cdf0e10cSrcweir { 507*cdf0e10cSrcweir m_pRC_Tables = new ORelationControl( this,m_pTableMap ); 508*cdf0e10cSrcweir m_pRC_Tables->SetHelpId(HID_RELDLG_KEYFIELDS); 509*cdf0e10cSrcweir m_pRC_Tables->Init( ); 510*cdf0e10cSrcweir m_pRC_Tables->SetZOrder(&m_lmbRightTable, WINDOW_ZORDER_BEHIND); 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir lateUIInit(); 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir Link aLink(LINK(this, OTableListBoxControl, OnTableChanged)); 515*cdf0e10cSrcweir m_lmbLeftTable.SetSelectHdl(aLink); 516*cdf0e10cSrcweir m_lmbRightTable.SetSelectHdl(aLink); 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir FreeResource(); 519*cdf0e10cSrcweir DBG_CTOR(OTableListBoxControl,NULL); 520*cdf0e10cSrcweir } 521*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 522*cdf0e10cSrcweir OTableListBoxControl::~OTableListBoxControl() 523*cdf0e10cSrcweir { 524*cdf0e10cSrcweir ORelationControl* pTemp = m_pRC_Tables; 525*cdf0e10cSrcweir m_pRC_Tables = NULL; 526*cdf0e10cSrcweir delete pTemp; 527*cdf0e10cSrcweir DBG_DTOR(OTableListBoxControl,NULL); 528*cdf0e10cSrcweir } 529*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 530*cdf0e10cSrcweir void OTableListBoxControl::fillListBoxes() 531*cdf0e10cSrcweir { 532*cdf0e10cSrcweir DBG_ASSERT( !m_pTableMap->empty(), "OTableListBoxControl::fillListBoxes: no table window!"); 533*cdf0e10cSrcweir OTableWindow* pInitialLeft = NULL; 534*cdf0e10cSrcweir OTableWindow* pInitialRight = NULL; 535*cdf0e10cSrcweir 536*cdf0e10cSrcweir // die Namen aller TabWins einsammeln 537*cdf0e10cSrcweir OJoinTableView::OTableWindowMap::const_iterator aIter = m_pTableMap->begin(); 538*cdf0e10cSrcweir OJoinTableView::OTableWindowMap::const_iterator aEnd = m_pTableMap->end(); 539*cdf0e10cSrcweir for(;aIter != aEnd;++aIter) 540*cdf0e10cSrcweir { 541*cdf0e10cSrcweir m_lmbLeftTable.InsertEntry(aIter->first); 542*cdf0e10cSrcweir m_lmbRightTable.InsertEntry(aIter->first); 543*cdf0e10cSrcweir 544*cdf0e10cSrcweir if (!pInitialLeft) 545*cdf0e10cSrcweir { 546*cdf0e10cSrcweir pInitialLeft = aIter->second; 547*cdf0e10cSrcweir m_strCurrentLeft = aIter->first; 548*cdf0e10cSrcweir } 549*cdf0e10cSrcweir else if (!pInitialRight) 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir pInitialRight = aIter->second; 552*cdf0e10cSrcweir m_strCurrentRight = aIter->first; 553*cdf0e10cSrcweir } 554*cdf0e10cSrcweir } // for(;aIter != m_pTableMap->end();++aIter) 555*cdf0e10cSrcweir 556*cdf0e10cSrcweir if ( !pInitialRight ) 557*cdf0e10cSrcweir { 558*cdf0e10cSrcweir pInitialRight = pInitialLeft; 559*cdf0e10cSrcweir m_strCurrentRight = m_strCurrentLeft; 560*cdf0e10cSrcweir } 561*cdf0e10cSrcweir 562*cdf0e10cSrcweir // die entsprechenden Defs an mein Controls 563*cdf0e10cSrcweir m_pRC_Tables->setWindowTables(pInitialLeft,pInitialRight); 564*cdf0e10cSrcweir 565*cdf0e10cSrcweir // die in einer ComboBox ausgewaehlte Tabelle darf nicht in der anderen zur Verfuegung stehen 566*cdf0e10cSrcweir 567*cdf0e10cSrcweir if ( m_pTableMap->size() > 2 ) 568*cdf0e10cSrcweir { 569*cdf0e10cSrcweir m_lmbLeftTable.RemoveEntry(m_strCurrentRight); 570*cdf0e10cSrcweir m_lmbRightTable.RemoveEntry(m_strCurrentLeft); 571*cdf0e10cSrcweir } 572*cdf0e10cSrcweir 573*cdf0e10cSrcweir // links das erste, rechts das zweite selektieren 574*cdf0e10cSrcweir m_lmbLeftTable.SelectEntry(m_strCurrentLeft); 575*cdf0e10cSrcweir m_lmbRightTable.SelectEntry(m_strCurrentRight); 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir m_lmbLeftTable.GrabFocus(); 578*cdf0e10cSrcweir } 579*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 580*cdf0e10cSrcweir IMPL_LINK( OTableListBoxControl, OnTableChanged, ListBox*, pListBox ) 581*cdf0e10cSrcweir { 582*cdf0e10cSrcweir String strSelected(pListBox->GetSelectEntry()); 583*cdf0e10cSrcweir OTableWindow* pLeft = NULL; 584*cdf0e10cSrcweir OTableWindow* pRight = NULL; 585*cdf0e10cSrcweir 586*cdf0e10cSrcweir // eine Sonderbehandlung : wenn es nur zwei Tabellen gibt, muss ich bei Wechsel in einer LB auch in der anderen umschalten 587*cdf0e10cSrcweir if ( m_pTableMap->size() == 2 ) 588*cdf0e10cSrcweir { 589*cdf0e10cSrcweir ListBox* pOther; 590*cdf0e10cSrcweir if ( pListBox == &m_lmbLeftTable ) 591*cdf0e10cSrcweir pOther = &m_lmbRightTable; 592*cdf0e10cSrcweir else 593*cdf0e10cSrcweir pOther = &m_lmbLeftTable; 594*cdf0e10cSrcweir pOther->SelectEntryPos(1 - pOther->GetSelectEntryPos()); 595*cdf0e10cSrcweir 596*cdf0e10cSrcweir OJoinTableView::OTableWindowMap::const_iterator aIter = m_pTableMap->begin(); 597*cdf0e10cSrcweir OTableWindow* pFirst = aIter->second; 598*cdf0e10cSrcweir ++aIter; 599*cdf0e10cSrcweir OTableWindow* pSecond = aIter->second; 600*cdf0e10cSrcweir 601*cdf0e10cSrcweir if ( m_lmbLeftTable.GetSelectEntry() == String(pFirst->GetName()) ) 602*cdf0e10cSrcweir { 603*cdf0e10cSrcweir pLeft = pFirst; 604*cdf0e10cSrcweir pRight = pSecond; 605*cdf0e10cSrcweir } 606*cdf0e10cSrcweir else 607*cdf0e10cSrcweir { 608*cdf0e10cSrcweir pLeft = pSecond; 609*cdf0e10cSrcweir pRight = pFirst; 610*cdf0e10cSrcweir } 611*cdf0e10cSrcweir } 612*cdf0e10cSrcweir else 613*cdf0e10cSrcweir { 614*cdf0e10cSrcweir // zuerst brauche ich die TableDef zur Tabelle, dazu das TabWin 615*cdf0e10cSrcweir OJoinTableView::OTableWindowMap::const_iterator aFind = m_pTableMap->find(strSelected); 616*cdf0e10cSrcweir OTableWindow* pLoop = NULL; 617*cdf0e10cSrcweir if( aFind != m_pTableMap->end() ) 618*cdf0e10cSrcweir pLoop = aFind->second; 619*cdf0e10cSrcweir DBG_ASSERT(pLoop != NULL, "ORelationDialog::OnTableChanged : ungueltiger Eintrag in ListBox !"); 620*cdf0e10cSrcweir // da ich die ListBoxen selber mit eben diesen Tabellennamen, mit denen ich sie jetzt vergleiche, gefuellt habe, 621*cdf0e10cSrcweir // MUSS ich strSelected finden 622*cdf0e10cSrcweir if (pListBox == &m_lmbLeftTable) 623*cdf0e10cSrcweir { 624*cdf0e10cSrcweir // den vorher links selektierten Eintrag wieder rein rechts 625*cdf0e10cSrcweir m_lmbRightTable.InsertEntry(m_strCurrentLeft); 626*cdf0e10cSrcweir // und den jetzt selektierten raus 627*cdf0e10cSrcweir m_lmbRightTable.RemoveEntry(strSelected); 628*cdf0e10cSrcweir m_strCurrentLeft = strSelected; 629*cdf0e10cSrcweir 630*cdf0e10cSrcweir pLeft = pLoop; 631*cdf0e10cSrcweir 632*cdf0e10cSrcweir OJoinTableView::OTableWindowMap::const_iterator aIter = m_pTableMap->find(m_lmbRightTable.GetSelectEntry()); 633*cdf0e10cSrcweir OSL_ENSURE( aIter != m_pTableMap->end(), "Invalid name"); 634*cdf0e10cSrcweir if ( aIter != m_pTableMap->end() ) 635*cdf0e10cSrcweir pRight = aIter->second; 636*cdf0e10cSrcweir 637*cdf0e10cSrcweir m_lmbLeftTable.GrabFocus(); 638*cdf0e10cSrcweir } 639*cdf0e10cSrcweir else 640*cdf0e10cSrcweir { 641*cdf0e10cSrcweir // den vorher rechts selektierten Eintrag wieder rein links 642*cdf0e10cSrcweir m_lmbLeftTable.InsertEntry(m_strCurrentRight); 643*cdf0e10cSrcweir // und den jetzt selektierten raus 644*cdf0e10cSrcweir m_lmbLeftTable.RemoveEntry(strSelected); 645*cdf0e10cSrcweir m_strCurrentRight = strSelected; 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir pRight = pLoop; 648*cdf0e10cSrcweir OJoinTableView::OTableWindowMap::const_iterator aIter = m_pTableMap->find(m_lmbLeftTable.GetSelectEntry()); 649*cdf0e10cSrcweir OSL_ENSURE( aIter != m_pTableMap->end(), "Invalid name"); 650*cdf0e10cSrcweir if ( aIter != m_pTableMap->end() ) 651*cdf0e10cSrcweir pLeft = aIter->second; 652*cdf0e10cSrcweir } 653*cdf0e10cSrcweir } 654*cdf0e10cSrcweir 655*cdf0e10cSrcweir pListBox->GrabFocus(); 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir m_pRC_Tables->setWindowTables(pLeft,pRight); 658*cdf0e10cSrcweir 659*cdf0e10cSrcweir NotifyCellChange(); 660*cdf0e10cSrcweir return 0; 661*cdf0e10cSrcweir } 662*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 663*cdf0e10cSrcweir void OTableListBoxControl::NotifyCellChange() 664*cdf0e10cSrcweir { 665*cdf0e10cSrcweir // den Ok-Button en- oder disablen, je nachdem, ob ich eine gueltige Situation habe 666*cdf0e10cSrcweir TTableConnectionData::value_type pConnData = m_pRC_Tables->getData(); 667*cdf0e10cSrcweir const OConnectionLineDataVec* pLines = pConnData->GetConnLineDataList(); 668*cdf0e10cSrcweir m_pParentDialog->setValid(!pLines->empty()); 669*cdf0e10cSrcweir 670*cdf0e10cSrcweir if ( pLines->size() >= static_cast<sal_uInt32>(m_pRC_Tables->GetRowCount()) ) 671*cdf0e10cSrcweir { 672*cdf0e10cSrcweir m_pRC_Tables->DeactivateCell(); 673*cdf0e10cSrcweir m_pRC_Tables->RowInserted(m_pRC_Tables->GetRowCount(), pLines->size() - static_cast<sal_uInt32>(m_pRC_Tables->GetRowCount()) + 1, sal_True); 674*cdf0e10cSrcweir m_pRC_Tables->ActivateCell(); 675*cdf0e10cSrcweir } 676*cdf0e10cSrcweir } 677*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 678*cdf0e10cSrcweir void fillEntryAndDisable(ListBox& _rListBox,const String& _sEntry) 679*cdf0e10cSrcweir { 680*cdf0e10cSrcweir _rListBox.InsertEntry(_sEntry); 681*cdf0e10cSrcweir _rListBox.SelectEntryPos(0); 682*cdf0e10cSrcweir _rListBox.Disable(); 683*cdf0e10cSrcweir } 684*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 685*cdf0e10cSrcweir void OTableListBoxControl::fillAndDisable(const TTableConnectionData::value_type& _pConnectionData) 686*cdf0e10cSrcweir { 687*cdf0e10cSrcweir fillEntryAndDisable(m_lmbLeftTable,_pConnectionData->getReferencingTable()->GetWinName()); 688*cdf0e10cSrcweir fillEntryAndDisable(m_lmbRightTable,_pConnectionData->getReferencedTable()->GetWinName()); 689*cdf0e10cSrcweir } 690*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 691*cdf0e10cSrcweir void OTableListBoxControl::Init(const TTableConnectionData::value_type& _pConnData) 692*cdf0e10cSrcweir { 693*cdf0e10cSrcweir m_pRC_Tables->Init(_pConnData); 694*cdf0e10cSrcweir } 695*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 696*cdf0e10cSrcweir void OTableListBoxControl::lateUIInit(Window* _pTableSeparator) 697*cdf0e10cSrcweir { 698*cdf0e10cSrcweir const sal_Int32 nDiff = LogicToPixel( Point(0,6), MAP_APPFONT ).Y(); 699*cdf0e10cSrcweir Point aDlgPoint = LogicToPixel( Point(12,43), MAP_APPFONT ); 700*cdf0e10cSrcweir if ( _pTableSeparator ) 701*cdf0e10cSrcweir { 702*cdf0e10cSrcweir _pTableSeparator->SetZOrder(&m_lmbRightTable, WINDOW_ZORDER_BEHIND); 703*cdf0e10cSrcweir m_pRC_Tables->SetZOrder(_pTableSeparator, WINDOW_ZORDER_BEHIND); 704*cdf0e10cSrcweir //aDlgPoint = m_pTableSeparator->GetPosPixel() + Point(0,aSize.Height()) + LogicToPixel( Point(0,6), MAP_APPFONT ); 705*cdf0e10cSrcweir _pTableSeparator->SetPosPixel(Point(0,m_aFL_InvolvedFields.GetPosPixel().Y())); 706*cdf0e10cSrcweir const Size aSize = _pTableSeparator->GetSizePixel(); 707*cdf0e10cSrcweir aDlgPoint.Y() = _pTableSeparator->GetPosPixel().Y() + aSize.Height(); 708*cdf0e10cSrcweir m_aFL_InvolvedFields.SetPosPixel(Point(m_aFL_InvolvedFields.GetPosPixel().X(),aDlgPoint.Y())); 709*cdf0e10cSrcweir aDlgPoint.Y() += nDiff + m_aFL_InvolvedFields.GetSizePixel().Height(); 710*cdf0e10cSrcweir } 711*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 712*cdf0e10cSrcweir // positing BrowseBox control 713*cdf0e10cSrcweir const Size aCurrentSize = GetSizePixel(); 714*cdf0e10cSrcweir Size aDlgSize = LogicToPixel( Size(24,0), MAP_APPFONT ); 715*cdf0e10cSrcweir aDlgSize.Width() = aCurrentSize.Width() - aDlgSize.Width(); 716*cdf0e10cSrcweir aDlgSize.Height() = aCurrentSize.Height() - aDlgPoint.Y() - nDiff; 717*cdf0e10cSrcweir 718*cdf0e10cSrcweir m_pRC_Tables->SetPosSizePixel( aDlgPoint, aDlgSize ); 719*cdf0e10cSrcweir m_pRC_Tables->Show(); 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir lateInit(); 722*cdf0e10cSrcweir } 723*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 724*cdf0e10cSrcweir void OTableListBoxControl::lateInit() 725*cdf0e10cSrcweir { 726*cdf0e10cSrcweir m_pRC_Tables->lateInit(); 727*cdf0e10cSrcweir } 728*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 729*cdf0e10cSrcweir sal_Bool OTableListBoxControl::SaveModified() 730*cdf0e10cSrcweir { 731*cdf0e10cSrcweir sal_Bool bRet = m_pRC_Tables->SaveModified(); 732*cdf0e10cSrcweir m_pRC_Tables->getData()->normalizeLines(); 733*cdf0e10cSrcweir return bRet; 734*cdf0e10cSrcweir } 735*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 736*cdf0e10cSrcweir TTableWindowData::value_type OTableListBoxControl::getReferencingTable() const 737*cdf0e10cSrcweir { 738*cdf0e10cSrcweir return m_pRC_Tables->getData()->getReferencingTable(); 739*cdf0e10cSrcweir } 740*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 741*cdf0e10cSrcweir void OTableListBoxControl::enableRelation(bool _bEnable) 742*cdf0e10cSrcweir { 743*cdf0e10cSrcweir if ( !_bEnable ) 744*cdf0e10cSrcweir PostUserEvent(LINK(m_pRC_Tables, ORelationControl, AsynchDeactivate)); 745*cdf0e10cSrcweir m_pRC_Tables->Enable(_bEnable); 746*cdf0e10cSrcweir 747*cdf0e10cSrcweir } 748*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 749*cdf0e10cSrcweir } 750*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 751*cdf0e10cSrcweir 752