1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
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"
34 class OTableConnectionData
;
37 class OConnectionLine
;
39 class OTableConnection
: public vcl::Window
41 ::std::vector
<OConnectionLine
*> m_vConnLine
;
42 TTableConnectionData::value_type
44 VclPtr
<OJoinTableView
> m_pParent
;
49 /** loops through the vector and deletes all lines */
53 static OConnectionLine
* CreateConnLine( const OConnectionLine
& rConnLine
);
56 OTableConnection( OJoinTableView
* pContainer
, const TTableConnectionData::value_type
& pTabConnData
);
57 OTableConnection( const OTableConnection
& rConn
);
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
67 virtual ~OTableConnection();
68 virtual void dispose() SAL_OVERRIDE
;
70 OTableConnection
& operator=( const OTableConnection
& rConn
);
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;
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
);
100 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> CreateAccessible() SAL_OVERRIDE
;
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */