2010-10-12 15:59:03 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-14 17:39:53 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2006-09-17 06:00:09 +00:00
|
|
|
|
2002-02-06 06:13:01 +00:00
|
|
|
#include "RelationControl.hxx"
|
2004-03-19 11:10:36 +00:00
|
|
|
#include "RelationControl.hrc"
|
2002-02-06 06:13:01 +00:00
|
|
|
|
|
|
|
#include <svtools/editbrowsebox.hxx>
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
2008-05-05 14:54:44 +00:00
|
|
|
#include <tools/diagnose_ex.h>
|
2014-03-13 14:42:24 +00:00
|
|
|
#include <vcl/builder.hxx>
|
2002-02-06 06:13:01 +00:00
|
|
|
#include "TableConnectionData.hxx"
|
|
|
|
#include "TableConnection.hxx"
|
|
|
|
#include "TableWindow.hxx"
|
|
|
|
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
|
|
|
|
#include "UITools.hxx"
|
|
|
|
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
|
|
|
|
#include <com/sun/star/container/XNameAccess.hpp>
|
|
|
|
#include "RelControliFace.hxx"
|
2002-08-19 07:01:32 +00:00
|
|
|
#include "dbu_control.hrc"
|
2002-02-06 06:13:01 +00:00
|
|
|
#include "dbaccess_helpid.hrc"
|
2011-02-03 00:33:36 +01:00
|
|
|
#include <osl/diagnose.h>
|
2002-02-06 06:13:01 +00:00
|
|
|
|
2002-02-18 12:35:32 +00:00
|
|
|
#include <algorithm>
|
2012-12-12 16:33:31 +01:00
|
|
|
#include <list>
|
|
|
|
using std::list;
|
|
|
|
#include <utility>
|
|
|
|
using std::pair;
|
|
|
|
using std::make_pair;
|
2002-02-18 12:35:32 +00:00
|
|
|
|
2002-02-06 13:31:05 +00:00
|
|
|
#define SOURCE_COLUMN 1
|
|
|
|
#define DEST_COLUMN 2
|
2002-02-06 06:13:01 +00:00
|
|
|
|
|
|
|
namespace dbaui
|
|
|
|
{
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::sdbc;
|
|
|
|
using namespace ::com::sun::star::sdbcx;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
using namespace svt;
|
|
|
|
|
|
|
|
typedef ::svt::EditBrowseBox ORelationControl_Base;
|
|
|
|
class ORelationControl : public ORelationControl_Base
|
|
|
|
{
|
|
|
|
friend class OTableListBoxControl;
|
|
|
|
|
2007-11-01 14:04:02 +00:00
|
|
|
::std::auto_ptr< ::svt::ListBoxControl> m_pListCell;
|
|
|
|
TTableConnectionData::value_type m_pConnData;
|
2002-02-06 13:31:05 +00:00
|
|
|
OTableListBoxControl* m_pBoxControl;
|
|
|
|
long m_nDataPos;
|
|
|
|
Reference< XPropertySet> m_xSourceDef;
|
|
|
|
Reference< XPropertySet> m_xDestDef;
|
2012-12-12 16:33:31 +01:00
|
|
|
enum opcode { DELETE, INSERT, MODIFY };
|
|
|
|
typedef list< pair < opcode, pair < OConnectionLineDataVec::size_type, OConnectionLineDataVec::size_type> > > ops_type;
|
|
|
|
ops_type m_ops;
|
2002-02-06 06:13:01 +00:00
|
|
|
|
2011-01-14 15:00:11 +01:00
|
|
|
void fillListBox(const Reference< XPropertySet>& _xDest,long nRow,sal_uInt16 nColumnId);
|
2002-02-06 13:31:05 +00:00
|
|
|
/** returns the column id for the editbrowsebox
|
|
|
|
@param _nColId
|
|
|
|
the column id SOURCE_COLUMN or DEST_COLUMN
|
2002-02-06 06:13:01 +00:00
|
|
|
|
|
|
|
@return the current column id eihter SOURCE_COLUMN or DEST_COLUMN depends on the connection data
|
|
|
|
*/
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_uInt16 getColumnIdent( sal_uInt16 _nColId ) const;
|
2002-02-06 06:13:01 +00:00
|
|
|
public:
|
2014-03-13 14:42:24 +00:00
|
|
|
ORelationControl(Window *pParent);
|
|
|
|
void SetController(OTableListBoxControl* pController)
|
|
|
|
{
|
|
|
|
m_pBoxControl = pController;
|
|
|
|
}
|
2002-02-06 06:13:01 +00:00
|
|
|
virtual ~ORelationControl();
|
|
|
|
|
2002-02-06 13:31:05 +00:00
|
|
|
/** searches for a connection between these two tables
|
|
|
|
@param _pSource
|
|
|
|
the left table
|
|
|
|
@param _pDest
|
|
|
|
the right window
|
2002-02-06 06:13:01 +00:00
|
|
|
*/
|
|
|
|
void setWindowTables(const OTableWindow* _pSource,const OTableWindow* _pDest);
|
|
|
|
|
2002-02-06 13:31:05 +00:00
|
|
|
/** allows to access the connection data from outside
|
2002-02-06 06:13:01 +00:00
|
|
|
|
|
|
|
@return rthe connection data
|
|
|
|
*/
|
2007-11-01 14:04:02 +00:00
|
|
|
inline TTableConnectionData::value_type getData() const { return m_pConnData; }
|
2002-02-06 06:13:01 +00:00
|
|
|
|
2002-11-08 08:26:00 +00:00
|
|
|
void lateInit();
|
|
|
|
|
2002-02-06 06:13:01 +00:00
|
|
|
protected:
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual void Resize() SAL_OVERRIDE;
|
|
|
|
virtual Size GetOptimalSize() const SAL_OVERRIDE;
|
|
|
|
virtual bool PreNotify(NotifyEvent& rNEvt ) SAL_OVERRIDE;
|
2002-02-06 06:13:01 +00:00
|
|
|
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual bool IsTabAllowed(bool bForward) const SAL_OVERRIDE;
|
2002-02-06 06:13:01 +00:00
|
|
|
|
2007-11-01 14:04:02 +00:00
|
|
|
virtual void Init(const TTableConnectionData::value_type& _pConnData);
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual void Init() SAL_OVERRIDE { ORelationControl_Base::Init(); }
|
|
|
|
virtual void InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol ) SAL_OVERRIDE;
|
|
|
|
virtual ::svt::CellController* GetController( long nRow, sal_uInt16 nCol ) SAL_OVERRIDE;
|
|
|
|
virtual void PaintCell( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColId ) const SAL_OVERRIDE;
|
|
|
|
virtual bool SeekRow( long nRow ) SAL_OVERRIDE;
|
|
|
|
virtual bool SaveModified() SAL_OVERRIDE;
|
|
|
|
virtual OUString GetCellText( long nRow, sal_uInt16 nColId ) const SAL_OVERRIDE;
|
|
|
|
|
|
|
|
virtual void CellModified() SAL_OVERRIDE;
|
2002-02-06 06:13:01 +00:00
|
|
|
|
2007-11-01 14:04:02 +00:00
|
|
|
DECL_LINK( AsynchDeactivate, void* );
|
2002-02-06 06:13:01 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
DECL_LINK( AsynchActivate, void* );
|
2007-11-01 14:04:02 +00:00
|
|
|
|
2002-02-06 06:13:01 +00:00
|
|
|
};
|
2006-06-20 01:59:20 +00:00
|
|
|
|
2002-02-06 06:13:01 +00:00
|
|
|
// class ORelationControl
|
2014-03-13 14:42:24 +00:00
|
|
|
ORelationControl::ORelationControl(Window *pParent)
|
|
|
|
: EditBrowseBox(pParent,
|
|
|
|
EBBF_SMART_TAB_TRAVEL | EBBF_NOROWPICTURE,
|
|
|
|
WB_TABSTOP | WB_BORDER | BROWSER_AUTOSIZE_LASTCOL)
|
|
|
|
, m_pBoxControl(NULL)
|
2014-02-21 11:19:30 +00:00
|
|
|
, m_nDataPos(0)
|
|
|
|
, m_xSourceDef(NULL)
|
|
|
|
, m_xDestDef(NULL)
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-03-13 14:42:24 +00:00
|
|
|
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeORelationControl(Window *pParent, VclBuilder::stringmap &)
|
|
|
|
{
|
|
|
|
return new ORelationControl(pParent);
|
|
|
|
}
|
|
|
|
|
2002-02-06 06:13:01 +00:00
|
|
|
ORelationControl::~ORelationControl()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-11-01 14:04:02 +00:00
|
|
|
void ORelationControl::Init(const TTableConnectionData::value_type& _pConnData)
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
m_pConnData = _pConnData;
|
|
|
|
OSL_ENSURE(m_pConnData, "No data supplied!");
|
|
|
|
|
|
|
|
m_pConnData->normalizeLines();
|
2002-11-08 08:26:00 +00:00
|
|
|
}
|
2014-03-13 14:42:24 +00:00
|
|
|
|
2002-11-08 08:26:00 +00:00
|
|
|
void ORelationControl::lateInit()
|
|
|
|
{
|
2007-11-01 14:04:02 +00:00
|
|
|
if ( !m_pConnData.get() )
|
|
|
|
return;
|
|
|
|
m_xSourceDef = m_pConnData->getReferencingTable()->getTable();
|
|
|
|
m_xDestDef = m_pConnData->getReferencedTable()->getTable();
|
2002-02-06 06:13:01 +00:00
|
|
|
|
2002-02-06 13:31:05 +00:00
|
|
|
if ( ColCount() == 0 )
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2007-11-01 14:04:02 +00:00
|
|
|
InsertDataColumn( SOURCE_COLUMN, m_pConnData->getReferencingTable()->GetWinName(), 100);
|
|
|
|
InsertDataColumn( DEST_COLUMN, m_pConnData->getReferencedTable()->GetWinName(), 100);
|
2012-04-13 14:39:59 +02:00
|
|
|
// If the Defs do not yet exits, we need to set them with SetSource-/-DestDef
|
2002-02-06 06:13:01 +00:00
|
|
|
|
2007-11-01 14:04:02 +00:00
|
|
|
m_pListCell.reset( new ListBoxControl( &GetDataWindow() ) );
|
2002-02-06 06:13:01 +00:00
|
|
|
|
2002-02-06 13:31:05 +00:00
|
|
|
// set browse mode
|
|
|
|
SetMode( BROWSER_COLUMNSELECTION |
|
|
|
|
BROWSER_HLINESFULL |
|
|
|
|
BROWSER_VLINESFULL |
|
|
|
|
BROWSER_HIDECURSOR |
|
2002-04-02 05:51:46 +00:00
|
|
|
BROWSER_HIDESELECT |
|
|
|
|
BROWSER_AUTO_HSCROLL |
|
|
|
|
BROWSER_AUTO_VSCROLL);
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
// not the first call
|
|
|
|
RowRemoved(0, GetRowCount());
|
|
|
|
|
2014-03-19 14:11:04 +02:00
|
|
|
RowInserted(0, m_pConnData->GetConnLineDataList()->size() + 1, true); // add one extra row
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
2014-03-13 14:42:24 +00:00
|
|
|
|
2002-02-06 06:13:01 +00:00
|
|
|
void ORelationControl::Resize()
|
|
|
|
{
|
|
|
|
EditBrowseBox::Resize();
|
2014-03-13 14:42:24 +00:00
|
|
|
long nOutputWidth = GetOutputSizePixel().Width() - 1;
|
2002-02-06 13:31:05 +00:00
|
|
|
SetColumnWidth(1, (nOutputWidth / 2));
|
|
|
|
SetColumnWidth(2, (nOutputWidth / 2));
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
|
2014-01-18 00:18:52 +01:00
|
|
|
bool ORelationControl::PreNotify(NotifyEvent& rNEvt)
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2002-02-06 13:31:05 +00:00
|
|
|
if (rNEvt.GetType() == EVENT_LOSEFOCUS && !HasChildPathFocus() )
|
|
|
|
PostUserEvent(LINK(this, ORelationControl, AsynchDeactivate));
|
|
|
|
else if (rNEvt.GetType() == EVENT_GETFOCUS)
|
|
|
|
PostUserEvent(LINK(this, ORelationControl, AsynchActivate));
|
|
|
|
|
2002-02-06 06:13:01 +00:00
|
|
|
return EditBrowseBox::PreNotify(rNEvt);
|
|
|
|
}
|
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG(ORelationControl, AsynchActivate)
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
ActivateCell();
|
|
|
|
return 0L;
|
|
|
|
}
|
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG(ORelationControl, AsynchDeactivate)
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
DeactivateCell();
|
|
|
|
return 0L;
|
|
|
|
}
|
|
|
|
|
2014-03-20 11:14:54 +02:00
|
|
|
bool ORelationControl::IsTabAllowed(bool bForward) const
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
long nRow = GetCurRow();
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_uInt16 nCol = GetCurColumnId();
|
2002-02-06 06:13:01 +00:00
|
|
|
|
2014-03-20 11:14:54 +02:00
|
|
|
bool bRet = !(( ( bForward && (nCol == DEST_COLUMN) && (nRow == GetRowCount() - 1)))
|
2002-02-06 13:31:05 +00:00
|
|
|
|| (!bForward && (nCol == SOURCE_COLUMN) && (nRow == 0)));
|
2002-02-06 06:13:01 +00:00
|
|
|
|
2002-02-06 13:31:05 +00:00
|
|
|
return bRet && EditBrowseBox::IsTabAllowed(bForward);
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
|
2014-03-20 11:14:54 +02:00
|
|
|
bool ORelationControl::SaveModified()
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2012-12-12 16:33:31 +01:00
|
|
|
long nRow = GetCurRow();
|
2007-11-01 14:04:02 +00:00
|
|
|
if ( nRow != BROWSER_ENDOFSELECTION )
|
2002-11-21 14:28:38 +00:00
|
|
|
{
|
2013-09-26 12:17:53 +02:00
|
|
|
OUString sFieldName(m_pListCell->GetSelectEntry());
|
2007-11-01 14:04:02 +00:00
|
|
|
OConnectionLineDataVec* pLines = m_pConnData->GetConnLineDataList();
|
2012-12-12 16:33:31 +01:00
|
|
|
if ( pLines->size() <= static_cast<OConnectionLineDataVec::size_type>(nRow) )
|
2007-11-01 14:04:02 +00:00
|
|
|
{
|
|
|
|
pLines->push_back(new OConnectionLineData());
|
|
|
|
nRow = pLines->size() - 1;
|
2012-12-12 16:33:31 +01:00
|
|
|
// add new past-pLines row
|
|
|
|
m_ops.push_back(make_pair(INSERT, make_pair(nRow+1, nRow+2)));
|
2007-11-01 14:04:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OConnectionLineDataRef pConnLineData = (*pLines)[nRow];
|
2002-02-06 06:13:01 +00:00
|
|
|
|
2002-11-21 14:28:38 +00:00
|
|
|
switch( getColumnIdent( GetCurColumnId() ) )
|
|
|
|
{
|
|
|
|
case SOURCE_COLUMN:
|
|
|
|
pConnLineData->SetSourceFieldName( sFieldName );
|
|
|
|
break;
|
|
|
|
case DEST_COLUMN:
|
|
|
|
pConnLineData->SetDestFieldName( sFieldName );
|
|
|
|
break;
|
|
|
|
}
|
2012-12-12 16:33:31 +01:00
|
|
|
// the modification we just did does *not* need to be registered in m_ops;
|
|
|
|
// it is already taken into account (by the codepath that called us)
|
|
|
|
//m_ops.push_back(make_pair(MODIFY, make_pair(nRow, nRow+1)));
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
|
2012-12-12 16:33:31 +01:00
|
|
|
const OConnectionLineDataVec::size_type oldSize = m_pConnData->GetConnLineDataList()->size();
|
|
|
|
OConnectionLineDataVec::size_type line = m_pConnData->normalizeLines();
|
|
|
|
const OConnectionLineDataVec::size_type newSize = m_pConnData->GetConnLineDataList()->size();
|
|
|
|
assert(newSize <= oldSize);
|
|
|
|
m_ops.push_back(make_pair(MODIFY, make_pair(line, newSize)));
|
|
|
|
m_ops.push_back(make_pair(DELETE, make_pair(newSize, oldSize)));
|
|
|
|
|
2014-03-20 11:14:54 +02:00
|
|
|
return true;
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
2014-03-20 11:14:54 +02:00
|
|
|
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_uInt16 ORelationControl::getColumnIdent( sal_uInt16 _nColId ) const
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_uInt16 nId = _nColId;
|
2007-11-01 14:04:02 +00:00
|
|
|
if ( m_pConnData->getReferencingTable() != m_pBoxControl->getReferencingTable() )
|
2002-02-06 06:13:01 +00:00
|
|
|
nId = ( _nColId == SOURCE_COLUMN) ? DEST_COLUMN : SOURCE_COLUMN;
|
|
|
|
return nId;
|
|
|
|
}
|
|
|
|
|
2013-07-11 13:52:33 +01:00
|
|
|
OUString ORelationControl::GetCellText( long nRow, sal_uInt16 nColId ) const
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2013-07-11 13:52:33 +01:00
|
|
|
OUString sText;
|
2004-08-02 14:35:33 +00:00
|
|
|
if ( m_pConnData->GetConnLineDataList()->size() > static_cast<size_t>(nRow) )
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
OConnectionLineDataRef pConnLineData = (*m_pConnData->GetConnLineDataList())[nRow];
|
2007-11-01 14:04:02 +00:00
|
|
|
switch( getColumnIdent( nColId ) )
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2007-11-01 14:04:02 +00:00
|
|
|
case SOURCE_COLUMN:
|
|
|
|
sText = pConnLineData->GetSourceFieldName();
|
|
|
|
break;
|
|
|
|
case DEST_COLUMN:
|
|
|
|
sText = pConnLineData->GetDestFieldName();
|
|
|
|
break;
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return sText;
|
|
|
|
}
|
|
|
|
|
2011-01-14 15:00:11 +01:00
|
|
|
void ORelationControl::InitController( CellControllerRef& /*rController*/, long nRow, sal_uInt16 nColumnId )
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OString sHelpId( HID_RELATIONDIALOG_LEFTFIELDCELL );
|
2002-02-06 06:13:01 +00:00
|
|
|
|
|
|
|
Reference< XPropertySet> xDef;
|
2002-11-08 08:26:00 +00:00
|
|
|
switch ( getColumnIdent(nColumnId) )
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
case SOURCE_COLUMN:
|
|
|
|
xDef = m_xSourceDef;
|
2010-07-10 18:21:24 +02:00
|
|
|
sHelpId = HID_RELATIONDIALOG_LEFTFIELDCELL;
|
2002-02-06 06:13:01 +00:00
|
|
|
break;
|
|
|
|
case DEST_COLUMN:
|
|
|
|
xDef = m_xDestDef;
|
2010-07-10 18:21:24 +02:00
|
|
|
sHelpId = HID_RELATIONDIALOG_RIGHTFIELDCELL;
|
2002-02-06 06:13:01 +00:00
|
|
|
break;
|
2004-02-04 12:54:17 +00:00
|
|
|
default:
|
|
|
|
// ?????????
|
|
|
|
break;
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
|
2002-11-08 08:26:00 +00:00
|
|
|
if ( xDef.is() )
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
fillListBox(xDef,nRow,nColumnId);
|
2013-09-26 12:17:53 +02:00
|
|
|
OUString sName = GetCellText( nRow, nColumnId );
|
2002-11-08 08:26:00 +00:00
|
|
|
m_pListCell->SelectEntry( sName );
|
2007-09-26 13:48:46 +00:00
|
|
|
if ( m_pListCell->GetSelectEntry() != sName )
|
|
|
|
{
|
|
|
|
m_pListCell->InsertEntry( sName );
|
|
|
|
m_pListCell->SelectEntry( sName );
|
|
|
|
}
|
2002-02-06 06:13:01 +00:00
|
|
|
|
2010-07-10 18:21:24 +02:00
|
|
|
m_pListCell->SetHelpId(sHelpId);
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-14 15:00:11 +01:00
|
|
|
CellController* ORelationControl::GetController( long /*nRow*/, sal_uInt16 /*nColumnId*/ )
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2007-11-01 14:04:02 +00:00
|
|
|
return new ListBoxCellController( m_pListCell.get() );
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
|
2014-03-19 14:11:04 +02:00
|
|
|
bool ORelationControl::SeekRow( long nRow )
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
m_nDataPos = nRow;
|
2014-03-19 14:11:04 +02:00
|
|
|
return true;
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
|
2011-01-14 15:00:11 +01:00
|
|
|
void ORelationControl::PaintCell( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2013-09-26 12:17:53 +02:00
|
|
|
OUString aText = const_cast< ORelationControl*>(this)->GetCellText( m_nDataPos, nColumnId );
|
2002-02-06 06:13:01 +00:00
|
|
|
|
|
|
|
Point aPos( rRect.TopLeft() );
|
|
|
|
Size aTextSize( GetDataWindow().GetTextHeight(),GetDataWindow().GetTextWidth( aText ));
|
|
|
|
|
|
|
|
if( aPos.X() < rRect.Right() || aPos.X() + aTextSize.Width() > rRect.Right() ||
|
|
|
|
aPos.Y() < rRect.Top() || aPos.Y() + aTextSize.Height() > rRect.Bottom() )
|
2013-03-13 22:28:52 +01:00
|
|
|
{
|
|
|
|
rDev.SetClipRegion(Region(rRect));
|
|
|
|
}
|
2002-02-06 06:13:01 +00:00
|
|
|
|
|
|
|
rDev.DrawText( aPos, aText );
|
|
|
|
|
|
|
|
if( rDev.IsClipRegion() )
|
|
|
|
rDev.SetClipRegion();
|
|
|
|
}
|
2011-01-14 15:00:11 +01:00
|
|
|
void ORelationControl::fillListBox(const Reference< XPropertySet>& _xDest,long /*_nRow*/,sal_uInt16 /*nColumnId*/)
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
m_pListCell->Clear();
|
|
|
|
try
|
|
|
|
{
|
2002-11-08 08:26:00 +00:00
|
|
|
if ( _xDest.is() )
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2007-09-26 13:48:46 +00:00
|
|
|
//sal_Int32 nRows = GetRowCount();
|
2002-02-06 06:13:01 +00:00
|
|
|
Reference<XColumnsSupplier> xSup(_xDest,UNO_QUERY);
|
|
|
|
Reference<XNameAccess> xColumns = xSup->getColumns();
|
2013-04-07 12:06:47 +02:00
|
|
|
Sequence< OUString> aNames = xColumns->getElementNames();
|
|
|
|
const OUString* pIter = aNames.getConstArray();
|
|
|
|
const OUString* pEnd = pIter + aNames.getLength();
|
2007-11-01 14:04:02 +00:00
|
|
|
for(;pIter != pEnd;++pIter)
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2007-11-01 14:04:02 +00:00
|
|
|
m_pListCell->InsertEntry( *pIter );
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
2013-09-26 12:17:53 +02:00
|
|
|
m_pListCell->InsertEntry(OUString(), 0);
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-05 14:54:44 +00:00
|
|
|
catch( const Exception& )
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2008-05-05 14:54:44 +00:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
void ORelationControl::setWindowTables(const OTableWindow* _pSource,const OTableWindow* _pDest)
|
|
|
|
{
|
2012-04-13 14:39:59 +02:00
|
|
|
// If I edit here, hide
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_Bool bWasEditing = IsEditing();
|
2002-11-08 08:26:00 +00:00
|
|
|
if ( bWasEditing )
|
2002-02-06 06:13:01 +00:00
|
|
|
DeactivateCell();
|
|
|
|
|
2002-11-08 08:26:00 +00:00
|
|
|
if ( _pSource && _pDest )
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
m_xSourceDef = _pSource->GetTable();
|
2002-11-21 14:28:38 +00:00
|
|
|
SetColumnTitle(1, _pSource->GetName());
|
2002-02-06 06:13:01 +00:00
|
|
|
|
|
|
|
m_xDestDef = _pDest->GetTable();
|
2002-11-21 14:28:38 +00:00
|
|
|
SetColumnTitle(2, _pDest->GetName());
|
2002-02-06 06:13:01 +00:00
|
|
|
|
|
|
|
const OJoinTableView* pView = _pSource->getTableView();
|
|
|
|
OTableConnection* pConn = pView->GetTabConn(_pSource,_pDest);
|
2008-12-09 07:25:38 +00:00
|
|
|
if ( pConn && !m_pConnData->GetConnLineDataList()->empty() )
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
m_pConnData->CopyFrom(*pConn->GetData());
|
2006-06-20 01:59:20 +00:00
|
|
|
m_pBoxControl->getContainer()->notifyConnectionChange();
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// no connection found so we clear our data
|
|
|
|
OConnectionLineDataVec* pLines = m_pConnData->GetConnLineDataList();
|
|
|
|
::std::for_each(pLines->begin(),
|
|
|
|
pLines->end(),
|
|
|
|
OUnaryRefFunctor<OConnectionLineData>( ::std::mem_fun(&OConnectionLineData::Reset))
|
|
|
|
);
|
|
|
|
|
2007-11-01 14:04:02 +00:00
|
|
|
m_pConnData->setReferencingTable(_pSource->GetData());
|
|
|
|
m_pConnData->setReferencedTable(_pDest->GetData());
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
m_pConnData->normalizeLines();
|
|
|
|
|
|
|
|
}
|
2012-04-13 14:39:59 +02:00
|
|
|
// Repaint
|
2002-02-06 06:13:01 +00:00
|
|
|
Invalidate();
|
|
|
|
|
2002-11-08 08:26:00 +00:00
|
|
|
if ( bWasEditing )
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
GoToRow(0);
|
|
|
|
ActivateCell();
|
|
|
|
}
|
|
|
|
}
|
2014-03-13 14:42:24 +00:00
|
|
|
|
2002-02-06 06:13:01 +00:00
|
|
|
void ORelationControl::CellModified()
|
|
|
|
{
|
|
|
|
EditBrowseBox::CellModified();
|
|
|
|
SaveModified();
|
2014-03-13 14:42:24 +00:00
|
|
|
assert(m_pBoxControl);
|
|
|
|
m_pBoxControl->NotifyCellChange();
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
2014-03-13 14:42:24 +00:00
|
|
|
|
|
|
|
Size ORelationControl::GetOptimalSize() const
|
|
|
|
{
|
|
|
|
return LogicToPixel(Size(140, 80), MAP_APPFONT);
|
|
|
|
}
|
|
|
|
|
2002-02-06 06:13:01 +00:00
|
|
|
// class OTableListBoxControl
|
2014-03-13 14:42:24 +00:00
|
|
|
OTableListBoxControl::OTableListBoxControl(VclBuilderContainer* _pParent,
|
|
|
|
const OJoinTableView::OTableWindowMap* _pTableMap,
|
|
|
|
IRelationControlInterface* _pParentDialog)
|
|
|
|
: m_pTableMap(_pTableMap)
|
|
|
|
, m_pParentDialog(_pParentDialog)
|
|
|
|
{
|
|
|
|
_pParent->get(m_pLeftTable, "table1");
|
|
|
|
_pParent->get(m_pRightTable, "table2");
|
2005-09-23 11:23:20 +00:00
|
|
|
|
2014-03-13 14:42:24 +00:00
|
|
|
_pParent->get(m_pRC_Tables, "relations");
|
|
|
|
m_pRC_Tables->SetController(this);
|
|
|
|
m_pRC_Tables->Init();
|
2002-02-06 06:13:01 +00:00
|
|
|
|
2007-11-01 14:04:02 +00:00
|
|
|
lateUIInit();
|
2002-02-06 06:13:01 +00:00
|
|
|
|
2002-02-06 13:31:05 +00:00
|
|
|
Link aLink(LINK(this, OTableListBoxControl, OnTableChanged));
|
2014-03-13 14:42:24 +00:00
|
|
|
m_pLeftTable->SetSelectHdl(aLink);
|
|
|
|
m_pRightTable->SetSelectHdl(aLink);
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
2014-03-13 14:42:24 +00:00
|
|
|
|
2002-02-06 06:13:01 +00:00
|
|
|
OTableListBoxControl::~OTableListBoxControl()
|
|
|
|
{
|
|
|
|
}
|
2014-03-13 14:42:24 +00:00
|
|
|
|
2002-02-06 06:13:01 +00:00
|
|
|
void OTableListBoxControl::fillListBoxes()
|
|
|
|
{
|
2011-02-03 00:33:36 +01:00
|
|
|
OSL_ENSURE( !m_pTableMap->empty(), "OTableListBoxControl::fillListBoxes: no table window!");
|
2002-02-06 06:13:01 +00:00
|
|
|
OTableWindow* pInitialLeft = NULL;
|
|
|
|
OTableWindow* pInitialRight = NULL;
|
|
|
|
|
2012-04-13 14:39:59 +02:00
|
|
|
// Collect the names of all TabWins
|
2002-02-06 06:13:01 +00:00
|
|
|
OJoinTableView::OTableWindowMap::const_iterator aIter = m_pTableMap->begin();
|
2009-07-03 12:24:35 +00:00
|
|
|
OJoinTableView::OTableWindowMap::const_iterator aEnd = m_pTableMap->end();
|
|
|
|
for(;aIter != aEnd;++aIter)
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2014-03-13 14:42:24 +00:00
|
|
|
m_pLeftTable->InsertEntry(aIter->first);
|
|
|
|
m_pRightTable->InsertEntry(aIter->first);
|
2002-02-06 06:13:01 +00:00
|
|
|
|
|
|
|
if (!pInitialLeft)
|
2002-11-07 13:06:21 +00:00
|
|
|
{
|
2002-02-06 06:13:01 +00:00
|
|
|
pInitialLeft = aIter->second;
|
2002-11-07 13:06:21 +00:00
|
|
|
m_strCurrentLeft = aIter->first;
|
|
|
|
}
|
2002-02-06 06:13:01 +00:00
|
|
|
else if (!pInitialRight)
|
2002-11-07 13:06:21 +00:00
|
|
|
{
|
2002-02-06 06:13:01 +00:00
|
|
|
pInitialRight = aIter->second;
|
2002-11-07 13:06:21 +00:00
|
|
|
m_strCurrentRight = aIter->first;
|
|
|
|
}
|
2010-11-29 23:29:33 +09:00
|
|
|
}
|
2009-07-16 10:46:51 +00:00
|
|
|
|
|
|
|
if ( !pInitialRight )
|
|
|
|
{
|
|
|
|
pInitialRight = pInitialLeft;
|
|
|
|
m_strCurrentRight = m_strCurrentLeft;
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
|
2012-04-13 14:39:59 +02:00
|
|
|
// The corresponding Defs for my Controls
|
2002-02-06 06:13:01 +00:00
|
|
|
m_pRC_Tables->setWindowTables(pInitialLeft,pInitialRight);
|
|
|
|
|
2012-04-13 14:39:59 +02:00
|
|
|
// The table selected in a ComboBox must not be available in the other
|
2002-02-06 13:31:05 +00:00
|
|
|
|
2002-11-08 08:26:00 +00:00
|
|
|
if ( m_pTableMap->size() > 2 )
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2014-03-13 14:42:24 +00:00
|
|
|
m_pLeftTable->RemoveEntry(m_strCurrentRight);
|
|
|
|
m_pRightTable->RemoveEntry(m_strCurrentLeft);
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
|
2012-04-13 14:39:59 +02:00
|
|
|
// Select the first one on the left side and on the right side,
|
|
|
|
// select the second one
|
2014-03-13 14:42:24 +00:00
|
|
|
m_pLeftTable->SelectEntry(m_strCurrentLeft);
|
|
|
|
m_pRightTable->SelectEntry(m_strCurrentRight);
|
2002-11-08 08:26:00 +00:00
|
|
|
|
2014-03-13 14:42:24 +00:00
|
|
|
m_pLeftTable->GrabFocus();
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
2014-03-13 14:42:24 +00:00
|
|
|
|
2002-02-06 06:13:01 +00:00
|
|
|
IMPL_LINK( OTableListBoxControl, OnTableChanged, ListBox*, pListBox )
|
|
|
|
{
|
2013-09-26 12:17:53 +02:00
|
|
|
OUString strSelected(pListBox->GetSelectEntry());
|
2002-02-06 06:13:01 +00:00
|
|
|
OTableWindow* pLeft = NULL;
|
|
|
|
OTableWindow* pRight = NULL;
|
|
|
|
|
2012-04-13 14:39:59 +02:00
|
|
|
// Special treatment: If there are only two tables, we need to switch the other one too when changing in a LB
|
2002-11-08 08:26:00 +00:00
|
|
|
if ( m_pTableMap->size() == 2 )
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
ListBox* pOther;
|
2014-03-13 14:42:24 +00:00
|
|
|
if (pListBox == m_pLeftTable)
|
|
|
|
pOther = m_pRightTable;
|
2002-02-06 06:13:01 +00:00
|
|
|
else
|
2014-03-13 14:42:24 +00:00
|
|
|
pOther = m_pLeftTable;
|
2002-02-06 06:13:01 +00:00
|
|
|
pOther->SelectEntryPos(1 - pOther->GetSelectEntryPos());
|
|
|
|
|
|
|
|
OJoinTableView::OTableWindowMap::const_iterator aIter = m_pTableMap->begin();
|
|
|
|
OTableWindow* pFirst = aIter->second;
|
|
|
|
++aIter;
|
|
|
|
OTableWindow* pSecond = aIter->second;
|
|
|
|
|
2014-03-13 14:42:24 +00:00
|
|
|
if ( m_pLeftTable->GetSelectEntry() == pFirst->GetName() )
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
pLeft = pFirst;
|
|
|
|
pRight = pSecond;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pLeft = pSecond;
|
|
|
|
pRight = pFirst;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-13 14:39:59 +02:00
|
|
|
// First we need the TableDef to the Table and with it the TabWin
|
2002-02-06 06:13:01 +00:00
|
|
|
OJoinTableView::OTableWindowMap::const_iterator aFind = m_pTableMap->find(strSelected);
|
|
|
|
OTableWindow* pLoop = NULL;
|
|
|
|
if( aFind != m_pTableMap->end() )
|
|
|
|
pLoop = aFind->second;
|
2012-04-13 14:39:59 +02:00
|
|
|
OSL_ENSURE(pLoop != NULL, "ORelationDialog::OnTableChanged: invalid ListBox entry!");
|
|
|
|
// We need to find strSelect, because we filled the ListBoxes with the table names with which we compare now
|
2014-03-13 14:42:24 +00:00
|
|
|
if (pListBox == m_pLeftTable)
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2012-04-13 14:39:59 +02:00
|
|
|
// Insert the previously selected Entry on the left side on the right side
|
2014-03-13 14:42:24 +00:00
|
|
|
m_pRightTable->InsertEntry(m_strCurrentLeft);
|
2012-04-13 14:39:59 +02:00
|
|
|
// Remove the currently selected Entry
|
2014-03-13 14:42:24 +00:00
|
|
|
m_pRightTable->RemoveEntry(strSelected);
|
2002-02-06 06:13:01 +00:00
|
|
|
m_strCurrentLeft = strSelected;
|
|
|
|
|
|
|
|
pLeft = pLoop;
|
|
|
|
|
2014-03-13 14:42:24 +00:00
|
|
|
OJoinTableView::OTableWindowMap::const_iterator aIter = m_pTableMap->find(m_pRightTable->GetSelectEntry());
|
2002-02-06 06:13:01 +00:00
|
|
|
OSL_ENSURE( aIter != m_pTableMap->end(), "Invalid name");
|
|
|
|
if ( aIter != m_pTableMap->end() )
|
|
|
|
pRight = aIter->second;
|
|
|
|
|
2014-03-13 14:42:24 +00:00
|
|
|
m_pLeftTable->GrabFocus();
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-13 14:39:59 +02:00
|
|
|
// Insert the previously selected Entry on the right side on the left side
|
2014-03-13 14:42:24 +00:00
|
|
|
m_pLeftTable->InsertEntry(m_strCurrentRight);
|
2012-04-13 14:39:59 +02:00
|
|
|
// Remove the currently selected Entry
|
2014-03-13 14:42:24 +00:00
|
|
|
m_pLeftTable->RemoveEntry(strSelected);
|
2002-02-06 06:13:01 +00:00
|
|
|
m_strCurrentRight = strSelected;
|
|
|
|
|
|
|
|
pRight = pLoop;
|
2014-03-13 14:42:24 +00:00
|
|
|
OJoinTableView::OTableWindowMap::const_iterator aIter = m_pTableMap->find(m_pLeftTable->GetSelectEntry());
|
2002-02-06 06:13:01 +00:00
|
|
|
OSL_ENSURE( aIter != m_pTableMap->end(), "Invalid name");
|
|
|
|
if ( aIter != m_pTableMap->end() )
|
|
|
|
pLeft = aIter->second;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pListBox->GrabFocus();
|
|
|
|
|
|
|
|
m_pRC_Tables->setWindowTables(pLeft,pRight);
|
|
|
|
|
|
|
|
NotifyCellChange();
|
|
|
|
return 0;
|
|
|
|
}
|
2014-03-13 14:42:24 +00:00
|
|
|
|
2002-02-06 06:13:01 +00:00
|
|
|
void OTableListBoxControl::NotifyCellChange()
|
|
|
|
{
|
2012-04-13 14:39:59 +02:00
|
|
|
// Enable/disable the OK button, depending on having a valid situation
|
2007-11-01 14:04:02 +00:00
|
|
|
TTableConnectionData::value_type pConnData = m_pRC_Tables->getData();
|
|
|
|
const OConnectionLineDataVec* pLines = pConnData->GetConnLineDataList();
|
2012-12-12 16:24:45 +01:00
|
|
|
bool bValid = !pLines->empty();
|
|
|
|
if (bValid)
|
|
|
|
{
|
|
|
|
OConnectionLineDataVec::const_iterator l(pLines->begin());
|
|
|
|
const OConnectionLineDataVec::const_iterator le(pLines->end());
|
|
|
|
for (; bValid && l!=le; ++l)
|
|
|
|
{
|
|
|
|
bValid = ! ((*l)->GetSourceFieldName().isEmpty() || (*l)->GetDestFieldName().isEmpty());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_pParentDialog->setValid(bValid);
|
2002-02-06 06:13:01 +00:00
|
|
|
|
2012-12-12 16:33:31 +01:00
|
|
|
ORelationControl::ops_type::iterator i (m_pRC_Tables->m_ops.begin());
|
|
|
|
const ORelationControl::ops_type::const_iterator e (m_pRC_Tables->m_ops.end());
|
|
|
|
m_pRC_Tables->DeactivateCell();
|
|
|
|
for(; i != e; ++i)
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2012-12-12 16:33:31 +01:00
|
|
|
switch(i->first)
|
|
|
|
{
|
|
|
|
case ORelationControl::DELETE:
|
|
|
|
m_pRC_Tables->RowRemoved(i->second.first, i->second.second - i->second.first);
|
|
|
|
break;
|
|
|
|
case ORelationControl::INSERT:
|
|
|
|
m_pRC_Tables->RowInserted(i->second.first, i->second.second - i->second.first);
|
|
|
|
break;
|
|
|
|
case ORelationControl::MODIFY:
|
|
|
|
for(OConnectionLineDataVec::size_type j = i->second.first; j < i->second.second; ++j)
|
|
|
|
m_pRC_Tables->RowModified(j);
|
|
|
|
break;
|
|
|
|
}
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
2012-12-12 16:33:31 +01:00
|
|
|
m_pRC_Tables->ActivateCell();
|
|
|
|
m_pRC_Tables->m_ops.clear();
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
2014-03-13 14:42:24 +00:00
|
|
|
|
2013-09-26 12:17:53 +02:00
|
|
|
void fillEntryAndDisable(ListBox& _rListBox,const OUString& _sEntry)
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
_rListBox.InsertEntry(_sEntry);
|
|
|
|
_rListBox.SelectEntryPos(0);
|
|
|
|
_rListBox.Disable();
|
|
|
|
}
|
2014-03-13 14:42:24 +00:00
|
|
|
|
2007-11-01 14:04:02 +00:00
|
|
|
void OTableListBoxControl::fillAndDisable(const TTableConnectionData::value_type& _pConnectionData)
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2014-03-13 14:42:24 +00:00
|
|
|
fillEntryAndDisable(*m_pLeftTable, _pConnectionData->getReferencingTable()->GetWinName());
|
|
|
|
fillEntryAndDisable(*m_pRightTable, _pConnectionData->getReferencedTable()->GetWinName());
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
2014-03-13 14:42:24 +00:00
|
|
|
|
2007-11-01 14:04:02 +00:00
|
|
|
void OTableListBoxControl::Init(const TTableConnectionData::value_type& _pConnData)
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
|
|
|
m_pRC_Tables->Init(_pConnData);
|
|
|
|
}
|
2007-11-01 14:04:02 +00:00
|
|
|
|
2014-03-13 14:42:24 +00:00
|
|
|
void OTableListBoxControl::lateUIInit()
|
|
|
|
{
|
2007-11-01 14:04:02 +00:00
|
|
|
m_pRC_Tables->Show();
|
|
|
|
lateInit();
|
|
|
|
}
|
2014-03-13 14:42:24 +00:00
|
|
|
|
2002-11-08 08:26:00 +00:00
|
|
|
void OTableListBoxControl::lateInit()
|
|
|
|
{
|
|
|
|
m_pRC_Tables->lateInit();
|
|
|
|
}
|
2014-03-13 14:42:24 +00:00
|
|
|
|
|
|
|
void OTableListBoxControl::Disable()
|
|
|
|
{
|
|
|
|
m_pLeftTable->Disable();
|
|
|
|
m_pRightTable->Disable();
|
|
|
|
m_pRC_Tables->Disable();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OTableListBoxControl::Invalidate()
|
|
|
|
{
|
|
|
|
m_pLeftTable->Invalidate();
|
|
|
|
m_pRightTable->Invalidate();
|
|
|
|
m_pRC_Tables->Invalidate();
|
|
|
|
}
|
|
|
|
|
2011-01-14 15:00:11 +01:00
|
|
|
sal_Bool OTableListBoxControl::SaveModified()
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2012-12-12 16:33:31 +01:00
|
|
|
return m_pRC_Tables->SaveModified();
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
2014-03-13 14:42:24 +00:00
|
|
|
|
2007-11-01 14:04:02 +00:00
|
|
|
TTableWindowData::value_type OTableListBoxControl::getReferencingTable() const
|
2002-02-06 06:13:01 +00:00
|
|
|
{
|
2007-11-01 14:04:02 +00:00
|
|
|
return m_pRC_Tables->getData()->getReferencingTable();
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
2014-03-13 14:42:24 +00:00
|
|
|
|
2007-11-01 14:04:02 +00:00
|
|
|
void OTableListBoxControl::enableRelation(bool _bEnable)
|
|
|
|
{
|
|
|
|
if ( !_bEnable )
|
2014-03-13 14:42:24 +00:00
|
|
|
m_pRC_Tables->PostUserEvent(LINK(m_pRC_Tables, ORelationControl, AsynchDeactivate));
|
2007-11-01 14:04:02 +00:00
|
|
|
m_pRC_Tables->Enable(_bEnable);
|
|
|
|
|
|
|
|
}
|
2002-02-06 06:13:01 +00:00
|
|
|
}
|
|
|
|
|
2010-10-12 15:59:03 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|