LCOV - code coverage report
Current view: top level - dbaccess/source/ui/relationdesign - RTableConnection.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 53 1.9 %
Date: 2014-11-03 Functions: 2 8 25.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      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"
      26             : 
      27             : using namespace dbaui;
      28             : // class ORelationTableConnection
      29           0 : ORelationTableConnection::ORelationTableConnection( ORelationTableView* pContainer,
      30             :                                                    const TTableConnectionData::value_type& pTabConnData )
      31           0 :     :OTableConnection( pContainer, pTabConnData )
      32             : {
      33           0 : }
      34             : 
      35           0 : ORelationTableConnection::ORelationTableConnection( const ORelationTableConnection& rConn )
      36           0 :     : OTableConnection( rConn )
      37             : {
      38             :     // no own members, thus the base class functionality is enough
      39           0 : }
      40             : 
      41           0 : ORelationTableConnection::~ORelationTableConnection()
      42             : {
      43           0 : }
      44             : 
      45           0 : ORelationTableConnection& ORelationTableConnection::operator=( const ORelationTableConnection& rConn )
      46             : {
      47             :     // this doesn't change anything, since the base class tests this, too and I don't have my own members to copy
      48           0 :     if (&rConn == this)
      49           0 :         return *this;
      50             : 
      51           0 :     OTableConnection::operator=( rConn );
      52           0 :     return *this;
      53             : }
      54             : 
      55           0 : void ORelationTableConnection::Draw( const Rectangle& rRect )
      56             : {
      57           0 :     OTableConnection::Draw( rRect );
      58           0 :     ORelationTableConnectionData* pData = static_cast< ORelationTableConnectionData* >(GetData().get());
      59           0 :     if ( pData && (pData->GetCardinality() == CARDINAL_UNDEFINED) )
      60           0 :         return;
      61             : 
      62             :     // search lines for top line
      63           0 :     Rectangle aBoundingRect;
      64           0 :     long nTop = GetBoundingRect().Bottom();
      65             :     long nTemp;
      66             : 
      67           0 :     const OConnectionLine* pTopLine = NULL;
      68           0 :     const ::std::vector<OConnectionLine*>& rConnLineList = GetConnLineList();
      69           0 :     ::std::vector<OConnectionLine*>::const_iterator aIter = rConnLineList.begin();
      70           0 :     ::std::vector<OConnectionLine*>::const_iterator aEnd = rConnLineList.end();
      71           0 :     for(;aIter != aEnd;++aIter)
      72             :     {
      73           0 :         if( (*aIter)->IsValid() )
      74             :         {
      75           0 :             aBoundingRect = (*aIter)->GetBoundingRect();
      76           0 :             nTemp = aBoundingRect.Top();
      77           0 :             if( nTemp<nTop )
      78             :             {
      79           0 :                 nTop = nTemp;
      80           0 :                 pTopLine = (*aIter);
      81             :             }
      82             :         }
      83             :     }
      84             : 
      85             :     // cardinality
      86           0 :     if( !pTopLine )
      87           0 :         return;
      88             : 
      89           0 :     Rectangle aSourcePos = pTopLine->GetSourceTextPos();
      90           0 :     Rectangle aDestPos = pTopLine->GetDestTextPos();
      91             : 
      92           0 :     OUString aSourceText;
      93           0 :     OUString aDestText;
      94             : 
      95           0 :     switch( pData->GetCardinality() )
      96             :     {
      97             :     case CARDINAL_ONE_MANY:
      98           0 :         aSourceText = "1";
      99           0 :         aDestText   = "n";
     100           0 :         break;
     101             : 
     102             :     case CARDINAL_MANY_ONE:
     103           0 :         aSourceText = "n";
     104           0 :         aDestText   = "1";
     105           0 :         break;
     106             : 
     107             :     case CARDINAL_ONE_ONE:
     108           0 :         aSourceText = "1";
     109           0 :         aDestText   = "1";
     110           0 :         break;
     111             :     }
     112             : 
     113           0 :     if (IsSelected())
     114           0 :         GetParent()->SetTextColor(Application::GetSettings().GetStyleSettings().GetHighlightColor());
     115             :     else
     116           0 :         GetParent()->SetTextColor(Application::GetSettings().GetStyleSettings().GetWindowTextColor());
     117             : 
     118           0 :     GetParent()->DrawText( aSourcePos, aSourceText, TEXT_DRAW_CLIP | TEXT_DRAW_CENTER | TEXT_DRAW_BOTTOM);
     119           0 :     GetParent()->DrawText( aDestPos, aDestText, TEXT_DRAW_CLIP | TEXT_DRAW_CENTER | TEXT_DRAW_BOTTOM);
     120          72 : }
     121             : 
     122             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10