merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / ui / inc / ConnectionLine.hxx
blob0aa300e026c714b7908ffa5fce9560c874c41ad3
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: ConnectionLine.hxx,v $
10 * $Revision: 1.8 $
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
33 #ifndef _SV_GEN_HXX
34 #include <tools/gen.hxx>
35 #endif
36 #ifndef _STRING_HXX
37 #include <tools/string.hxx>
38 #endif
39 #ifndef DBAUI_CONNECTIONLINEDATA_HXX
40 #include "ConnectionLineData.hxx"
41 #endif
42 #include <functional>
44 class OutputDevice;
45 namespace dbaui
48 //==================================================================
49 // ConnData ---------->* ConnLineData
50 // ^1 ^1
51 // | |
52 // Conn ---------->* ConnLine
53 //==================================================================
56 the class OConnectionLine represents the graphical line between the to two windows
57 **/
58 class OConnectionLineData;
59 class OTableConnection;
60 class OTableWindow;
61 class OConnectionLine
63 OTableConnection* m_pTabConn;
64 OConnectionLineDataRef m_pData;
66 Point m_aSourceConnPos,
67 m_aDestConnPos;
68 Point m_aSourceDescrLinePos,
69 m_aDestDescrLinePos;
70 public:
71 OConnectionLine( OTableConnection* pConn, OConnectionLineDataRef pLineData );
72 OConnectionLine( const OConnectionLine& rLine );
73 virtual ~OConnectionLine();
75 virtual OConnectionLine& operator=( const OConnectionLine& rLine );
77 Rectangle GetBoundingRect();
78 BOOL RecalcLine();
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(); }
84 BOOL IsValid() const;
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)
100 pDevice = _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