tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / dbaccess / source / ui / inc / TableConnection.hxx
bloba38aa1fe030b0dd018e2be8a704487a1c32f4a72
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 #pragma once
21 #include <vector>
22 #include <vcl/window.hxx>
23 #include <com/sun/star/uno/Reference.h>
24 #include "TableConnectionData.hxx"
26 class Point;
27 namespace tools { class Rectangle; }
29 namespace dbaui
31 class OTableConnectionData;
32 class OTableWindow;
33 class OJoinTableView;
34 class OConnectionLine;
36 class OTableConnection : public vcl::Window
38 std::vector<std::unique_ptr<OConnectionLine>> m_vConnLine;
39 TTableConnectionData::value_type
40 m_pData;
41 VclPtr<OJoinTableView> m_pParent;
43 bool m_bSelected;
45 void Init();
46 /** loops through the vector and deletes all lines */
47 void clearLineData();
49 public:
50 OTableConnection( OJoinTableView* pContainer, TTableConnectionData::value_type aTabConnData );
51 OTableConnection( const OTableConnection& rConn );
52 /** destructor
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
59 eventually.
61 virtual ~OTableConnection() override;
62 virtual void dispose() override;
64 OTableConnection& operator=( const OTableConnection& rConn );
66 void Select();
67 void Deselect();
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;
76 void RecalcLines();
77 /** isTableConnection
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);
93 using Window::Draw;
94 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */