2010-10-27 12:33:13 +01: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 .
|
|
|
|
*/
|
2001-02-28 09:09:17 +00:00
|
|
|
#ifndef DBAUI_TABLECONNECTIONDATA_HXX
|
|
|
|
#define DBAUI_TABLECONNECTIONDATA_HXX
|
|
|
|
|
|
|
|
#include "ConnectionLineData.hxx"
|
2007-11-01 14:18:51 +00:00
|
|
|
#include "TableWindowData.hxx"
|
2001-02-28 09:09:17 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <tools/rtti.hxx>
|
2007-11-01 14:18:51 +00:00
|
|
|
#include <boost/shared_ptr.hpp>
|
2001-02-28 09:09:17 +00:00
|
|
|
|
|
|
|
namespace dbaui
|
|
|
|
{
|
2012-08-12 18:41:59 +02:00
|
|
|
//===========================================//
|
|
|
|
// ConnData ---------->* ConnLineData //
|
|
|
|
// ^1 ^1 //
|
|
|
|
// | | //
|
|
|
|
// Conn ---------->* ConnLine //
|
|
|
|
//===========================================//
|
2001-02-28 09:09:17 +00:00
|
|
|
|
2012-08-12 18:22:40 +02:00
|
|
|
/** Contains all connection data which exists between two windows */
|
2001-02-28 09:09:17 +00:00
|
|
|
class OTableConnectionData
|
|
|
|
{
|
|
|
|
protected:
|
2007-11-01 14:18:51 +00:00
|
|
|
TTableWindowData::value_type m_pReferencingTable;
|
|
|
|
TTableWindowData::value_type m_pReferencedTable;
|
2013-09-26 12:17:53 +02:00
|
|
|
OUString m_aConnName;
|
2001-02-28 09:09:17 +00:00
|
|
|
|
2001-10-08 06:26:32 +00:00
|
|
|
OConnectionLineDataVec m_vConnLineData;
|
2001-02-28 09:09:17 +00:00
|
|
|
|
|
|
|
void Init();
|
|
|
|
|
2001-10-08 06:26:32 +00:00
|
|
|
virtual OConnectionLineDataRef CreateLineDataObj();
|
|
|
|
virtual OConnectionLineDataRef CreateLineDataObj( const OConnectionLineData& rConnLineData );
|
2001-02-28 09:09:17 +00:00
|
|
|
|
2002-02-06 06:23:39 +00:00
|
|
|
OTableConnectionData& operator=( const OTableConnectionData& rConnData );
|
2001-02-28 09:09:17 +00:00
|
|
|
public:
|
|
|
|
OTableConnectionData();
|
2012-08-12 18:45:53 +02:00
|
|
|
OTableConnectionData( const TTableWindowData::value_type& _pReferencingTable,
|
|
|
|
const TTableWindowData::value_type& _pReferencedTable,
|
2013-09-26 12:17:53 +02:00
|
|
|
const OUString& rConnName = OUString() );
|
2001-02-28 09:09:17 +00:00
|
|
|
OTableConnectionData( const OTableConnectionData& rConnData );
|
|
|
|
virtual ~OTableConnectionData();
|
|
|
|
|
2012-08-12 18:22:40 +02:00
|
|
|
/// initialise from a source (more comfortable than a virtual assignment operator)
|
2001-02-28 09:09:17 +00:00
|
|
|
virtual void CopyFrom(const OTableConnectionData& rSource);
|
|
|
|
|
2012-08-12 18:22:40 +02:00
|
|
|
/** deliver a new instance of my own type
|
|
|
|
|
|
|
|
derived classes have to deliver an instance of their own type
|
|
|
|
|
|
|
|
@note does NOT have to be initialised
|
|
|
|
*/
|
2001-02-28 09:09:17 +00:00
|
|
|
virtual OTableConnectionData* NewInstance() const;
|
|
|
|
|
2013-09-26 12:17:53 +02:00
|
|
|
sal_Bool SetConnLine( sal_uInt16 nIndex, const OUString& rSourceFieldName, const OUString& rDestFieldName );
|
2013-04-07 12:06:47 +02:00
|
|
|
sal_Bool AppendConnLine( const OUString& rSourceFieldName, const OUString& rDestFieldName );
|
2012-12-12 09:11:12 +01:00
|
|
|
/** Deletes list of ConnLines
|
2012-12-12 09:06:01 +01:00
|
|
|
*/
|
2012-12-12 09:11:12 +01:00
|
|
|
void ResetConnLines();
|
2002-02-06 06:23:39 +00:00
|
|
|
|
2012-08-12 18:22:40 +02:00
|
|
|
/** moves the empty lines to the back
|
2012-12-12 16:33:31 +01:00
|
|
|
removes duplicated empty lines
|
|
|
|
|
|
|
|
caller is responsible for repainting them
|
|
|
|
|
|
|
|
@return infex of first changed line, or one-past-the-end if no change
|
2012-12-12 09:06:01 +01:00
|
|
|
*/
|
2012-12-12 16:33:31 +01:00
|
|
|
OConnectionLineDataVec::size_type normalizeLines();
|
2001-02-28 09:09:17 +00:00
|
|
|
|
2012-12-02 18:32:38 +01:00
|
|
|
const OConnectionLineDataVec* GetConnLineDataList() const { return &m_vConnLineData; }
|
|
|
|
OConnectionLineDataVec* GetConnLineDataList() { return &m_vConnLineData; }
|
2001-02-28 09:09:17 +00:00
|
|
|
|
2007-11-01 14:18:51 +00:00
|
|
|
inline TTableWindowData::value_type getReferencingTable() const { return m_pReferencingTable; }
|
|
|
|
inline TTableWindowData::value_type getReferencedTable() const { return m_pReferencedTable; }
|
|
|
|
|
|
|
|
inline void setReferencingTable(const TTableWindowData::value_type& _pTable) { m_pReferencingTable = _pTable; }
|
|
|
|
inline void setReferencedTable(const TTableWindowData::value_type& _pTable) { m_pReferencedTable = _pTable; }
|
|
|
|
|
2013-09-26 12:17:53 +02:00
|
|
|
OUString GetConnName() const { return m_aConnName; }
|
2001-02-28 09:09:17 +00:00
|
|
|
|
2013-09-26 12:17:53 +02:00
|
|
|
virtual void SetConnName( const OUString& rConnName ){ m_aConnName = rConnName; }
|
2002-02-06 06:23:39 +00:00
|
|
|
/** Update create a new connection
|
|
|
|
|
|
|
|
@return true if successful
|
|
|
|
*/
|
2011-01-14 15:00:11 +01:00
|
|
|
virtual sal_Bool Update(){ return sal_True; }
|
2001-02-28 09:09:17 +00:00
|
|
|
};
|
|
|
|
|
2007-11-01 14:18:51 +00:00
|
|
|
typedef ::std::vector< ::boost::shared_ptr<OTableConnectionData> > TTableConnectionData;
|
|
|
|
|
2001-02-28 09:09:17 +00:00
|
|
|
}
|
2012-08-12 18:38:58 +02:00
|
|
|
#endif
|
2001-02-28 09:09:17 +00:00
|
|
|
|
2010-10-27 12:33:13 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|