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 .
20 #include "RTableConnection.hxx"
21 #include <tools/debug.hxx>
22 #include "RelationTableView.hxx"
23 #include <vcl/svapp.hxx>
24 #include <vcl/settings.hxx>
25 #include "ConnectionLine.hxx"
27 using namespace dbaui
;
28 // class ORelationTableConnection
29 ORelationTableConnection::ORelationTableConnection( ORelationTableView
* pContainer
,
30 const TTableConnectionData::value_type
& pTabConnData
)
31 :OTableConnection( pContainer
, pTabConnData
)
35 ORelationTableConnection::ORelationTableConnection( const ORelationTableConnection
& rConn
)
36 : OTableConnection( rConn
)
38 // no own members, thus the base class functionality is enough
41 ORelationTableConnection
& ORelationTableConnection::operator=( const ORelationTableConnection
& rConn
)
43 // this doesn't change anything, since the base class tests this, too and I don't have my own members to copy
47 OTableConnection::operator=( rConn
);
51 void ORelationTableConnection::Draw(vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
)
53 OTableConnection::Draw(rRenderContext
, rRect
);
54 ORelationTableConnectionData
* pData
= static_cast< ORelationTableConnectionData
* >(GetData().get());
55 if (pData
&& (pData
->GetCardinality() == CARDINAL_UNDEFINED
))
58 // search lines for top line
59 Rectangle aBoundingRect
;
60 long nTop
= GetBoundingRect().Bottom();
63 const OConnectionLine
* pTopLine
= NULL
;
64 const ::std::vector
<OConnectionLine
*>& rConnLineList
= GetConnLineList();
65 std::vector
<OConnectionLine
*>::const_iterator aIter
= rConnLineList
.begin();
66 std::vector
<OConnectionLine
*>::const_iterator aEnd
= rConnLineList
.end();
68 for(;aIter
!= aEnd
;++aIter
)
70 if( (*aIter
)->IsValid() )
72 aBoundingRect
= (*aIter
)->GetBoundingRect();
73 nTemp
= aBoundingRect
.Top();
86 Rectangle aSourcePos
= pTopLine
->GetSourceTextPos();
87 Rectangle aDestPos
= pTopLine
->GetDestTextPos();
92 switch (pData
->GetCardinality())
94 case CARDINAL_ONE_MANY
:
99 case CARDINAL_MANY_ONE
:
104 case CARDINAL_ONE_ONE
:
111 rRenderContext
.SetTextColor(Application::GetSettings().GetStyleSettings().GetHighlightColor());
113 rRenderContext
.SetTextColor(Application::GetSettings().GetStyleSettings().GetWindowTextColor());
115 rRenderContext
.DrawText(aSourcePos
, aSourceText
, DrawTextFlags::Clip
| DrawTextFlags::Center
| DrawTextFlags::Bottom
);
116 rRenderContext
.DrawText(aDestPos
, aDestText
, DrawTextFlags::Clip
| DrawTextFlags::Center
| DrawTextFlags::Bottom
);
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */