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 "commandcontainer.hxx"
22 : : #include "commanddefinition.hxx"
23 : :
24 : : #include <tools/debug.hxx>
25 : : #include "dbastrings.hrc"
26 : :
27 : : using namespace ::com::sun::star::uno;
28 : : using namespace ::com::sun::star::lang;
29 : : using namespace ::com::sun::star::beans;
30 : : using namespace ::com::sun::star::container;
31 : : using namespace ::com::sun::star::ucb;
32 : : using namespace ::osl;
33 : : using namespace ::comphelper;
34 : : using namespace ::cppu;
35 : :
36 : : namespace dbaccess
37 : : {
38 : :
39 : : //==========================================================================
40 : : //= OCommandContainer
41 : : //==========================================================================
42 : : DBG_NAME(OCommandContainer)
43 : :
44 : 976 : OCommandContainer::OCommandContainer( const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB
45 : : ,const Reference< XInterface >& _xParentContainer
46 : : ,const TContentPtr& _pImpl
47 : : ,sal_Bool _bTables
48 : : )
49 : : :ODefinitionContainer(_xORB,_xParentContainer,_pImpl,!_bTables)
50 : 976 : ,m_bTables(_bTables)
51 : : {
52 : : DBG_CTOR(OCommandContainer, NULL);
53 : 976 : }
54 : :
55 : 976 : OCommandContainer::~OCommandContainer()
56 : : {
57 : : DBG_DTOR(OCommandContainer, NULL);
58 [ - + ]: 1952 : }
59 : :
60 [ + + ][ + - ]: 37562 : IMPLEMENT_FORWARD_XINTERFACE2( OCommandContainer,ODefinitionContainer,OCommandContainer_BASE)
61 [ + - ][ + - ]: 6 : IMPLEMENT_TYPEPROVIDER2(OCommandContainer,ODefinitionContainer,OCommandContainer_BASE);
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
62 : :
63 : 12 : Reference< XContent > OCommandContainer::createObject( const ::rtl::OUString& _rName)
64 : : {
65 : 12 : const ODefinitionContainer_Impl& rDefinitions( getDefinitions() );
66 : : OSL_ENSURE( rDefinitions.find(_rName) != rDefinitions.end(), "OCommandContainer::createObject: Invalid entry in map!" );
67 : :
68 : 12 : const TContentPtr& pElementContent( rDefinitions.find( _rName )->second );
69 [ + - ]: 12 : if ( m_bTables )
70 [ + - ][ + - ]: 12 : return new OComponentDefinition( *this, _rName, m_aContext.getLegacyServiceFactory(), pElementContent, m_bTables );
[ + - ][ + - ]
71 [ # # ][ # # ]: 12 : return new OCommandDefinition( *this, _rName, m_aContext.getLegacyServiceFactory(), pElementContent );
[ # # ][ # # ]
72 : : }
73 : :
74 : 0 : Reference< XInterface > SAL_CALL OCommandContainer::createInstanceWithArguments(const Sequence< Any >& /*aArguments*/ ) throw (Exception, RuntimeException)
75 : : {
76 : 0 : return createInstance( );
77 : : }
78 : :
79 : 0 : Reference< XInterface > SAL_CALL OCommandContainer::createInstance( ) throw (Exception, RuntimeException)
80 : : {
81 [ # # ][ # # ]: 0 : return m_aContext.createComponent( (::rtl::OUString)( m_bTables ? SERVICE_SDB_TABLEDEFINITION : SERVICE_SDB_COMMAND_DEFINITION ) );
82 : : }
83 : :
84 : 0 : ::rtl::OUString OCommandContainer::determineContentType() const
85 : : {
86 : 0 : return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.org.openoffice.DatabaseCommandDefinitionContainer" ) );
87 : : }
88 : :
89 : : } // namespace dbaccess
90 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|