/************************************************************************* * * $RCSfile: commanddefinition.cxx,v $ * * $Revision: 1.16 $ * * last change: $Author: hr $ $Date: 2004-08-02 15:07:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses * * - GNU Lesser General Public License Version 2.1 * - Sun Industry Standards Source License Version 1.1 * * Sun Microsystems Inc., October, 2000 * * GNU Lesser General Public License Version 2.1 * ============================================= * Copyright 2000 by Sun Microsystems, Inc. * 901 San Antonio Road, Palo Alto, CA 94303, USA * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * * * Sun Industry Standards Source License Version 1.1 * ================================================= * The contents of this file are subject to the Sun Industry Standards * Source License Version 1.1 (the "License"); You may not use this file * except in compliance with the License. You may obtain a copy of the * License at http://www.openoffice.org/license.html. * * Software provided under this License is provided on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. * See the License for the specific provisions governing your rights and * obligations concerning the Software. * * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * * Copyright: 2000 by Sun Microsystems, Inc. * * All Rights Reserved. * * Contributor(s): _______________________________________ * * ************************************************************************/ #ifndef _DBA_COREDATAACESS_COMMANDDEFINITION_HXX_ #include "commanddefinition.hxx" #endif #ifndef _DBASHARED_APITOOLS_HXX_ #include "apitools.hxx" #endif #ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" #endif #ifndef _TOOLS_DEBUG_HXX #include #endif #ifndef _COMPHELPER_SEQUENCE_HXX_ #include #endif #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include #endif #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include #endif using namespace ::com::sun::star::uno; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; using namespace ::osl; using namespace ::comphelper; using namespace ::cppu; //........................................................................ namespace dbaccess { //........................................................................ //========================================================================== //= OCommandDefinition //========================================================================== extern "C" void SAL_CALL createRegistryInfo_OCommandDefinition() { static OMultiInstanceAutoRegistration< OCommandDefinition > aAutoRegistration; } //-------------------------------------------------------------------------- DBG_NAME(OCommandDefinition) //-------------------------------------------------------------------------- void OCommandDefinition::registerProperties() { OCommandDefinition_Impl* pItem = static_cast(m_pImpl.get()); registerProperty(PROPERTY_COMMAND, PROPERTY_ID_COMMAND, PropertyAttribute::BOUND, &pItem->m_sCommand, ::getCppuType(&pItem->m_sCommand)); registerProperty(PROPERTY_USE_ESCAPE_PROCESSING, PROPERTY_ID_USE_ESCAPE_PROCESSING, PropertyAttribute::BOUND, &pItem->m_bEscapeProcessing, ::getBooleanCppuType()); registerProperty(PROPERTY_UPDATE_TABLENAME, PROPERTY_ID_UPDATE_TABLENAME, PropertyAttribute::BOUND, &pItem->m_sUpdateTableName, ::getCppuType(&pItem->m_sUpdateTableName)); registerProperty(PROPERTY_UPDATE_SCHEMANAME, PROPERTY_ID_UPDATE_SCHEMANAME, PropertyAttribute::BOUND, &pItem->m_sUpdateSchemaName, ::getCppuType(&pItem->m_sUpdateSchemaName)); registerProperty(PROPERTY_UPDATE_CATALOGNAME, PROPERTY_ID_UPDATE_CATALOGNAME, PropertyAttribute::BOUND, &pItem->m_sUpdateCatalogName, ::getCppuType(&pItem->m_sUpdateCatalogName)); registerProperty(PROPERTY_LAYOUTINFORMATION, PROPERTY_ID_LAYOUTINFORMATION, PropertyAttribute::BOUND, &pItem->m_aLayoutInformation, ::getCppuType(&pItem->m_aLayoutInformation)); } //-------------------------------------------------------------------------- OCommandDefinition::OCommandDefinition(const Reference< XMultiServiceFactory >& _xORB ,const Reference< XInterface >& _rxContainer ,const TContentPtr& _pImpl) :OComponentDefinition(_xORB,_rxContainer,_pImpl,sal_False) { DBG_CTOR(OCommandDefinition, NULL); registerProperties(); } //-------------------------------------------------------------------------- OCommandDefinition::~OCommandDefinition() { DBG_DTOR(OCommandDefinition, NULL); } //-------------------------------------------------------------------------- OCommandDefinition::OCommandDefinition( const Reference< XInterface >& _rxContainer ,const ::rtl::OUString& _rElementName ,const Reference< XMultiServiceFactory >& _xORB ,const TContentPtr& _pImpl) :OComponentDefinition(_rxContainer,_rElementName,_xORB,_pImpl,sal_False) { DBG_CTOR(OCommandDefinition, NULL); registerProperties(); } //-------------------------------------------------------------------------- IMPLEMENT_IMPLEMENTATION_ID(OCommandDefinition); IMPLEMENT_GETTYPES2(OCommandDefinition,OCommandDefinition_Base,OComponentDefinition); IMPLEMENT_FORWARD_XINTERFACE2( OCommandDefinition,OComponentDefinition,OCommandDefinition_Base) IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2(OCommandDefinition,OCommandDefinition_PROP) //-------------------------------------------------------------------------- ::rtl::OUString OCommandDefinition::getImplementationName_Static( ) throw(RuntimeException) { return ::rtl::OUString::createFromAscii("com.sun.star.comp.dba.OCommandDefinition"); } //-------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OCommandDefinition::getImplementationName( ) throw(RuntimeException) { return getImplementationName_Static(); } //-------------------------------------------------------------------------- Sequence< ::rtl::OUString > OCommandDefinition::getSupportedServiceNames_Static( ) throw(RuntimeException) { Sequence< ::rtl::OUString > aServices(3); aServices.getArray()[0] = SERVICE_SDB_QUERYDEFINITION; aServices.getArray()[1] = SERVICE_SDB_COMMAND_DEFINITION; aServices.getArray()[2] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.Content")); return aServices; } //-------------------------------------------------------------------------- Sequence< ::rtl::OUString > SAL_CALL OCommandDefinition::getSupportedServiceNames( ) throw(RuntimeException) { return getSupportedServiceNames_Static(); } //------------------------------------------------------------------------------ Reference< XInterface > OCommandDefinition::Create(const Reference< XMultiServiceFactory >& _rxFactory) { return *(new OCommandDefinition(_rxFactory,NULL,TContentPtr(new OCommandDefinition_Impl))); } // ----------------------------------------------------------------------------- void SAL_CALL OCommandDefinition::rename( const ::rtl::OUString& newName ) throw (SQLException, ElementExistException, RuntimeException) { try { sal_Int32 nHandle = PROPERTY_ID_NAME; osl::ClearableGuard< osl::Mutex > aGuard(m_aMutex); Any aOld = makeAny(m_pImpl->m_aProps.aTitle); aGuard.clear(); Any aNew = makeAny(newName); fire(&nHandle, &aNew, &aOld, 1, sal_True ); m_pImpl->m_aProps.aTitle = newName; fire(&nHandle, &aNew, &aOld, 1, sal_False ); } catch(const PropertyVetoException&) { throw ElementExistException(newName,*this); } } // ----------------------------------------------------------------------------- //........................................................................ } // namespace dbaccess //........................................................................