LCOV - code coverage report
Current view: top level - dbaccess/source/core/dataaccess - commanddefinition.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 80 0.0 %
Date: 2014-04-14 Functions: 0 31 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 "commanddefinition.hxx"
      21             : #include "apitools.hxx"
      22             : #include "dbastrings.hrc"
      23             : #include "module_dba.hxx"
      24             : 
      25             : #include <com/sun/star/lang/DisposedException.hpp>
      26             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      27             : 
      28             : #include <tools/debug.hxx>
      29             : #include <comphelper/sequence.hxx>
      30             : 
      31             : using namespace ::com::sun::star::uno;
      32             : using namespace ::com::sun::star::sdbc;
      33             : using namespace ::com::sun::star::lang;
      34             : using namespace ::com::sun::star::beans;
      35             : using namespace ::com::sun::star::container;
      36             : using namespace ::osl;
      37             : using namespace ::comphelper;
      38             : using namespace ::cppu;
      39             : 
      40             : namespace dbaccess
      41             : {
      42             : 
      43             : // OCommandDefinition
      44           0 : extern "C" void SAL_CALL createRegistryInfo_OCommandDefinition()
      45             : {
      46           0 :     static ::dba::OAutoRegistration< OCommandDefinition > aAutoRegistration;
      47           0 : }
      48             : 
      49             : 
      50           0 : void OCommandDefinition::registerProperties()
      51             : {
      52           0 :     OCommandDefinition_Impl& rCommandDefinition( getCommandDefinition() );
      53             :     registerProperty(PROPERTY_COMMAND, PROPERTY_ID_COMMAND, PropertyAttribute::BOUND,
      54           0 :                     &rCommandDefinition.m_sCommand, ::getCppuType(&rCommandDefinition.m_sCommand));
      55             : 
      56             :     registerProperty(PROPERTY_ESCAPE_PROCESSING, PROPERTY_ID_ESCAPE_PROCESSING, PropertyAttribute::BOUND,
      57           0 :                     &rCommandDefinition.m_bEscapeProcessing, ::getBooleanCppuType());
      58             : 
      59             :     registerProperty(PROPERTY_UPDATE_TABLENAME, PROPERTY_ID_UPDATE_TABLENAME, PropertyAttribute::BOUND,
      60           0 :                     &rCommandDefinition.m_sUpdateTableName, ::getCppuType(&rCommandDefinition.m_sUpdateTableName));
      61             : 
      62             :     registerProperty(PROPERTY_UPDATE_SCHEMANAME, PROPERTY_ID_UPDATE_SCHEMANAME, PropertyAttribute::BOUND,
      63           0 :                     &rCommandDefinition.m_sUpdateSchemaName, ::getCppuType(&rCommandDefinition.m_sUpdateSchemaName));
      64             : 
      65             :     registerProperty(PROPERTY_UPDATE_CATALOGNAME, PROPERTY_ID_UPDATE_CATALOGNAME, PropertyAttribute::BOUND,
      66           0 :                     &rCommandDefinition.m_sUpdateCatalogName, ::getCppuType(&rCommandDefinition.m_sUpdateCatalogName));
      67             :     registerProperty(PROPERTY_LAYOUTINFORMATION, PROPERTY_ID_LAYOUTINFORMATION, PropertyAttribute::BOUND,
      68           0 :                     &rCommandDefinition.m_aLayoutInformation, ::getCppuType(&rCommandDefinition.m_aLayoutInformation));
      69           0 : }
      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 : sal_Bool OCommandDefinition::getEscapeProcessing() throw( ::com::sun::star::uno::RuntimeException )
      87             : {
      88           0 :     return getCommandDefinition().m_bEscapeProcessing;
      89             : }
      90             : 
      91           0 : void OCommandDefinition::setEscapeProcessing(sal_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           0 : OCommandDefinition::OCommandDefinition(const Reference< XComponentContext >& _xORB
     127             :                                        ,const Reference< XInterface >& _rxContainer
     128             :                                        ,const TContentPtr& _pImpl)
     129           0 :     :OComponentDefinition(_xORB,_rxContainer,_pImpl,sal_False)
     130             : {
     131           0 :     registerProperties();
     132           0 : }
     133             : 
     134           0 : OCommandDefinition::~OCommandDefinition()
     135             : {
     136           0 : }
     137             : 
     138           0 : OCommandDefinition::OCommandDefinition( const Reference< XInterface >& _rxContainer
     139             :                                        ,const OUString& _rElementName
     140             :                                        ,const Reference< XComponentContext >& _xORB
     141             :                                        ,const TContentPtr& _pImpl)
     142           0 :     :OComponentDefinition(_rxContainer,_rElementName,_xORB,_pImpl,sal_False)
     143             : {
     144           0 :     registerProperties();
     145           0 : }
     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           0 : IMPLEMENT_FORWARD_XINTERFACE2( OCommandDefinition,OComponentDefinition,OCommandDefinition_Base)
     155           0 : IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2(OCommandDefinition,OCommandDefinition_PROP)
     156             : 
     157           0 : OUString OCommandDefinition::getImplementationName_static(  ) throw(RuntimeException)
     158             : {
     159           0 :     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           0 : Sequence< OUString > OCommandDefinition::getSupportedServiceNames_static(  ) throw(RuntimeException)
     168             : {
     169           0 :     Sequence< OUString > aServices(3);
     170           0 :     aServices.getArray()[0] = "com.sun.star.sdb.QueryDefinition";
     171           0 :     aServices.getArray()[1] = "com.sun.star.sdb.CommandDefinition";
     172           0 :     aServices.getArray()[2] = "com.sun.star.ucb.Content";
     173           0 :     return aServices;
     174             : }
     175             : 
     176           0 : Sequence< OUString > SAL_CALL OCommandDefinition::getSupportedServiceNames(  ) throw(RuntimeException, std::exception)
     177             : {
     178           0 :     return getSupportedServiceNames_static();
     179             : }
     180             : 
     181           0 : Reference< XInterface > OCommandDefinition::Create(const Reference< XComponentContext >& _rxContext)
     182             : {
     183           0 :     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