Bump version to 5.0-14
[LibreOffice.git] / dbaccess / source / ui / inc / ConnectionLine.hxx
blob3918b6b80539aa211de7be5ddd8e34b9279a8053
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_CONNECTIONLINE_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINE_HXX
22 #include <tools/gen.hxx>
23 #include "ConnectionLineData.hxx"
24 #include <functional>
25 #include <vcl/vclptr.hxx>
27 class OutputDevice;
28 namespace dbaui
31 // ConnData ---------->* ConnLineData
32 // ^1 ^1
33 // | |
34 // Conn ---------->* ConnLine
37 the class OConnectionLine represents the graphical line between the to two windows
38 **/
39 class OTableConnection;
40 class OConnectionLine
42 VclPtr<OTableConnection> m_pTabConn;
43 OConnectionLineDataRef m_pData;
45 Point m_aSourceConnPos,
46 m_aDestConnPos;
47 Point m_aSourceDescrLinePos,
48 m_aDestDescrLinePos;
49 public:
50 OConnectionLine( OTableConnection* pConn, OConnectionLineDataRef pLineData );
51 OConnectionLine( const OConnectionLine& rLine );
52 virtual ~OConnectionLine();
54 OConnectionLine& operator=( const OConnectionLine& rLine );
56 Rectangle GetBoundingRect();
57 bool RecalcLine();
58 void Draw( OutputDevice* pOutDev );
59 bool CheckHit( const Point& rMousePos ) const;
60 OUString GetSourceFieldName() const { return m_pData->GetSourceFieldName(); }
61 OUString GetDestFieldName() const { return m_pData->GetDestFieldName(); }
63 bool IsValid() const;
65 Rectangle GetSourceTextPos() const;
66 Rectangle GetDestTextPos() const;
68 OConnectionLineDataRef GetData() const { return m_pData; }
70 Point getMidPoint() const;
72 /// unary_function Functor object for class OConnectionLine returntype is void
73 /// draws a connectionline object on outputdevice
74 struct TConnectionLineDrawFunctor : std::unary_function<OConnectionLine*, void>
76 VclPtr<OutputDevice> pDevice;
77 TConnectionLineDrawFunctor(OutputDevice* _pDevice)
79 pDevice = _pDevice;
81 inline void operator()(OConnectionLine* _pLine)
83 _pLine->Draw(pDevice);
86 /// binary_function Functor object for class OConnectionLine returntype is bool
87 /// checks if the point is on connectionline
88 struct TConnectionLineCheckHitFunctor : ::std::binary_function<OConnectionLine*,Point,bool>
90 inline bool operator()(const OConnectionLine* lhs,const Point& rhs) const
92 return lhs->CheckHit(rhs);
97 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_CONNECTIONLINE_HXX
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */