update dev300-m58
[ooovba.git] / dbaccess / source / ui / inc / TableConnection.hxx
blob47def233aeec152ac6a5655124294994adeb7e91
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TableConnection.hxx,v $
10 * $Revision: 1.11 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef DBAUI_TABLECONNECTION_HXX
31 #define DBAUI_TABLECONNECTION_HXX
33 //#ifndef _SV_GEN_HXX
34 //#include <tools/gen.hxx>
35 //#endif
36 //#ifndef DBAUI_CONNECTIONLINE_HXX
37 //#include "ConnectionLine.hxx"
38 //#endif
39 #include <vector>
40 #ifndef _TOOLS_DEBUG_HXX
41 #include <tools/debug.hxx>
42 #endif
43 #ifndef _SV_WINDOW_HXX
44 #include <vcl/window.hxx>
45 #endif
46 #ifndef _RTTI_HXX
47 #include <tools/rtti.hxx>
48 #endif
49 #ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
50 #include <com/sun/star/uno/Reference.h>
51 #endif
52 #include "TableConnectionData.hxx"
54 class Point;
55 class Rectangle;
57 namespace dbaui
59 class OTableConnectionData;
60 class OTableWindow;
61 class OJoinTableView;
62 class OConnectionLine;
64 DBG_NAMEEX(OTableConnection)
65 class OTableConnection : public Window
67 ::std::vector<OConnectionLine*> m_vConnLine;
68 TTableConnectionData::value_type
69 m_pData;
70 OJoinTableView* m_pParent;
72 BOOL m_bSelected;
74 void Init();
75 /** clearLineData loops through the vector and deletes all lines
77 void clearLineData();
79 protected:
80 OConnectionLine* CreateConnLine( const OConnectionLine& rConnLine );
82 public:
83 OTableConnection( OJoinTableView* pContainer, const TTableConnectionData::value_type& pTabConnData );
84 OTableConnection( const OTableConnection& rConn );
85 // WICHTIG : normalerweise bekomme ich von aussen einen Zeiger auf OTableConnectionData mitgegeben, hier aber muss ich
86 // mir (ueber OTableConnectionData::NewInstance) selber eine INstanz anlegen, die ich aber - wie in allen anderen Faellen auch -
87 // NIE loesche. Der Aufrufer ist also bei Benutzung dieses Constructors dafuer verantwortlich, meine Daten abzufragen und
88 // sich irgendwo zu merken, um sie dann irgendwann zu loeschen.
89 virtual ~OTableConnection();
91 OTableConnection& operator=( const OTableConnection& rConn );
94 void Select();
95 void Deselect();
96 BOOL IsSelected() const { return m_bSelected; }
97 BOOL CheckHit( const Point& rMousePos ) const;
98 bool InvalidateConnection();
99 void UpdateLineList();
101 OTableWindow* GetSourceWin() const;
102 OTableWindow* GetDestWin() const;
104 bool RecalcLines();
105 /** isTableConnection
106 @param _pTable the table where we should check if we belongs to it
108 @return true when the source or the destination window are equal
110 bool isTableConnection(const OTableWindow* _pTable)
112 return (_pTable == GetSourceWin() || _pTable == GetDestWin());
115 Rectangle GetBoundingRect() const;
117 inline TTableConnectionData::value_type GetData() const { return m_pData; }
118 const ::std::vector<OConnectionLine*>* GetConnLineList() const { return &m_vConnLine; }
119 inline OJoinTableView* GetParent() const { return m_pParent; }
120 virtual void Draw( const Rectangle& rRect );
121 using Window::Draw;
122 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
125 #endif // DBAUI_TABLECONNECTION_HXX