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