LCOV - code coverage report
Current view: top level - libreoffice/dbaccess/source/core/dataaccess - commanddefinition.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 53 20.8 %
Date: 2012-12-27 Functions: 3 21 14.3 %
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             : 
      21             : #include "commanddefinition.hxx"
      22             : #include "apitools.hxx"
      23             : #include "dbastrings.hrc"
      24             : #include "module_dba.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             : #include <comphelper/componentcontext.hxx>
      32             : 
      33             : using namespace ::com::sun::star::uno;
      34             : using namespace ::com::sun::star::sdbc;
      35             : using namespace ::com::sun::star::lang;
      36             : using namespace ::com::sun::star::beans;
      37             : using namespace ::com::sun::star::container;
      38             : using namespace ::osl;
      39             : using namespace ::comphelper;
      40             : using namespace ::cppu;
      41             : 
      42             : namespace dbaccess
      43             : {
      44             : 
      45             : //==========================================================================
      46             : //= OCommandDefinition
      47             : //==========================================================================
      48           3 : extern "C" void SAL_CALL createRegistryInfo_OCommandDefinition()
      49             : {
      50           3 :     static ::dba::OAutoRegistration< OCommandDefinition > aAutoRegistration;
      51           3 : }
      52             : 
      53             : DBG_NAME(OCommandDefinition)
      54             : 
      55           0 : void OCommandDefinition::registerProperties()
      56             : {
      57           0 :     OCommandDefinition_Impl& rCommandDefinition( getCommandDefinition() );
      58             :     registerProperty(PROPERTY_COMMAND, PROPERTY_ID_COMMAND, PropertyAttribute::BOUND,
      59           0 :                     &rCommandDefinition.m_sCommand, ::getCppuType(&rCommandDefinition.m_sCommand));
      60             : 
      61             :     registerProperty(PROPERTY_ESCAPE_PROCESSING, PROPERTY_ID_ESCAPE_PROCESSING, PropertyAttribute::BOUND,
      62           0 :                     &rCommandDefinition.m_bEscapeProcessing, ::getBooleanCppuType());
      63             : 
      64             :     registerProperty(PROPERTY_UPDATE_TABLENAME, PROPERTY_ID_UPDATE_TABLENAME, PropertyAttribute::BOUND,
      65           0 :                     &rCommandDefinition.m_sUpdateTableName, ::getCppuType(&rCommandDefinition.m_sUpdateTableName));
      66             : 
      67             :     registerProperty(PROPERTY_UPDATE_SCHEMANAME, PROPERTY_ID_UPDATE_SCHEMANAME, PropertyAttribute::BOUND,
      68           0 :                     &rCommandDefinition.m_sUpdateSchemaName, ::getCppuType(&rCommandDefinition.m_sUpdateSchemaName));
      69             : 
      70             :     registerProperty(PROPERTY_UPDATE_CATALOGNAME, PROPERTY_ID_UPDATE_CATALOGNAME, PropertyAttribute::BOUND,
      71           0 :                     &rCommandDefinition.m_sUpdateCatalogName, ::getCppuType(&rCommandDefinition.m_sUpdateCatalogName));
      72             :     registerProperty(PROPERTY_LAYOUTINFORMATION, PROPERTY_ID_LAYOUTINFORMATION, PropertyAttribute::BOUND,
      73           0 :                     &rCommandDefinition.m_aLayoutInformation, ::getCppuType(&rCommandDefinition.m_aLayoutInformation));
      74           0 : }
      75             : 
      76           0 : OCommandDefinition::OCommandDefinition(const Reference< XMultiServiceFactory >& _xORB
      77             :                                        ,const Reference< XInterface >& _rxContainer
      78             :                                        ,const TContentPtr& _pImpl)
      79           0 :     :OComponentDefinition(_xORB,_rxContainer,_pImpl,sal_False)
      80             : {
      81             :     DBG_CTOR(OCommandDefinition, NULL);
      82           0 :     registerProperties();
      83           0 : }
      84             : 
      85           0 : OCommandDefinition::~OCommandDefinition()
      86             : {
      87             :     DBG_DTOR(OCommandDefinition, NULL);
      88           0 : }
      89             : 
      90           0 : OCommandDefinition::OCommandDefinition( const Reference< XInterface >& _rxContainer
      91             :                                        ,const ::rtl::OUString& _rElementName
      92             :                                        ,const Reference< XMultiServiceFactory >& _xORB
      93             :                                        ,const TContentPtr& _pImpl)
      94           0 :     :OComponentDefinition(_rxContainer,_rElementName,_xORB,_pImpl,sal_False)
      95             : {
      96             :     DBG_CTOR(OCommandDefinition, NULL);
      97           0 :     registerProperties();
      98           0 : }
      99             : 
     100           0 : IMPLEMENT_IMPLEMENTATION_ID(OCommandDefinition);
     101           0 : IMPLEMENT_GETTYPES2(OCommandDefinition,OCommandDefinition_Base,OComponentDefinition);
     102           0 : IMPLEMENT_FORWARD_XINTERFACE2( OCommandDefinition,OComponentDefinition,OCommandDefinition_Base)
     103           0 : IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2(OCommandDefinition,OCommandDefinition_PROP)
     104             : 
     105           3 : ::rtl::OUString OCommandDefinition::getImplementationName_static(  ) throw(RuntimeException)
     106             : {
     107           3 :     return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.dba.OCommandDefinition"));
     108             : }
     109             : 
     110           0 : ::rtl::OUString SAL_CALL OCommandDefinition::getImplementationName(  ) throw(RuntimeException)
     111             : {
     112           0 :     return getImplementationName_static();
     113             : }
     114             : 
     115           3 : Sequence< ::rtl::OUString > OCommandDefinition::getSupportedServiceNames_static(  ) throw(RuntimeException)
     116             : {
     117           3 :     Sequence< ::rtl::OUString > aServices(3);
     118           3 :     aServices.getArray()[0] = SERVICE_SDB_QUERYDEFINITION;
     119           3 :     aServices.getArray()[1] = SERVICE_SDB_COMMAND_DEFINITION;
     120           3 :     aServices.getArray()[2] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.Content"));
     121           3 :     return aServices;
     122             : }
     123             : 
     124           0 : Sequence< ::rtl::OUString > SAL_CALL OCommandDefinition::getSupportedServiceNames(  ) throw(RuntimeException)
     125             : {
     126           0 :     return getSupportedServiceNames_static();
     127             : }
     128             : 
     129           0 : Reference< XInterface > OCommandDefinition::Create(const Reference< XComponentContext >& _rxContext)
     130             : {
     131           0 :     ::comphelper::ComponentContext aContext( _rxContext );
     132           0 :     return *(new OCommandDefinition( aContext.getLegacyServiceFactory(), NULL, TContentPtr( new OCommandDefinition_Impl ) ) );
     133             : }
     134             : 
     135           0 : void SAL_CALL OCommandDefinition::rename( const ::rtl::OUString& newName ) throw (SQLException, ElementExistException, RuntimeException)
     136             : {
     137             :     try
     138             :     {
     139           0 :         sal_Int32 nHandle = PROPERTY_ID_NAME;
     140           0 :         osl::ClearableGuard< osl::Mutex > aGuard(m_aMutex);
     141           0 :         Any aOld = makeAny(m_pImpl->m_aProps.aTitle);
     142           0 :         aGuard.clear();
     143           0 :         Any aNew = makeAny(newName);
     144           0 :         fire(&nHandle, &aNew, &aOld, 1, sal_True );
     145             : 
     146           0 :         m_pImpl->m_aProps.aTitle = newName;
     147           0 :         fire(&nHandle, &aNew, &aOld, 1, sal_False );
     148             :     }
     149           0 :     catch(const PropertyVetoException&)
     150             :     {
     151           0 :         throw ElementExistException(newName,*this);
     152             :     }
     153           0 : }
     154             : 
     155             : }   // namespace dbaccess
     156             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10