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: RTableConnection.cxx,v $
10 * $Revision: 1.10.68.1 $
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 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
33 #ifndef DBAUI_RTABLECONNECTION_HXX
34 #include "RTableConnection.hxx"
36 #ifndef _TOOLS_DEBUG_HXX
37 #include <tools/debug.hxx>
39 #ifndef DBAUI_RELATION_TABLEVIEW_HXX
40 #include "RelationTableView.hxx"
43 #include <vcl/svapp.hxx>
45 #ifndef DBAUI_CONNECTIONLINE_HXX
46 #include "ConnectionLine.hxx"
49 using namespace dbaui
;
50 //========================================================================
51 // class ORelationTableConnection
52 //========================================================================
53 DBG_NAME(ORelationTableConnection
)
54 //------------------------------------------------------------------------
55 ORelationTableConnection::ORelationTableConnection( ORelationTableView
* pContainer
,
56 const TTableConnectionData::value_type
& pTabConnData
)
57 :OTableConnection( pContainer
, pTabConnData
)
59 DBG_CTOR(ORelationTableConnection
,NULL
);
62 //------------------------------------------------------------------------
63 ORelationTableConnection::ORelationTableConnection( const ORelationTableConnection
& rConn
)
64 : OTableConnection( rConn
)
66 DBG_CTOR(ORelationTableConnection
,NULL
);
67 // keine eigenen Members, also reicht die Basisklassenfunktionalitaet
70 //------------------------------------------------------------------------
71 ORelationTableConnection::~ORelationTableConnection()
73 DBG_DTOR(ORelationTableConnection
,NULL
);
76 //------------------------------------------------------------------------
77 ORelationTableConnection
& ORelationTableConnection::operator=( const ORelationTableConnection
& rConn
)
79 DBG_CHKTHIS(ORelationTableConnection
,NULL
);
80 // nicht dass es was aendern wuerde, da die Basisklasse das auch testet und ich keine eigenen Members zu kopieren habe
84 OTableConnection::operator=( rConn
);
89 //------------------------------------------------------------------------
90 void ORelationTableConnection::Draw( const Rectangle
& rRect
)
92 DBG_CHKTHIS(ORelationTableConnection
,NULL
);
93 OTableConnection::Draw( rRect
);
94 ORelationTableConnectionData
* pData
= static_cast< ORelationTableConnectionData
* >(GetData().get());
95 if ( pData
&& (pData
->GetCardinality() == CARDINAL_UNDEFINED
) )
98 //////////////////////////////////////////////////////////////////////
99 // Linien nach oberster Linie durchsuchen
100 Rectangle aBoundingRect
;
101 long nTop
= GetBoundingRect().Bottom();
104 const OConnectionLine
* pTopLine
= NULL
;
105 const ::std::vector
<OConnectionLine
*>* pConnLineList
= GetConnLineList();
106 ::std::vector
<OConnectionLine
*>::const_iterator aIter
= pConnLineList
->begin();
107 ::std::vector
<OConnectionLine
*>::const_iterator aEnd
= pConnLineList
->end();
108 for(;aIter
!= aEnd
;++aIter
)
110 if( (*aIter
)->IsValid() )
112 aBoundingRect
= (*aIter
)->GetBoundingRect();
113 nTemp
= aBoundingRect
.Top();
122 //////////////////////////////////////////////////////////////////////
123 // Kardinalitaet antragen
127 Rectangle aSourcePos
= pTopLine
->GetSourceTextPos();
128 Rectangle aDestPos
= pTopLine
->GetDestTextPos();
133 switch( pData
->GetCardinality() )
135 case CARDINAL_ONE_MANY
:
140 case CARDINAL_MANY_ONE
:
145 case CARDINAL_ONE_ONE
:
152 GetParent()->SetTextColor(Application::GetSettings().GetStyleSettings().GetHighlightColor());
154 GetParent()->SetTextColor(Application::GetSettings().GetStyleSettings().GetWindowTextColor());
157 GetParent()->DrawText( aSourcePos
, aSourceText
, TEXT_DRAW_CLIP
| TEXT_DRAW_CENTER
| TEXT_DRAW_BOTTOM
);
158 GetParent()->DrawText( aDestPos
, aDestText
, TEXT_DRAW_CLIP
| TEXT_DRAW_CENTER
| TEXT_DRAW_BOTTOM
);
160 // -----------------------------------------------------------------------------