tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / dbaccess / source / core / dataaccess / commandcontainer.cxx
blob9f426f4651a63f27236477be99a27baaa4ff3989
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 "commandcontainer.hxx"
21 #include "commanddefinition.hxx"
23 #include <com/sun/star/sdb/TableDefinition.hpp>
24 #include <com/sun/star/sdb/CommandDefinition.hpp>
26 using namespace ::com::sun::star::uno;
27 using namespace ::com::sun::star::ucb;
28 using namespace ::comphelper;
29 using namespace ::cppu;
31 namespace dbaccess
34 // OCommandContainer
36 OCommandContainer::OCommandContainer( const Reference< css::uno::XComponentContext >& _xORB
37 ,const Reference< XInterface >& _xParentContainer
38 ,const TContentPtr& _pImpl
39 ,bool _bTables
41 :ODefinitionContainer(_xORB,_xParentContainer,_pImpl,!_bTables)
42 ,m_bTables(_bTables)
46 OCommandContainer::~OCommandContainer()
50 IMPLEMENT_FORWARD_XINTERFACE2( OCommandContainer,ODefinitionContainer,OCommandContainer_BASE)
51 css::uno::Sequence< css::uno::Type > OCommandContainer::getTypes()
53 return ::comphelper::concatSequences(
54 ODefinitionContainer::getTypes( ),
55 OCommandContainer_BASE::getTypes( )
59 css::uno::Sequence<sal_Int8> OCommandContainer::getImplementationId()
61 return css::uno::Sequence<sal_Int8>();
64 Reference< XContent > OCommandContainer::createObject( const OUString& _rName)
66 const ODefinitionContainer_Impl& rDefinitions( getDefinitions() );
67 OSL_ENSURE( rDefinitions.find(_rName) != rDefinitions.end(), "OCommandContainer::createObject: Invalid entry in map!" );
69 const TContentPtr& pElementContent( rDefinitions.find( _rName )->second );
70 if ( m_bTables )
71 return new OComponentDefinition( *this, _rName, m_aContext, pElementContent, m_bTables );
72 else
73 return static_cast< css::sdb::XQueryDefinition * > ( new OCommandDefinition( *this, _rName, m_aContext, pElementContent ) );
76 Reference< XInterface > SAL_CALL OCommandContainer::createInstanceWithArguments(const Sequence< Any >& /*aArguments*/ )
78 return createInstance( );
81 Reference< XInterface > SAL_CALL OCommandContainer::createInstance( )
83 if(m_bTables)
84 return css::sdb::TableDefinition::createDefault( m_aContext );
85 else
86 return css::sdb::CommandDefinition::create( m_aContext );
89 OUString OCommandContainer::determineContentType() const
91 return u"application/vnd.org.openoffice.DatabaseCommandDefinitionContainer"_ustr;
94 } // namespace dbaccess
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */