Bump version to 5.0-14
[LibreOffice.git] / dbaccess / source / ui / inc / TableConnection.hxx
blob8d63648e8943d1b8c69a800ea0ac39caa7b535fd
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 <tools/rtti.hxx>
26 #include <com/sun/star/uno/Reference.h>
27 #include "TableConnectionData.hxx"
29 class Point;
30 class Rectangle;
32 namespace dbaui
34 class OTableConnectionData;
35 class OTableWindow;
36 class OJoinTableView;
37 class OConnectionLine;
39 class OTableConnection : public vcl::Window
41 ::std::vector<OConnectionLine*> m_vConnLine;
42 TTableConnectionData::value_type
43 m_pData;
44 VclPtr<OJoinTableView> m_pParent;
46 bool m_bSelected;
48 void Init();
49 /** loops through the vector and deletes all lines */
50 void clearLineData();
52 protected:
53 static OConnectionLine* CreateConnLine( const OConnectionLine& rConnLine );
55 public:
56 OTableConnection( OJoinTableView* pContainer, const TTableConnectionData::value_type& pTabConnData );
57 OTableConnection( const OTableConnection& rConn );
58 /** destructor
60 @attention Normally a pointer to OTableConnectionData is given but
61 here, however, one has to create an instance (with
62 OTableConnectionDate::NewInstance) which is never deleted
63 (same like in other cases). Thus, the caller is
64 responsible to check and save the data for deleting it
65 eventually.
67 virtual ~OTableConnection();
68 virtual void dispose() SAL_OVERRIDE;
70 OTableConnection& operator=( const OTableConnection& rConn );
72 void Select();
73 void Deselect();
74 bool IsSelected() const { return m_bSelected; }
75 bool CheckHit( const Point& rMousePos ) const;
76 bool InvalidateConnection();
77 void UpdateLineList();
79 OTableWindow* GetSourceWin() const;
80 OTableWindow* GetDestWin() const;
82 bool RecalcLines();
83 /** isTableConnection
85 @param _pTable the table where we should check if we belongs to it
86 @return true when the source or the destination window are equal
88 bool isTableConnection(const OTableWindow* _pTable)
90 return (_pTable == GetSourceWin() || _pTable == GetDestWin());
93 Rectangle GetBoundingRect() const;
95 inline TTableConnectionData::value_type GetData() const { return m_pData; }
96 const ::std::vector<OConnectionLine*>& GetConnLineList() const { return m_vConnLine; }
97 inline OJoinTableView* GetParent() const { return m_pParent; }
98 virtual void Draw(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
99 using Window::Draw;
100 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
103 #endif
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */