build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / dbaccess / source / ui / inc / TableConnection.hxx
blob4cf945f647645f3902e97b37546d5c86125f2ec1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLECONNECTION_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLECONNECTION_HXX
22 #include <vector>
23 #include <tools/debug.hxx>
24 #include <vcl/window.hxx>
25 #include <com/sun/star/uno/Reference.h>
26 #include "TableConnectionData.hxx"
28 class Point;
29 class Rectangle;
31 namespace dbaui
33 class OTableConnectionData;
34 class OTableWindow;
35 class OJoinTableView;
36 class OConnectionLine;
38 class OTableConnection : public vcl::Window
40 ::std::vector<OConnectionLine*> m_vConnLine;
41 TTableConnectionData::value_type
42 m_pData;
43 VclPtr<OJoinTableView> m_pParent;
45 bool m_bSelected;
47 void Init();
48 /** loops through the vector and deletes all lines */
49 void clearLineData();
51 public:
52 OTableConnection( OJoinTableView* pContainer, const TTableConnectionData::value_type& pTabConnData );
53 OTableConnection( const OTableConnection& rConn );
54 /** destructor
56 @attention Normally a pointer to OTableConnectionData is given but
57 here, however, one has to create an instance (with
58 OTableConnectionDate::NewInstance) which is never deleted
59 (same like in other cases). Thus, the caller is
60 responsible to check and save the data for deleting it
61 eventually.
63 virtual ~OTableConnection() override;
64 virtual void dispose() override;
66 OTableConnection& operator=( const OTableConnection& rConn );
68 void Select();
69 void Deselect();
70 bool IsSelected() const { return m_bSelected; }
71 bool CheckHit( const Point& rMousePos ) const;
72 void InvalidateConnection();
73 void UpdateLineList();
75 OTableWindow* GetSourceWin() const;
76 OTableWindow* GetDestWin() const;
78 void RecalcLines();
79 /** isTableConnection
81 @param _pTable the table where we should check if we belongs to it
82 @return true when the source or the destination window are equal
84 bool isTableConnection(const OTableWindow* _pTable)
86 return (_pTable == GetSourceWin() || _pTable == GetDestWin());
89 Rectangle GetBoundingRect() const;
91 const TTableConnectionData::value_type& GetData() const { return m_pData; }
92 const ::std::vector<OConnectionLine*>& GetConnLineList() const { return m_vConnLine; }
93 inline OJoinTableView* GetParent() const { return m_pParent; }
94 virtual void Draw(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
95 using Window::Draw;
96 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
99 #endif
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */