Files
libreoffice/dbaccess/source/core/dataaccess/commanddefinition.cxx

180 lines
7.8 KiB
C++
Raw Normal View History

2000-09-18 23:16:46 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 23:16:46 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 23:16:46 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 23:16:46 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 23:16:46 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-09-18 23:16:46 +00:00
*
* OpenOffice.org 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 version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-09-18 23:16:46 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-09-18 23:16:46 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
2000-09-18 23:16:46 +00:00
#include "commanddefinition.hxx"
#include "apitools.hxx"
2000-10-25 06:42:28 +00:00
#include "dbastrings.hrc"
#include "module_dba.hxx"
2000-09-18 23:16:46 +00:00
#include <com/sun/star/lang/DisposedException.hpp>
2000-10-25 06:42:28 +00:00
#include <com/sun/star/beans/PropertyAttribute.hpp>
2000-09-18 23:16:46 +00:00
#include <tools/debug.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/componentcontext.hxx>
2000-09-18 23:16:46 +00:00
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbc;
2000-09-18 23:16:46 +00:00
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
2000-09-18 23:16:46 +00:00
using namespace ::osl;
2000-10-11 10:21:40 +00:00
using namespace ::comphelper;
2000-09-18 23:16:46 +00:00
using namespace ::cppu;
//........................................................................
namespace dbaccess
{
//........................................................................
2000-09-18 23:16:46 +00:00
//==========================================================================
//= OCommandDefinition
//==========================================================================
extern "C" void SAL_CALL createRegistryInfo_OCommandDefinition()
{
static ::dba::OAutoRegistration< OCommandDefinition > aAutoRegistration;
2000-09-18 23:16:46 +00:00
}
//--------------------------------------------------------------------------
DBG_NAME(OCommandDefinition)
//--------------------------------------------------------------------------
void OCommandDefinition::registerProperties()
{
OCommandDefinition_Impl& rCommandDefinition( getCommandDefinition() );
2000-09-18 23:16:46 +00:00
registerProperty(PROPERTY_COMMAND, PROPERTY_ID_COMMAND, PropertyAttribute::BOUND,
&rCommandDefinition.m_sCommand, ::getCppuType(&rCommandDefinition.m_sCommand));
2000-09-18 23:16:46 +00:00
registerProperty(PROPERTY_ESCAPE_PROCESSING, PROPERTY_ID_ESCAPE_PROCESSING, PropertyAttribute::BOUND,
&rCommandDefinition.m_bEscapeProcessing, ::getBooleanCppuType());
2000-09-18 23:16:46 +00:00
registerProperty(PROPERTY_UPDATE_TABLENAME, PROPERTY_ID_UPDATE_TABLENAME, PropertyAttribute::BOUND,
&rCommandDefinition.m_sUpdateTableName, ::getCppuType(&rCommandDefinition.m_sUpdateTableName));
2000-09-18 23:16:46 +00:00
registerProperty(PROPERTY_UPDATE_SCHEMANAME, PROPERTY_ID_UPDATE_SCHEMANAME, PropertyAttribute::BOUND,
&rCommandDefinition.m_sUpdateSchemaName, ::getCppuType(&rCommandDefinition.m_sUpdateSchemaName));
2000-09-18 23:16:46 +00:00
registerProperty(PROPERTY_UPDATE_CATALOGNAME, PROPERTY_ID_UPDATE_CATALOGNAME, PropertyAttribute::BOUND,
&rCommandDefinition.m_sUpdateCatalogName, ::getCppuType(&rCommandDefinition.m_sUpdateCatalogName));
registerProperty(PROPERTY_LAYOUTINFORMATION, PROPERTY_ID_LAYOUTINFORMATION, PropertyAttribute::BOUND,
&rCommandDefinition.m_aLayoutInformation, ::getCppuType(&rCommandDefinition.m_aLayoutInformation));
2000-09-18 23:16:46 +00:00
}
//--------------------------------------------------------------------------
OCommandDefinition::OCommandDefinition(const Reference< XMultiServiceFactory >& _xORB
,const Reference< XInterface >& _rxContainer
,const TContentPtr& _pImpl)
:OComponentDefinition(_xORB,_rxContainer,_pImpl,sal_False)
{
DBG_CTOR(OCommandDefinition, NULL);
registerProperties();
}
2000-09-18 23:16:46 +00:00
//--------------------------------------------------------------------------
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)
2000-09-18 23:16:46 +00:00
{
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)
2000-09-18 23:16:46 +00:00
//--------------------------------------------------------------------------
::rtl::OUString OCommandDefinition::getImplementationName_static( ) throw(RuntimeException)
2000-09-18 23:16:46 +00:00
{
2001-01-05 09:49:38 +00:00
return ::rtl::OUString::createFromAscii("com.sun.star.comp.dba.OCommandDefinition");
2000-09-18 23:16:46 +00:00
}
//--------------------------------------------------------------------------
::rtl::OUString SAL_CALL OCommandDefinition::getImplementationName( ) throw(RuntimeException)
{
return getImplementationName_static();
2000-09-18 23:16:46 +00:00
}
//--------------------------------------------------------------------------
Sequence< ::rtl::OUString > OCommandDefinition::getSupportedServiceNames_static( ) throw(RuntimeException)
2000-09-18 23:16:46 +00:00
{
Sequence< ::rtl::OUString > aServices(3);
2000-09-18 23:16:46 +00:00
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"));
2000-09-18 23:16:46 +00:00
return aServices;
}
//--------------------------------------------------------------------------
Sequence< ::rtl::OUString > SAL_CALL OCommandDefinition::getSupportedServiceNames( ) throw(RuntimeException)
{
return getSupportedServiceNames_static();
2000-09-18 23:16:46 +00:00
}
//------------------------------------------------------------------------------
Reference< XInterface > OCommandDefinition::Create(const Reference< XComponentContext >& _rxContext)
2000-09-18 23:16:46 +00:00
{
::comphelper::ComponentContext aContext( _rxContext );
return *(new OCommandDefinition( aContext.getLegacyServiceFactory(), NULL, TContentPtr( new OCommandDefinition_Impl ) ) );
2000-09-18 23:16:46 +00:00
}
// -----------------------------------------------------------------------------
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
//........................................................................
2000-09-18 23:16:46 +00:00