LCOV - code coverage report
Current view: top level - dbaccess/source/ui/control - ColumnControlWindow.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 60 0.0 %
Date: 2014-04-14 Functions: 0 16 0.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 "ColumnControlWindow.hxx"
      21             : #include "FieldControls.hxx"
      22             : #include <unotools/syslocale.hxx>
      23             : #include <connectivity/dbtools.hxx>
      24             : #include "UITools.hxx"
      25             : #include "dbu_resource.hrc"
      26             : #include <comphelper/processfactory.hxx>
      27             : #include <com/sun/star/util/NumberFormatter.hpp>
      28             : 
      29             : using namespace ::dbaui;
      30             : using namespace ::com::sun::star::uno;
      31             : using namespace ::com::sun::star::beans;
      32             : using namespace ::com::sun::star::container;
      33             : using namespace ::com::sun::star::util;
      34             : using namespace ::com::sun::star::sdbc;
      35             : using namespace ::com::sun::star::lang;
      36             : 
      37             : // OColumnControlWindow
      38           0 : OColumnControlWindow::OColumnControlWindow(Window* pParent
      39             :                                            ,const Reference<XComponentContext>& _rxContext)
      40             :             : OFieldDescControl(pParent,NULL)
      41             :             , m_xContext(_rxContext)
      42             :             , m_sTypeNames(ModuleRes(STR_TABLEDESIGN_DBFIELDTYPES))
      43           0 :             , m_bAutoIncrementEnabled(sal_True)
      44             : {
      45             : 
      46           0 :     setRightAligned();
      47           0 :     m_aLocale = SvtSysLocale().GetLanguageTag().getLocale();
      48           0 : }
      49             : 
      50           0 : OColumnControlWindow::~OColumnControlWindow()
      51             : {
      52             : 
      53           0 : }
      54             : 
      55           0 : void OColumnControlWindow::ActivateAggregate( EControlType eType )
      56             : {
      57           0 :     switch(eType )
      58             :     {
      59             :         case tpFormat:
      60             :         case tpDefault:
      61             :         case tpColumnName:
      62           0 :             break;
      63             :         default:
      64           0 :             OFieldDescControl::ActivateAggregate( eType );
      65             :     }
      66           0 : }
      67             : 
      68           0 : void OColumnControlWindow::DeactivateAggregate( EControlType eType )
      69             : {
      70           0 :     switch(eType )
      71             :     {
      72             :         case tpFormat:
      73             :         case tpDefault:
      74             :         case tpColumnName:
      75           0 :             break;
      76             :         default:
      77           0 :             OFieldDescControl::DeactivateAggregate( eType );
      78             :     }
      79           0 : }
      80             : 
      81           0 : void OColumnControlWindow::CellModified(long /*nRow*/, sal_uInt16 /*nColId*/ )
      82             : {
      83           0 :     saveCurrentFieldDescData();
      84           0 : }
      85             : 
      86           0 : ::com::sun::star::lang::Locale  OColumnControlWindow::GetLocale() const
      87             : {
      88           0 :     return m_aLocale;
      89             : }
      90             : 
      91           0 : Reference< XNumberFormatter > OColumnControlWindow::GetFormatter() const
      92             : {
      93           0 :     if ( !m_xFormatter.is() )
      94             :         try
      95             :         {
      96           0 :             Reference< XNumberFormatsSupplier >  xSupplier(::dbtools::getNumberFormats(m_xConnection, true, m_xContext));
      97             : 
      98           0 :             if ( xSupplier.is() )
      99             :             {
     100             :                 // create a new formatter
     101           0 :                 m_xFormatter.set( NumberFormatter::create(m_xContext), UNO_QUERY_THROW);
     102           0 :                 m_xFormatter->attachNumberFormatsSupplier(xSupplier);
     103           0 :             }
     104             :         }
     105           0 :         catch(Exception&)
     106             :         {
     107             :         }
     108           0 :     return m_xFormatter;
     109             : }
     110             : 
     111           0 : TOTypeInfoSP OColumnControlWindow::getTypeInfo(sal_Int32 _nPos)
     112             : {
     113           0 :     return ( _nPos >= 0 && _nPos < static_cast<sal_Int32>(m_aDestTypeInfoIndex.size())) ? m_aDestTypeInfoIndex[_nPos]->second : TOTypeInfoSP();
     114             : }
     115             : 
     116           0 : const OTypeInfoMap* OColumnControlWindow::getTypeInfo() const
     117             : {
     118           0 :     return &m_aDestTypeInfo;
     119             : }
     120             : 
     121           0 : Reference< XDatabaseMetaData> OColumnControlWindow::getMetaData()
     122             : {
     123           0 :     if ( m_xConnection.is() )
     124           0 :         return m_xConnection->getMetaData();
     125           0 :     return Reference< XDatabaseMetaData>();
     126             : }
     127             : 
     128           0 : Reference< XConnection> OColumnControlWindow::getConnection()
     129             : {
     130           0 :     return m_xConnection;
     131             : }
     132             : 
     133           0 : void OColumnControlWindow::setConnection(const Reference< XConnection>& _xCon)
     134             : {
     135           0 :     m_xConnection = _xCon;
     136           0 :     m_xFormatter = NULL;
     137           0 :     m_aDestTypeInfoIndex.clear();
     138           0 :     m_aDestTypeInfo.clear();
     139             : 
     140           0 :     if ( m_xConnection.is() )
     141             :     {
     142           0 :         Init();
     143             : 
     144           0 :         ::dbaui::fillTypeInfo(m_xConnection,m_sTypeNames,m_aDestTypeInfo,m_aDestTypeInfoIndex);
     145             :         // read autoincrement value set in the datasource
     146           0 :         ::dbaui::fillAutoIncrementValue(m_xConnection,m_bAutoIncrementEnabled,m_sAutoIncrementValue);
     147             :     }
     148           0 : }
     149             : 
     150           0 : sal_Bool OColumnControlWindow::isAutoIncrementValueEnabled() const
     151             : {
     152           0 :     return m_bAutoIncrementEnabled;
     153             : }
     154             : 
     155           0 : OUString OColumnControlWindow::getAutoIncrementValue() const
     156             : {
     157           0 :     return m_sAutoIncrementValue;
     158             : }
     159             : 
     160           0 : TOTypeInfoSP OColumnControlWindow::getDefaultTyp() const
     161             : {
     162           0 :     if ( !m_pTypeInfo.get() )
     163             :     {
     164           0 :         m_pTypeInfo = TOTypeInfoSP(new OTypeInfo());
     165           0 :         m_pTypeInfo->aUIName = m_sTypeNames.getToken(TYPE_OTHER, ';');
     166             :     }
     167           0 :     return m_pTypeInfo;
     168             : }
     169             : 
     170             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10