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 DBAUI_TABLECONNECTION_HXX
20 : #define DBAUI_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 : DBG_NAMEEX(OTableConnection)
40 : class OTableConnection : public Window
41 : {
42 : ::std::vector<OConnectionLine*> m_vConnLine;
43 : TTableConnectionData::value_type
44 : m_pData;
45 : OJoinTableView* m_pParent;
46 :
47 : sal_Bool m_bSelected;
48 :
49 : void Init();
50 : /** loops through the vector and deletes all lines */
51 : void clearLineData();
52 :
53 : protected:
54 : OConnectionLine* CreateConnLine( const OConnectionLine& rConnLine );
55 :
56 : public:
57 : OTableConnection( OJoinTableView* pContainer, const TTableConnectionData::value_type& pTabConnData );
58 : OTableConnection( const OTableConnection& rConn );
59 : /** destructor
60 :
61 : @attention Normally a pointer to OTableConnectionData is given but
62 : here, however, one has to create an instance (with
63 : OTableConnectionDate::NewInstance) which is never deleted
64 : (same like in other cases). Thus, the caller is
65 : responsible to check and save the data for deleting it
66 : eventually.
67 : */
68 : virtual ~OTableConnection();
69 :
70 : OTableConnection& operator=( const OTableConnection& rConn );
71 :
72 : void Select();
73 : void Deselect();
74 0 : sal_Bool IsSelected() const { return m_bSelected; }
75 : sal_Bool CheckHit( const Point& rMousePos ) const;
76 : bool InvalidateConnection();
77 : void UpdateLineList();
78 :
79 : OTableWindow* GetSourceWin() const;
80 : OTableWindow* GetDestWin() const;
81 :
82 : bool RecalcLines();
83 : /** isTableConnection
84 :
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
87 : */
88 0 : bool isTableConnection(const OTableWindow* _pTable)
89 : {
90 0 : return (_pTable == GetSourceWin() || _pTable == GetDestWin());
91 : }
92 :
93 : Rectangle GetBoundingRect() const;
94 :
95 0 : inline TTableConnectionData::value_type GetData() const { return m_pData; }
96 0 : const ::std::vector<OConnectionLine*>* GetConnLineList() const { return &m_vConnLine; }
97 0 : inline OJoinTableView* GetParent() const { return m_pParent; }
98 : virtual void Draw( const Rectangle& rRect );
99 : using Window::Draw;
100 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
101 : };
102 : }
103 : #endif
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|