Branch data 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 : 32 : extern "C" void SAL_CALL createRegistryInfo_OCommandDefinition()
49 : : {
50 [ + - ][ + - ]: 32 : static ::dba::OAutoRegistration< OCommandDefinition > aAutoRegistration;
[ + - ][ # # ]
51 : 32 : }
52 : :
53 : : DBG_NAME(OCommandDefinition)
54 : :
55 : 2 : void OCommandDefinition::registerProperties()
56 : : {
57 : 2 : OCommandDefinition_Impl& rCommandDefinition( getCommandDefinition() );
58 : : registerProperty(PROPERTY_COMMAND, PROPERTY_ID_COMMAND, PropertyAttribute::BOUND,
59 [ + - ]: 2 : &rCommandDefinition.m_sCommand, ::getCppuType(&rCommandDefinition.m_sCommand));
60 : :
61 : : registerProperty(PROPERTY_ESCAPE_PROCESSING, PROPERTY_ID_ESCAPE_PROCESSING, PropertyAttribute::BOUND,
62 [ + - ]: 2 : &rCommandDefinition.m_bEscapeProcessing, ::getBooleanCppuType());
63 : :
64 : : registerProperty(PROPERTY_UPDATE_TABLENAME, PROPERTY_ID_UPDATE_TABLENAME, PropertyAttribute::BOUND,
65 [ + - ]: 2 : &rCommandDefinition.m_sUpdateTableName, ::getCppuType(&rCommandDefinition.m_sUpdateTableName));
66 : :
67 : : registerProperty(PROPERTY_UPDATE_SCHEMANAME, PROPERTY_ID_UPDATE_SCHEMANAME, PropertyAttribute::BOUND,
68 [ + - ]: 2 : &rCommandDefinition.m_sUpdateSchemaName, ::getCppuType(&rCommandDefinition.m_sUpdateSchemaName));
69 : :
70 : : registerProperty(PROPERTY_UPDATE_CATALOGNAME, PROPERTY_ID_UPDATE_CATALOGNAME, PropertyAttribute::BOUND,
71 [ + - ]: 2 : &rCommandDefinition.m_sUpdateCatalogName, ::getCppuType(&rCommandDefinition.m_sUpdateCatalogName));
72 : : registerProperty(PROPERTY_LAYOUTINFORMATION, PROPERTY_ID_LAYOUTINFORMATION, PropertyAttribute::BOUND,
73 [ + - ]: 2 : &rCommandDefinition.m_aLayoutInformation, ::getCppuType(&rCommandDefinition.m_aLayoutInformation));
74 : 2 : }
75 : :
76 : 2 : OCommandDefinition::OCommandDefinition(const Reference< XMultiServiceFactory >& _xORB
77 : : ,const Reference< XInterface >& _rxContainer
78 : : ,const TContentPtr& _pImpl)
79 [ + - ]: 2 : :OComponentDefinition(_xORB,_rxContainer,_pImpl,sal_False)
80 : : {
81 : : DBG_CTOR(OCommandDefinition, NULL);
82 [ + - ]: 2 : registerProperties();
83 : 2 : }
84 : :
85 [ + - ]: 2 : OCommandDefinition::~OCommandDefinition()
86 : : {
87 : : DBG_DTOR(OCommandDefinition, NULL);
88 [ - + ]: 4 : }
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 [ - + ][ # # ]: 128 : IMPLEMENT_FORWARD_XINTERFACE2( OCommandDefinition,OComponentDefinition,OCommandDefinition_Base)
103 [ + - ][ + - ]: 132 : IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2(OCommandDefinition,OCommandDefinition_PROP)
[ + - ][ + - ]
104 : :
105 : 32 : ::rtl::OUString OCommandDefinition::getImplementationName_static( ) throw(RuntimeException)
106 : : {
107 : 32 : 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 : 34 : Sequence< ::rtl::OUString > OCommandDefinition::getSupportedServiceNames_static( ) throw(RuntimeException)
116 : : {
117 : 34 : Sequence< ::rtl::OUString > aServices(3);
118 [ + - ][ + - ]: 34 : aServices.getArray()[0] = SERVICE_SDB_QUERYDEFINITION;
119 [ + - ][ + - ]: 34 : aServices.getArray()[1] = SERVICE_SDB_COMMAND_DEFINITION;
120 [ + - ][ + - ]: 34 : aServices.getArray()[2] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.Content"));
121 : 34 : return aServices;
122 : : }
123 : :
124 : 2 : Sequence< ::rtl::OUString > SAL_CALL OCommandDefinition::getSupportedServiceNames( ) throw(RuntimeException)
125 : : {
126 : 2 : return getSupportedServiceNames_static();
127 : : }
128 : :
129 : 2 : Reference< XInterface > OCommandDefinition::Create(const Reference< XComponentContext >& _rxContext)
130 : : {
131 [ + - ]: 2 : ::comphelper::ComponentContext aContext( _rxContext );
132 [ + - ][ + - ]: 2 : 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: */
|