1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <vcl/window.hxx>
23 #include <com/sun/star/uno/Reference.h>
24 #include "TableConnectionData.hxx"
27 namespace tools
{ class Rectangle
; }
31 class OTableConnectionData
;
34 class OConnectionLine
;
36 class OTableConnection
: public vcl::Window
38 std::vector
<std::unique_ptr
<OConnectionLine
>> m_vConnLine
;
39 TTableConnectionData::value_type
41 VclPtr
<OJoinTableView
> m_pParent
;
46 /** loops through the vector and deletes all lines */
50 OTableConnection( OJoinTableView
* pContainer
, TTableConnectionData::value_type aTabConnData
);
51 OTableConnection( const OTableConnection
& rConn
);
54 @attention Normally a pointer to OTableConnectionData is given but
55 here, however, one has to create an instance (with
56 OTableConnectionDate::NewInstance) which is never deleted
57 (same like in other cases). Thus, the caller is
58 responsible to check and save the data for deleting it
61 virtual ~OTableConnection() override
;
62 virtual void dispose() override
;
64 OTableConnection
& operator=( const OTableConnection
& rConn
);
68 bool IsSelected() const { return m_bSelected
; }
69 bool CheckHit( const Point
& rMousePos
) const;
70 void InvalidateConnection();
71 void UpdateLineList();
73 OTableWindow
* GetSourceWin() const;
74 OTableWindow
* GetDestWin() const;
79 @param _pTable the table where we should check if we belong to it
80 @return true when the source or the destination window are equal
82 bool isTableConnection(const OTableWindow
* _pTable
)
84 return (_pTable
== GetSourceWin() || _pTable
== GetDestWin());
87 tools::Rectangle
GetBoundingRect() const;
89 const TTableConnectionData::value_type
& GetData() const { return m_pData
; }
90 const std::vector
<std::unique_ptr
<OConnectionLine
>>& GetConnLineList() const { return m_vConnLine
; }
91 OJoinTableView
* GetParent() const { return m_pParent
; }
92 virtual void Draw(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
);
94 virtual css::uno::Reference
< css::accessibility::XAccessible
> CreateAccessible() override
;
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */