1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ConnectionLine.hxx,v $
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_CONNECTIONLINE_HXX
31 #define DBAUI_CONNECTIONLINE_HXX
34 #include <tools/gen.hxx>
37 #include <tools/string.hxx>
39 #ifndef DBAUI_CONNECTIONLINEDATA_HXX
40 #include "ConnectionLineData.hxx"
48 //==================================================================
49 // ConnData ---------->* ConnLineData
52 // Conn ---------->* ConnLine
53 //==================================================================
56 the class OConnectionLine represents the graphical line between the to two windows
58 class OConnectionLineData
;
59 class OTableConnection
;
63 OTableConnection
* m_pTabConn
;
64 OConnectionLineDataRef m_pData
;
66 Point m_aSourceConnPos
,
68 Point m_aSourceDescrLinePos
,
71 OConnectionLine( OTableConnection
* pConn
, OConnectionLineDataRef pLineData
);
72 OConnectionLine( const OConnectionLine
& rLine
);
73 virtual ~OConnectionLine();
75 virtual OConnectionLine
& operator=( const OConnectionLine
& rLine
);
77 Rectangle
GetBoundingRect();
79 void Draw( OutputDevice
* pOutDev
);
80 bool CheckHit( const Point
& rMousePos
) const;
81 String
GetSourceFieldName() const { return m_pData
->GetSourceFieldName(); }
82 String
GetDestFieldName() const { return m_pData
->GetDestFieldName(); }
86 Rectangle
GetSourceTextPos() const;
87 Rectangle
GetDestTextPos() const;
89 OConnectionLineDataRef
GetData() const { return m_pData
; }
91 Point
getMidPoint() const;
93 /// unary_function Functor object for class OConnectionLine returntype is void
94 /// draws a connectionline object on outputdevice
95 struct TConnectionLineDrawFunctor
: ::std::unary_function
<OConnectionLine
*,void>
97 OutputDevice
* pDevice
;
98 TConnectionLineDrawFunctor(OutputDevice
* _pDevice
)
102 inline void operator()(OConnectionLine
* _pLine
)
104 _pLine
->Draw(pDevice
);
107 /// binary_function Functor object for class OConnectionLine returntype is bool
108 /// checks if the point is on connectionline
109 struct TConnectionLineCheckHitFunctor
: ::std::binary_function
<OConnectionLine
*,Point
,bool>
111 inline bool operator()(const OConnectionLine
* lhs
,const Point
& rhs
) const
113 return lhs
->CheckHit(rhs
);
118 #endif // DBAUI_CONNECTIONLINE_HXX