Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLECONNECTION_HXX
20 : #define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLECONNECTION_HXX
21 :
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"
28 :
29 : class Point;
30 : class Rectangle;
31 :
32 : namespace dbaui
33 : {
34 : class OTableConnectionData;
35 : class OTableWindow;
36 : class OJoinTableView;
37 : class OConnectionLine;
38 :
39 : class OTableConnection : public Window
40 : {
41 : ::std::vector<OConnectionLine*> m_vConnLine;
42 : TTableConnectionData::value_type
43 : m_pData;
44 : OJoinTableView* m_pParent;
45 :
46 : sal_Bool m_bSelected;
47 :
48 : void Init();
49 : /** loops through the vector and deletes all lines */
50 : void clearLineData();
51 :
52 : protected:
53 : OConnectionLine* CreateConnLine( const OConnectionLine& rConnLine );
54 :
55 : public:
56 : OTableConnection( OJoinTableView* pContainer, const TTableConnectionData::value_type& pTabConnData );
57 : OTableConnection( const OTableConnection& rConn );
58 : /** destructor
59 :
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.
66 : */
67 : virtual ~OTableConnection();
68 :
69 : OTableConnection& operator=( const OTableConnection& rConn );
70 :
71 : void Select();
72 : void Deselect();
73 0 : sal_Bool IsSelected() const { return m_bSelected; }
74 : sal_Bool CheckHit( const Point& rMousePos ) const;
75 : bool InvalidateConnection();
76 : void UpdateLineList();
77 :
78 : OTableWindow* GetSourceWin() const;
79 : OTableWindow* GetDestWin() const;
80 :
81 : bool RecalcLines();
82 : /** isTableConnection
83 :
84 : @param _pTable the table where we should check if we belongs to it
85 : @return true when the source or the destination window are equal
86 : */
87 0 : bool isTableConnection(const OTableWindow* _pTable)
88 : {
89 0 : return (_pTable == GetSourceWin() || _pTable == GetDestWin());
90 : }
91 :
92 : Rectangle GetBoundingRect() const;
93 :
94 0 : inline TTableConnectionData::value_type GetData() const { return m_pData; }
95 0 : const ::std::vector<OConnectionLine*>* GetConnLineList() const { return &m_vConnLine; }
96 0 : inline OJoinTableView* GetParent() const { return m_pParent; }
97 : virtual void Draw( const Rectangle& rRect );
98 : using Window::Draw;
99 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
100 : };
101 : }
102 : #endif
103 :
104 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|