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 .
|
|
|
|
*/
|
2020-09-13 12:06:53 +00:00
|
|
|
#pragma once
|
2001-02-28 09:09:17 +00:00
|
|
|
|
|
|
|
#include <vector>
|
2004-03-02 11:44:42 +00:00
|
|
|
#include <vcl/window.hxx>
|
2002-02-06 06:23:39 +00:00
|
|
|
#include <com/sun/star/uno/Reference.h>
|
2007-11-01 14:18:34 +00:00
|
|
|
#include "TableConnectionData.hxx"
|
2002-02-06 06:23:39 +00:00
|
|
|
|
|
|
|
class Point;
|
2017-03-30 20:27:55 +02:00
|
|
|
namespace tools { class Rectangle; }
|
2001-02-28 09:09:17 +00:00
|
|
|
|
|
|
|
namespace dbaui
|
|
|
|
{
|
|
|
|
class OTableConnectionData;
|
|
|
|
class OTableWindow;
|
|
|
|
class OJoinTableView;
|
2002-02-06 06:23:39 +00:00
|
|
|
class OConnectionLine;
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
class OTableConnection : public vcl::Window
|
2001-02-28 09:09:17 +00:00
|
|
|
{
|
2018-05-21 10:33:18 +02:00
|
|
|
std::vector<std::unique_ptr<OConnectionLine>> m_vConnLine;
|
2007-11-01 14:18:34 +00:00
|
|
|
TTableConnectionData::value_type
|
|
|
|
m_pData;
|
2015-03-09 14:29:30 +02:00
|
|
|
VclPtr<OJoinTableView> m_pParent;
|
2001-02-28 09:09:17 +00:00
|
|
|
|
2014-04-17 11:16:55 +02:00
|
|
|
bool m_bSelected;
|
2001-02-28 09:09:17 +00:00
|
|
|
|
|
|
|
void Init();
|
2012-08-12 18:22:40 +02:00
|
|
|
/** loops through the vector and deletes all lines */
|
2002-02-06 06:23:39 +00:00
|
|
|
void clearLineData();
|
2001-02-28 09:09:17 +00:00
|
|
|
|
|
|
|
public:
|
2022-06-13 16:28:20 +02:00
|
|
|
OTableConnection( OJoinTableView* pContainer, TTableConnectionData::value_type aTabConnData );
|
2001-02-28 09:09:17 +00:00
|
|
|
OTableConnection( const OTableConnection& rConn );
|
2012-08-12 18:22:40 +02:00
|
|
|
/** destructor
|
|
|
|
|
|
|
|
@attention Normally a pointer to OTableConnectionData is given but
|
|
|
|
here, however, one has to create an instance (with
|
|
|
|
OTableConnectionDate::NewInstance) which is never deleted
|
|
|
|
(same like in other cases). Thus, the caller is
|
|
|
|
responsible to check and save the data for deleting it
|
|
|
|
eventually.
|
|
|
|
*/
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~OTableConnection() override;
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void dispose() override;
|
2001-02-28 09:09:17 +00:00
|
|
|
|
|
|
|
OTableConnection& operator=( const OTableConnection& rConn );
|
|
|
|
|
|
|
|
void Select();
|
|
|
|
void Deselect();
|
2014-04-17 11:16:55 +02:00
|
|
|
bool IsSelected() const { return m_bSelected; }
|
|
|
|
bool CheckHit( const Point& rMousePos ) const;
|
2016-01-11 08:40:36 +02:00
|
|
|
void InvalidateConnection();
|
2001-02-28 09:09:17 +00:00
|
|
|
void UpdateLineList();
|
|
|
|
|
|
|
|
OTableWindow* GetSourceWin() const;
|
|
|
|
OTableWindow* GetDestWin() const;
|
|
|
|
|
2016-01-11 08:40:36 +02:00
|
|
|
void RecalcLines();
|
2002-02-06 06:23:39 +00:00
|
|
|
/** isTableConnection
|
|
|
|
|
2019-08-19 00:30:25 +02:00
|
|
|
@param _pTable the table where we should check if we belong to it
|
2002-02-06 06:23:39 +00:00
|
|
|
@return true when the source or the destination window are equal
|
|
|
|
*/
|
|
|
|
bool isTableConnection(const OTableWindow* _pTable)
|
|
|
|
{
|
|
|
|
return (_pTable == GetSourceWin() || _pTable == GetDestWin());
|
|
|
|
}
|
2001-02-28 09:09:17 +00:00
|
|
|
|
2017-03-30 20:27:55 +02:00
|
|
|
tools::Rectangle GetBoundingRect() const;
|
2001-02-28 09:09:17 +00:00
|
|
|
|
2016-04-13 10:44:57 +02:00
|
|
|
const TTableConnectionData::value_type& GetData() const { return m_pData; }
|
2018-05-21 10:33:18 +02:00
|
|
|
const std::vector<std::unique_ptr<OConnectionLine>>& GetConnLineList() const { return m_vConnLine; }
|
2017-03-03 20:57:02 +01:00
|
|
|
OJoinTableView* GetParent() const { return m_pParent; }
|
2017-03-30 20:27:55 +02:00
|
|
|
virtual void Draw(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
|
2006-06-20 02:13:24 +00:00
|
|
|
using Window::Draw;
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
|
2001-02-28 09:09:17 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2010-10-27 12:33:13 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|