LCOV - code coverage report
Current view: top level - dbaccess/source/core/dataaccess - commanddefinition.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 36 80 45.0 %
Date: 2014-11-03 Functions: 16 31 51.6 %
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 "commanddefinition.hxx"
      21             : #include "apitools.hxx"
      22             : #include "dbastrings.hrc"
      23             : #include "module_dba.hxx"
      24             : #include "services.hxx"
      25             : 
      26             : #include <com/sun/star/lang/DisposedException.hpp>
      27             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      28             : 
      29             : #include <tools/debug.hxx>
      30             : #include <comphelper/sequence.hxx>
      31             : 
      32             : using namespace ::com::sun::star::uno;
      33             : using namespace ::com::sun::star::sdbc;
      34             : using namespace ::com::sun::star::lang;
      35             : using namespace ::com::sun::star::beans;
      36             : using namespace ::com::sun::star::container;
      37             : using namespace ::osl;
      38             : using namespace ::comphelper;
      39             : using namespace ::cppu;
      40             : 
      41             : // OCommandDefinition
      42          52 : extern "C" void SAL_CALL createRegistryInfo_OCommandDefinition()
      43             : {
      44          52 :     static ::dba::OAutoRegistration< ::dbaccess::OCommandDefinition > aAutoRegistration;
      45          52 : }
      46             : 
      47             : namespace dbaccess
      48             : {
      49             : 
      50          30 : void OCommandDefinition::registerProperties()
      51             : {
      52          30 :     OCommandDefinition_Impl& rCommandDefinition( getCommandDefinition() );
      53             :     registerProperty(PROPERTY_COMMAND, PROPERTY_ID_COMMAND, PropertyAttribute::BOUND,
      54          30 :                     &rCommandDefinition.m_sCommand, ::getCppuType(&rCommandDefinition.m_sCommand));
      55             : 
      56             :     registerProperty(PROPERTY_ESCAPE_PROCESSING, PROPERTY_ID_ESCAPE_PROCESSING, PropertyAttribute::BOUND,
      57          30 :                     &rCommandDefinition.m_bEscapeProcessing, ::getBooleanCppuType());
      58             : 
      59             :     registerProperty(PROPERTY_UPDATE_TABLENAME, PROPERTY_ID_UPDATE_TABLENAME, PropertyAttribute::BOUND,
      60          30 :                     &rCommandDefinition.m_sUpdateTableName, ::getCppuType(&rCommandDefinition.m_sUpdateTableName));
      61             : 
      62             :     registerProperty(PROPERTY_UPDATE_SCHEMANAME, PROPERTY_ID_UPDATE_SCHEMANAME, PropertyAttribute::BOUND,
      63          30 :                     &rCommandDefinition.m_sUpdateSchemaName, ::getCppuType(&rCommandDefinition.m_sUpdateSchemaName));
      64             : 
      65             :     registerProperty(PROPERTY_UPDATE_CATALOGNAME, PROPERTY_ID_UPDATE_CATALOGNAME, PropertyAttribute::BOUND,
      66          30 :                     &rCommandDefinition.m_sUpdateCatalogName, ::getCppuType(&rCommandDefinition.m_sUpdateCatalogName));
      67             :     registerProperty(PROPERTY_LAYOUTINFORMATION, PROPERTY_ID_LAYOUTINFORMATION, PropertyAttribute::BOUND,
      68          30 :                     &rCommandDefinition.m_aLayoutInformation, ::getCppuType(&rCommandDefinition.m_aLayoutInformation));
      69          30 : }
      70             : 
      71           0 : OUString OCommandDefinition::getName() throw( ::com::sun::star::uno::RuntimeException )
      72             : {
      73           0 :     return getDefinition().m_aProps.aTitle;
      74             : }
      75             : 
      76           0 : OUString OCommandDefinition::getCommand() throw( ::com::sun::star::uno::RuntimeException )
      77             : {
      78           0 :     return getCommandDefinition().m_sCommand;
      79             : }
      80             : 
      81           0 : void OCommandDefinition::setCommand(const OUString& p1) throw( ::com::sun::star::uno::RuntimeException )
      82             : {
      83           0 :     setPropertyValue(PROPERTY_COMMAND, Any(p1) );
      84           0 : }
      85             : 
      86           0 : bool OCommandDefinition::getEscapeProcessing() throw( ::com::sun::star::uno::RuntimeException )
      87             : {
      88           0 :     return getCommandDefinition().m_bEscapeProcessing;
      89             : }
      90             : 
      91           0 : void OCommandDefinition::setEscapeProcessing(bool p1) throw( ::com::sun::star::uno::RuntimeException )
      92             : {
      93           0 :     setPropertyValue(PROPERTY_ESCAPE_PROCESSING, Any(p1) );
      94           0 : }
      95             : 
      96           0 : OUString OCommandDefinition::getUpdateTableName() throw( ::com::sun::star::uno::RuntimeException )
      97             : {
      98           0 :     return getCommandDefinition().m_sUpdateTableName;
      99             : }
     100             : 
     101           0 : void OCommandDefinition::setUpdateTableName(const OUString& p1) throw( ::com::sun::star::uno::RuntimeException )
     102             : {
     103           0 :     setPropertyValue(PROPERTY_UPDATE_TABLENAME, Any(p1) );
     104           0 : }
     105             : 
     106           0 : OUString OCommandDefinition::getUpdateCatalogName() throw( ::com::sun::star::uno::RuntimeException )
     107             : {
     108           0 :     return getCommandDefinition().m_sUpdateCatalogName;
     109             : }
     110             : 
     111           0 : void OCommandDefinition::setUpdateCatalogName(const OUString& p1) throw( ::com::sun::star::uno::RuntimeException )
     112             : {
     113           0 :     setPropertyValue(PROPERTY_UPDATE_CATALOGNAME, Any(p1) );
     114           0 : }
     115             : 
     116           0 : OUString OCommandDefinition::getUpdateSchemaName() throw( ::com::sun::star::uno::RuntimeException )
     117             : {
     118           0 :     return getCommandDefinition().m_sUpdateSchemaName;
     119             : }
     120             : 
     121           0 : void OCommandDefinition::setUpdateSchemaName(const OUString& p1) throw( ::com::sun::star::uno::RuntimeException )
     122             : {
     123           0 :     setPropertyValue(PROPERTY_UPDATE_SCHEMANAME, Any(p1) );
     124           0 : }
     125             : 
     126          12 : OCommandDefinition::OCommandDefinition(const Reference< XComponentContext >& _xORB
     127             :                                        ,const Reference< XInterface >& _rxContainer
     128             :                                        ,const TContentPtr& _pImpl)
     129          12 :     :OComponentDefinition(_xORB,_rxContainer,_pImpl,false)
     130             : {
     131          12 :     registerProperties();
     132          12 : }
     133             : 
     134          60 : OCommandDefinition::~OCommandDefinition()
     135             : {
     136          60 : }
     137             : 
     138          18 : OCommandDefinition::OCommandDefinition( const Reference< XInterface >& _rxContainer
     139             :                                        ,const OUString& _rElementName
     140             :                                        ,const Reference< XComponentContext >& _xORB
     141             :                                        ,const TContentPtr& _pImpl)
     142          18 :     :OComponentDefinition(_rxContainer,_rElementName,_xORB,_pImpl,false)
     143             : {
     144          18 :     registerProperties();
     145          18 : }
     146             : 
     147           0 : css::uno::Sequence<sal_Int8> OCommandDefinition::getImplementationId()
     148             :     throw (css::uno::RuntimeException, std::exception)
     149             : {
     150           0 :     return css::uno::Sequence<sal_Int8>();
     151             : }
     152             : 
     153           0 : IMPLEMENT_GETTYPES2(OCommandDefinition,OCommandDefinition_Base,OComponentDefinition);
     154        1582 : IMPLEMENT_FORWARD_XINTERFACE2( OCommandDefinition,OComponentDefinition,OCommandDefinition_Base)
     155         558 : IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2(OCommandDefinition,OCommandDefinition_PROP)
     156             : 
     157          52 : OUString OCommandDefinition::getImplementationName_static(  ) throw(RuntimeException)
     158             : {
     159          52 :     return OUString("com.sun.star.comp.dba.OCommandDefinition");
     160             : }
     161             : 
     162           0 : OUString SAL_CALL OCommandDefinition::getImplementationName(  ) throw(RuntimeException, std::exception)
     163             : {
     164           0 :     return getImplementationName_static();
     165             : }
     166             : 
     167          54 : Sequence< OUString > OCommandDefinition::getSupportedServiceNames_static(  ) throw(RuntimeException)
     168             : {
     169          54 :     Sequence< OUString > aServices(3);
     170          54 :     aServices.getArray()[0] = "com.sun.star.sdb.QueryDefinition";
     171          54 :     aServices.getArray()[1] = "com.sun.star.sdb.CommandDefinition";
     172          54 :     aServices.getArray()[2] = "com.sun.star.ucb.Content";
     173          54 :     return aServices;
     174             : }
     175             : 
     176           2 : Sequence< OUString > SAL_CALL OCommandDefinition::getSupportedServiceNames(  ) throw(RuntimeException, std::exception)
     177             : {
     178           2 :     return getSupportedServiceNames_static();
     179             : }
     180             : 
     181          12 : Reference< XInterface > OCommandDefinition::Create(const Reference< XComponentContext >& _rxContext)
     182             : {
     183          12 :     return *(new OCommandDefinition( _rxContext, NULL, TContentPtr( new OCommandDefinition_Impl ) ) );
     184             : }
     185             : 
     186           0 : void SAL_CALL OCommandDefinition::rename( const OUString& newName ) throw (SQLException, ElementExistException, RuntimeException, std::exception)
     187             : {
     188             :     try
     189             :     {
     190           0 :         sal_Int32 nHandle = PROPERTY_ID_NAME;
     191           0 :         osl::ClearableGuard< osl::Mutex > aGuard(m_aMutex);
     192           0 :         Any aOld = makeAny(m_pImpl->m_aProps.aTitle);
     193           0 :         aGuard.clear();
     194           0 :         Any aNew = makeAny(newName);
     195           0 :         fire(&nHandle, &aNew, &aOld, 1, sal_True );
     196             : 
     197           0 :         m_pImpl->m_aProps.aTitle = newName;
     198           0 :         fire(&nHandle, &aNew, &aOld, 1, sal_False );
     199             :     }
     200           0 :     catch(const PropertyVetoException&)
     201             :     {
     202           0 :         throw ElementExistException(newName,*this);
     203             :     }
     204           0 : }
     205             : 
     206             : }   // namespace dbaccess
     207             : 
     208             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10