LCOV - code coverage report
Current view: top level - dbaccess/source/ui/uno - ColumnPeer.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 69 0.0 %
Date: 2012-08-25 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 140 0.0 %

           Branch data     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 "ColumnPeer.hxx"
      21                 :            : #include "ColumnControlWindow.hxx"
      22                 :            : #include <vcl/svapp.hxx>
      23                 :            : #include "dbustrings.hrc"
      24                 :            : #include "FieldDescriptions.hxx"
      25                 :            : 
      26                 :            : //.........................................................................
      27                 :            : namespace dbaui
      28                 :            : {
      29                 :            : //.........................................................................
      30                 :            : using namespace ::com::sun::star::awt;
      31                 :            : using namespace ::com::sun::star::uno;
      32                 :            : using namespace ::com::sun::star::beans;
      33                 :            : using namespace ::com::sun::star::lang;
      34                 :            : using namespace ::com::sun::star::sdbc;
      35                 :            : 
      36                 :          0 : OColumnPeer::OColumnPeer(Window* _pParent,const Reference<XMultiServiceFactory>& _rxFactory)
      37                 :            :     :m_xORB(_rxFactory)
      38                 :          0 :     ,m_pActFieldDescr(NULL)
      39                 :            : {
      40         [ #  # ]:          0 :     osl_incrementInterlockedCount( &m_refCount );
      41                 :            :     {
      42 [ #  # ][ #  # ]:          0 :         OColumnControlWindow* pFieldControl = new OColumnControlWindow(_pParent,m_xORB);
      43 [ #  # ][ #  # ]:          0 :         pFieldControl->SetComponentInterface(this);
      44         [ #  # ]:          0 :         pFieldControl->Show();
      45                 :            :     }
      46         [ #  # ]:          0 :     osl_decrementInterlockedCount( &m_refCount );
      47                 :          0 : }
      48                 :            : // -----------------------------------------------------------------------------
      49                 :          0 : void OColumnPeer::setEditWidth(sal_Int32 _nWidth)
      50                 :            : {
      51         [ #  # ]:          0 :     SolarMutexGuard aGuard;
      52                 :            : 
      53                 :          0 :     OColumnControlWindow* pFieldControl = static_cast<OColumnControlWindow*>( GetWindow() );
      54         [ #  # ]:          0 :     if ( pFieldControl )
      55                 :            :     {
      56                 :          0 :         pFieldControl->setEditWidth(_nWidth);
      57         [ #  # ]:          0 :     }
      58                 :          0 : }
      59                 :            : // -----------------------------------------------------------------------------
      60                 :          0 : void OColumnPeer::setColumn(const Reference< XPropertySet>& _xColumn)
      61                 :            : {
      62         [ #  # ]:          0 :     SolarMutexGuard aGuard;
      63                 :            : 
      64                 :          0 :     OColumnControlWindow* pFieldControl = static_cast<OColumnControlWindow*>( GetWindow() );
      65         [ #  # ]:          0 :     if ( pFieldControl )
      66                 :            :     {
      67         [ #  # ]:          0 :         if ( m_pActFieldDescr )
      68                 :            :         {
      69 [ #  # ][ #  # ]:          0 :             delete m_pActFieldDescr;
      70                 :          0 :             m_pActFieldDescr = NULL;
      71                 :            :         }
      72         [ #  # ]:          0 :         if ( _xColumn.is() )
      73                 :            :         {
      74                 :          0 :             sal_Int32 nType         = 0;
      75                 :          0 :             sal_Int32 nScale        = 0;
      76                 :          0 :             sal_Int32 nPrecision    = 0;
      77                 :          0 :             sal_Bool bAutoIncrement = sal_False;
      78                 :          0 :             ::rtl::OUString sTypeName;
      79                 :            : 
      80                 :            :             try
      81                 :            :             {
      82                 :            :                 // get the properties from the column
      83 [ #  # ][ #  # ]:          0 :                 _xColumn->getPropertyValue(PROPERTY_TYPENAME)       >>= sTypeName;
                 [ #  # ]
      84 [ #  # ][ #  # ]:          0 :                 _xColumn->getPropertyValue(PROPERTY_TYPE)           >>= nType;
                 [ #  # ]
      85 [ #  # ][ #  # ]:          0 :                 _xColumn->getPropertyValue(PROPERTY_SCALE)          >>= nScale;
                 [ #  # ]
      86 [ #  # ][ #  # ]:          0 :                 _xColumn->getPropertyValue(PROPERTY_PRECISION)      >>= nPrecision;
                 [ #  # ]
      87 [ #  # ][ #  # ]:          0 :                 _xColumn->getPropertyValue(PROPERTY_ISAUTOINCREMENT)    >>= bAutoIncrement;
         [ #  # ][ #  # ]
      88                 :            :             }
      89         [ #  # ]:          0 :             catch(const Exception&)
      90                 :            :             {
      91                 :            :             }
      92                 :            : 
      93 [ #  # ][ #  # ]:          0 :             m_pActFieldDescr = new OFieldDescription(_xColumn,sal_True);
      94                 :            :             // search for type
      95         [ #  # ]:          0 :             ::rtl::OUString sCreateParam(RTL_CONSTASCII_USTRINGPARAM("x"));
      96                 :            :             sal_Bool bForce;
      97 [ #  # ][ #  # ]:          0 :             TOTypeInfoSP pTypeInfo = ::dbaui::getTypeInfoFromType(*pFieldControl->getTypeInfo(),nType,sTypeName,sCreateParam,nPrecision,nScale,bAutoIncrement,bForce);
      98         [ #  # ]:          0 :             if ( !pTypeInfo.get() )
      99 [ #  # ][ #  # ]:          0 :                 pTypeInfo = pFieldControl->getDefaultTyp();
                 [ #  # ]
     100                 :            : 
     101         [ #  # ]:          0 :             m_pActFieldDescr->FillFromTypeInfo(pTypeInfo,sal_True,sal_False);
     102 [ #  # ][ #  # ]:          0 :             m_xColumn = _xColumn;
     103                 :            :         }
     104         [ #  # ]:          0 :         pFieldControl->DisplayData(m_pActFieldDescr);
     105         [ #  # ]:          0 :     }
     106                 :          0 : }
     107                 :            : // -----------------------------------------------------------------------------
     108                 :          0 : void OColumnPeer::setConnection(const Reference< XConnection>& _xCon)
     109                 :            : {
     110         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     111                 :          0 :     OColumnControlWindow* pFieldControl = static_cast<OColumnControlWindow*>( GetWindow() );
     112         [ #  # ]:          0 :     if ( pFieldControl )
     113 [ #  # ][ #  # ]:          0 :         pFieldControl->setConnection(_xCon);
     114                 :          0 : }
     115                 :            : //------------------------------------------------------------------------------
     116                 :          0 : void OColumnPeer::setProperty( const ::rtl::OUString& _rPropertyName, const Any& Value) throw( RuntimeException )
     117                 :            : {
     118         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     119                 :            : 
     120         [ #  # ]:          0 :     if (_rPropertyName.equalsAsciiL(PROPERTY_COLUMN.ascii, PROPERTY_COLUMN.length) )
     121                 :            :     {
     122         [ #  # ]:          0 :         Reference<XPropertySet> xProp(Value,UNO_QUERY);
     123         [ #  # ]:          0 :         setColumn(xProp);
     124                 :            :     }
     125         [ #  # ]:          0 :     else if (_rPropertyName.equalsAsciiL(PROPERTY_ACTIVE_CONNECTION.ascii, PROPERTY_ACTIVE_CONNECTION.length) )
     126                 :            :     {
     127         [ #  # ]:          0 :         Reference<XConnection> xCon(Value,UNO_QUERY);
     128         [ #  # ]:          0 :         setConnection(xCon);
     129                 :            :     }
     130                 :            :     else
     131 [ #  # ][ #  # ]:          0 :         VCLXWindow::setProperty(_rPropertyName,Value);
     132                 :          0 : }
     133                 :            : // -----------------------------------------------------------------------------
     134                 :          0 : Any OColumnPeer::getProperty( const ::rtl::OUString& _rPropertyName ) throw( RuntimeException )
     135                 :            : {
     136                 :          0 :     Any aProp;
     137                 :          0 :     OFieldDescControl* pFieldControl = static_cast<OFieldDescControl*>( GetWindow() );
     138 [ #  # ][ #  # ]:          0 :     if (pFieldControl && _rPropertyName.equalsAsciiL(PROPERTY_COLUMN.ascii, PROPERTY_COLUMN.length))
                 [ #  # ]
     139                 :            :     {
     140         [ #  # ]:          0 :         aProp <<= m_xColumn;
     141                 :            :     }
     142 [ #  # ][ #  # ]:          0 :     else if (pFieldControl && _rPropertyName.equalsAsciiL(PROPERTY_ACTIVE_CONNECTION.ascii, PROPERTY_ACTIVE_CONNECTION.length))
                 [ #  # ]
     143                 :            :     {
     144 [ #  # ][ #  # ]:          0 :         aProp <<= pFieldControl->getConnection();
     145                 :            :     }
     146                 :            :     else
     147         [ #  # ]:          0 :         aProp = VCLXWindow::getProperty(_rPropertyName);
     148                 :          0 :     return aProp;
     149                 :            : }
     150                 :            : //.........................................................................
     151                 :            : }   // namespace dbaui
     152                 :            : //.........................................................................
     153                 :            : 
     154                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10