nss: upgrade to release 3.73
[LibreOffice.git] / dbaccess / source / core / dataaccess / commanddefinition.cxx
blob41ce139a8dc10b387b267f5ed9bf0abf83bba50c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "commanddefinition.hxx"
21 #include <apitools.hxx>
22 #include <stringconstants.hxx>
24 #include <com/sun/star/container/ElementExistException.hpp>
25 #include <com/sun/star/beans/PropertyAttribute.hpp>
28 using namespace ::com::sun::star::uno;
29 using namespace ::com::sun::star::sdbc;
30 using namespace ::com::sun::star::lang;
31 using namespace ::com::sun::star::beans;
32 using namespace ::com::sun::star::container;
34 namespace dbaccess
37 void OCommandDefinition::registerProperties()
39 OCommandDefinition_Impl& rCommandDefinition = dynamic_cast< OCommandDefinition_Impl& >( *m_pImpl );
40 registerProperty(PROPERTY_COMMAND, PROPERTY_ID_COMMAND, PropertyAttribute::BOUND,
41 &rCommandDefinition.m_sCommand, cppu::UnoType<decltype(rCommandDefinition.m_sCommand)>::get());
43 registerProperty(PROPERTY_ESCAPE_PROCESSING, PROPERTY_ID_ESCAPE_PROCESSING, PropertyAttribute::BOUND,
44 &rCommandDefinition.m_bEscapeProcessing, cppu::UnoType<bool>::get());
46 registerProperty(PROPERTY_UPDATE_TABLENAME, PROPERTY_ID_UPDATE_TABLENAME, PropertyAttribute::BOUND,
47 &rCommandDefinition.m_sUpdateTableName, cppu::UnoType<decltype(rCommandDefinition.m_sUpdateTableName)>::get());
49 registerProperty(PROPERTY_UPDATE_SCHEMANAME, PROPERTY_ID_UPDATE_SCHEMANAME, PropertyAttribute::BOUND,
50 &rCommandDefinition.m_sUpdateSchemaName, cppu::UnoType<decltype(rCommandDefinition.m_sUpdateSchemaName)>::get());
52 registerProperty(PROPERTY_UPDATE_CATALOGNAME, PROPERTY_ID_UPDATE_CATALOGNAME, PropertyAttribute::BOUND,
53 &rCommandDefinition.m_sUpdateCatalogName, cppu::UnoType<decltype(rCommandDefinition.m_sUpdateCatalogName)>::get());
54 registerProperty(PROPERTY_LAYOUTINFORMATION, PROPERTY_ID_LAYOUTINFORMATION, PropertyAttribute::BOUND,
55 &rCommandDefinition.m_aLayoutInformation, cppu::UnoType<decltype(rCommandDefinition.m_aLayoutInformation)>::get());
58 OCommandDefinition::OCommandDefinition(const Reference< XComponentContext >& _xORB
59 ,const Reference< XInterface >& _rxContainer
60 ,const TContentPtr& _pImpl)
61 :OComponentDefinition(_xORB,_rxContainer,_pImpl,false)
63 registerProperties();
66 OCommandDefinition::~OCommandDefinition()
70 OCommandDefinition::OCommandDefinition( const Reference< XInterface >& _rxContainer
71 ,const OUString& _rElementName
72 ,const Reference< XComponentContext >& _xORB
73 ,const TContentPtr& _pImpl)
74 :OComponentDefinition(_rxContainer,_rElementName,_xORB,_pImpl,false)
76 registerProperties();
79 css::uno::Sequence<sal_Int8> OCommandDefinition::getImplementationId()
81 return css::uno::Sequence<sal_Int8>();
84 IMPLEMENT_GETTYPES2(OCommandDefinition,OCommandDefinition_Base,OComponentDefinition);
85 IMPLEMENT_FORWARD_XINTERFACE2( OCommandDefinition,OComponentDefinition,OCommandDefinition_Base)
86 IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2(OCommandDefinition,OCommandDefinition_PROP)
88 OUString SAL_CALL OCommandDefinition::getImplementationName()
90 return "com.sun.star.comp.dba.OCommandDefinition";
93 css::uno::Sequence<OUString> SAL_CALL OCommandDefinition::getSupportedServiceNames()
95 return {
96 "com.sun.star.sdb.QueryDefinition",
97 "com.sun.star.sdb.CommandDefinition",
98 "com.sun.star.ucb.Content"
102 void SAL_CALL OCommandDefinition::rename( const OUString& newName )
106 sal_Int32 nHandle = PROPERTY_ID_NAME;
107 osl::ClearableGuard< osl::Mutex > aGuard(m_aMutex);
108 Any aOld = makeAny(m_pImpl->m_aProps.aTitle);
109 aGuard.clear();
110 Any aNew = makeAny(newName);
111 fire(&nHandle, &aNew, &aOld, 1, true );
113 m_pImpl->m_aProps.aTitle = newName;
114 fire(&nHandle, &aNew, &aOld, 1, false );
116 catch(const PropertyVetoException&)
118 throw ElementExistException(newName,*this);
122 } // namespace dbaccess
124 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
125 com_sun_star_comp_dba_OCommandDefinition(css::uno::XComponentContext* context,
126 css::uno::Sequence<css::uno::Any> const &)
128 return cppu::acquire(new dbaccess::OCommandDefinition(
129 context, nullptr, std::make_shared<dbaccess::OCommandDefinition_Impl>() ));
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */