LCOV - code coverage report
Current view: top level - dbaccess/source/ui/tabledesign - TableFieldControl.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 52 1.9 %
Date: 2015-06-13 12:38:46 Functions: 2 17 11.8 %
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 "TableFieldControl.hxx"
      21             : #include "TableController.hxx"
      22             : #include "TableDesignView.hxx"
      23             : #include "TEditControl.hxx"
      24             : #include "dbustrings.hrc"
      25             : #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
      26             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      27             : #include <comphelper/types.hxx>
      28             : #include "TypeInfo.hxx"
      29             : #include "UITools.hxx"
      30             : 
      31             : using namespace ::com::sun::star::uno;
      32             : using namespace ::com::sun::star::beans;
      33             : using namespace ::com::sun::star::util;
      34             : using namespace ::com::sun::star::lang;
      35             : using namespace ::com::sun::star::sdbc;
      36             : using namespace dbaui;
      37             : 
      38           0 : OTableFieldControl::OTableFieldControl( vcl::Window* pParent, OTableDesignHelpBar* pHelpBar) :OFieldDescControl(pParent,pHelpBar)
      39             : {
      40           0 : }
      41             : 
      42           0 : void OTableFieldControl::CellModified(long nRow, sal_uInt16 nColId )
      43             : {
      44           0 :     GetCtrl()->CellModified(nRow,nColId);
      45           0 : }
      46             : 
      47           0 : OTableEditorCtrl* OTableFieldControl::GetCtrl() const
      48             : {
      49           0 :     OTableDesignView* pDesignWin = static_cast<OTableDesignView*>(GetParent()->GetParent()->GetParent()->GetParent());
      50             :     OSL_ENSURE(pDesignWin,"no view!");
      51           0 :     return pDesignWin->GetEditorCtrl();
      52             : }
      53             : 
      54           0 : bool OTableFieldControl::IsReadOnly()
      55             : {
      56           0 :     bool bRead(GetCtrl()->IsReadOnly());
      57           0 :     if( !bRead )
      58             :     {
      59             :         // The columns of a ::com::sun::star::sdbcx::View could not be locked
      60           0 :         Reference<XPropertySet> xTable = GetCtrl()->GetView()->getController().getTable();
      61           0 :         if(xTable.is() && ::comphelper::getString(xTable->getPropertyValue(PROPERTY_TYPE)) == "VIEW")
      62           0 :             bRead = true;
      63             :         else
      64             :         {
      65           0 :              ::boost::shared_ptr<OTableRow>  pCurRow = GetCtrl()->GetActRow();
      66           0 :             if( pCurRow )
      67           0 :                 bRead = pCurRow->IsReadOnly();
      68           0 :         }
      69             :     }
      70           0 :     return bRead;
      71             : }
      72             : 
      73           0 : void OTableFieldControl::ActivateAggregate( EControlType eType )
      74             : {
      75           0 :     switch(eType)
      76             :     {
      77             :         case tpColumnName:
      78             :         case tpType:
      79           0 :             break;
      80             :         default:
      81           0 :             OFieldDescControl::ActivateAggregate(eType);
      82             :     }
      83           0 : }
      84             : 
      85           0 : void OTableFieldControl::DeactivateAggregate( EControlType eType )
      86             : {
      87           0 :     switch(eType)
      88             :     {
      89             :         case tpColumnName:
      90             :         case tpType:
      91           0 :             break;
      92             :         default:
      93           0 :             OFieldDescControl::DeactivateAggregate(eType);
      94             :     }
      95           0 : }
      96             : 
      97           0 : void OTableFieldControl::SetModified(bool bModified)
      98             : {
      99           0 :     GetCtrl()->GetView()->getController().setModified(bModified);
     100           0 : }
     101             : 
     102           0 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> OTableFieldControl::getConnection()
     103             : {
     104           0 :     return GetCtrl()->GetView()->getController().getConnection();
     105             : }
     106             : 
     107           0 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> OTableFieldControl::getMetaData()
     108             : {
     109           0 :     Reference<XConnection> xCon = GetCtrl()->GetView()->getController().getConnection();
     110           0 :     if(!xCon.is())
     111           0 :         return NULL;
     112           0 :     return xCon->getMetaData();
     113             : }
     114             : 
     115           0 : Reference< XNumberFormatter >   OTableFieldControl::GetFormatter() const
     116             : {
     117           0 :     return GetCtrl()->GetView()->getController().getNumberFormatter();
     118             : }
     119             : 
     120           0 : TOTypeInfoSP OTableFieldControl::getTypeInfo(sal_Int32 _nPos)
     121             : {
     122           0 :     return GetCtrl()->GetView()->getController().getTypeInfo(_nPos);
     123             : }
     124             : 
     125           0 : const OTypeInfoMap* OTableFieldControl::getTypeInfo() const
     126             : {
     127           0 :     return &GetCtrl()->GetView()->getController().getTypeInfo();
     128             : }
     129             : 
     130           0 : Locale OTableFieldControl::GetLocale() const
     131             : {
     132           0 :     return GetCtrl()->GetView()->getLocale();
     133             : }
     134             : 
     135           0 : bool OTableFieldControl::isAutoIncrementValueEnabled() const
     136             : {
     137           0 :     return GetCtrl()->GetView()->getController().isAutoIncrementValueEnabled();
     138             : }
     139             : 
     140           0 : OUString OTableFieldControl::getAutoIncrementValue() const
     141             : {
     142           0 :     return GetCtrl()->GetView()->getController().getAutoIncrementValue();
     143          36 : }
     144             : 
     145             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11